How to use the pyntcloud.utils.array.point_in_array_2D function in pyntcloud

To help you get started, we’ve selected a few pyntcloud examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github daavoo / pyntcloud / tests / integration / samplers / test_voxelgrid_samplers.py View on Github external
def test_voxelgrid_centroids_expected_values(simple_pyntcloud, n_x, n_y, n_z, expected_n, expected_point):
    voxelgrid_id = simple_pyntcloud.add_structure(
        "voxelgrid",
        n_x=n_x,
        n_y=n_y,
        n_z=n_z)
    sample = simple_pyntcloud.get_sample(
        "voxelgrid_centroids",
        voxelgrid_id=voxelgrid_id)
    assert len(sample) == expected_n
    assert point_in_array_2D(expected_point, sample.values)
github daavoo / pyntcloud / tests / integration / samplers / test_voxelgrid_samplers.py View on Github external
def test_voxelgrid_highest_expected_values(simple_pyntcloud, size_x, expected_n, expected_in, expected_not_in):
    voxelgrid_id = simple_pyntcloud.add_structure(
        "voxelgrid",
        size_x=size_x)
    sample =  simple_pyntcloud.get_sample(
        "voxelgrid_highest",
        voxelgrid_id=voxelgrid_id)

    assert len(sample) == expected_n
    assert point_in_array_2D(expected_in, sample.loc[:, ["x", "y", "z"]].values)
    assert not point_in_array_2D(expected_not_in, sample.loc[:, ["x", "y", "z"]].values)
github daavoo / pyntcloud / tests / integration / samplers / test_voxelgrid_samplers.py View on Github external
def test_voxelgrid_highest_expected_values(simple_pyntcloud, size_x, expected_n, expected_in, expected_not_in):
    voxelgrid_id = simple_pyntcloud.add_structure(
        "voxelgrid",
        size_x=size_x)
    sample =  simple_pyntcloud.get_sample(
        "voxelgrid_highest",
        voxelgrid_id=voxelgrid_id)

    assert len(sample) == expected_n
    assert point_in_array_2D(expected_in, sample.loc[:, ["x", "y", "z"]].values)
    assert not point_in_array_2D(expected_not_in, sample.loc[:, ["x", "y", "z"]].values)
github daavoo / pyntcloud / tests / integration / samplers / test_points_samplers.py View on Github external
def test_RandomPointsSampler_sampled_points_are_from_original(simple_pyntcloud):
    for i in range(10):
        sample = simple_pyntcloud.get_sample(
            "points_random",
            n=1)
        assert point_in_array_2D(sample, simple_pyntcloud.xyz)
github daavoo / pyntcloud / tests / unit / samplers / test_voxelgrid_samplers.py View on Github external
def test_VoxelgridCentersSampler_expected_values(simple_pyntcloud, n_x, n_y, n_z, expected_n, expected_point):
    voxelgrid_id = simple_pyntcloud.add_structure(
        "voxelgrid",
        n_x=n_x,
        n_y=n_y,
        n_z=n_z)
    sampler = VoxelgridCentersSampler(
        pyntcloud=simple_pyntcloud,
        voxelgrid_id=voxelgrid_id)
    sampler.extract_info()

    sample = sampler.compute()
    assert len(sample) == expected_n
    assert point_in_array_2D(expected_point, sample.values)
github daavoo / pyntcloud / tests / integration / samplers / test_voxelgrid_samplers.py View on Github external
def test_voxelgrid_centers_expected_values(simple_pyntcloud, n_x, n_y, n_z, expected_n, expected_point):
    voxelgrid_id = simple_pyntcloud.add_structure(
        "voxelgrid",
        n_x=n_x,
        n_y=n_y,
        n_z=n_z)
    sample = simple_pyntcloud.get_sample(
        "voxelgrid_centers",
        voxelgrid_id=voxelgrid_id)
    assert len(sample) == expected_n
    assert point_in_array_2D(expected_point, sample.values)
github daavoo / pyntcloud / tests / test_sampling.py View on Github external
with pytest.raises(TypeError):
        cloud.get_sample("voxelgrid_centers")

    vg_id = cloud.add_structure("voxelgrid")

    with pytest.raises(KeyError):
        cloud.get_sample("voxelgrid_centers", voxelgrid=vg_id[:-2])

    sample = cloud.get_sample("voxelgrid_centers", voxelgrid=vg_id)

    assert point_in_array_2D([0.25, 0.25, 0.25], sample.values)

    sample = cloud.get_sample("voxelgrid_centroids", voxelgrid=vg_id)

    assert point_in_array_2D([0.2, 0.2, 0.2], sample.values)

    sample = cloud.get_sample("voxelgrid_nearest", voxelgrid=vg_id)

    assert point_in_array_2D([0.9, 0.9, 0.9], sample.values)
github daavoo / pyntcloud / tests / integration / samplers / test_voxelgrid_samplers.py View on Github external
def test_voxelgrid_nearest_expected_values(simple_pyntcloud, n_x, n_y, n_z, n_points, expected_n, expected_point):
    voxelgrid_id = simple_pyntcloud.add_structure(
        "voxelgrid",
        n_x=n_x,
        n_y=n_y,
        n_z=n_z)
    sample = simple_pyntcloud.get_sample(
        "voxelgrid_nearest",
        voxelgrid_id=voxelgrid_id,
        n=n_points)
    assert len(sample) == expected_n
    assert point_in_array_2D(expected_point, sample.loc[:, ["x", "y", "z"]].values)
github daavoo / pyntcloud / tests / unit / samplers / test_voxelgrid_samplers.py View on Github external
def test_VoxelgridHighestSampler_expected_values(simple_pyntcloud, size_x, expected_n, expected_in, expected_not_in):
    voxelgrid_id = simple_pyntcloud.add_structure(
        "voxelgrid",
        size_x=size_x)
    sampler = VoxelgridHighestSampler(
        pyntcloud=simple_pyntcloud,
        voxelgrid_id=voxelgrid_id)
    sampler.extract_info()

    sample = sampler.compute()
    assert len(sample) == expected_n
    assert point_in_array_2D(expected_in, sample.loc[:, ["x", "y", "z"]].values)
    assert not point_in_array_2D(expected_not_in, sample.loc[:, ["x", "y", "z"]].values)
github daavoo / pyntcloud / tests / test_sampling.py View on Github external
def test_points_sampling():
    path = os.path.abspath(os.path.dirname(__file__))
    cloud = PyntCloud.from_file(path + "/data/voxelgrid.ply")
    with pytest.raises(TypeError):
        sample = cloud.get_sample("points_random_sampling")

    sample = cloud.get_sample("points_random_sampling", n=1)

    assert point_in_array_2D(sample, cloud.xyz)

    sample = cloud.get_sample("points_random_sampling", n=1, as_PyntCloud=True)

    assert isinstance(sample, PyntCloud)