Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from .base import Sampler
import numpy as np
import pandas as pd
class PointsSampler(Sampler):
"""
"""
def extract_info(self):
self.points = self.pyntcloud.points
class RandomPointsSampler(PointsSampler):
"""
Parameters
----------
n: int
Number of unique points that will be chosen.
"""
def __init__(self, *, pyntcloud, n):
super().__init__(pyntcloud=pyntcloud)
import numpy as np
import pandas as pd
from scipy.spatial import cKDTree
from .base import Sampler
class Sampler_Voxelgrid(Sampler):
"""
"""
def __init__(self, pyntcloud, voxelgrid):
super().__init__(pyntcloud)
self.voxelgrid = voxelgrid
def extract_info(self):
self.voxelgrid = self.pyntcloud.structures[self.voxelgrid]
class VoxelgridCenters(Sampler_Voxelgrid):
"""Returns the points that represent each occupied voxel's center."""
def compute(self):
s = self.voxelgrid.voxel_centers[np.unique(self.voxelgrid.voxel_n)]
return pd.DataFrame(s, columns=["x", "y", "z"])
import numpy as np
import pandas as pd
from scipy.spatial.distance import cdist
from .base import Sampler
class VoxelgridSampler(Sampler):
def __init__(self, *, pyntcloud, voxelgrid_id):
super().__init__(pyntcloud=pyntcloud)
self.voxelgrid_id = voxelgrid_id
def extract_info(self):
self.voxelgrid = self.pyntcloud.structures[self.voxelgrid_id]
class VoxelgridCentersSampler(VoxelgridSampler):
"""Returns the points that represent each occupied voxel's center."""
def compute(self):
return pd.DataFrame(
self.voxelgrid.voxel_centers[np.unique(self.voxelgrid.voxel_n)],
columns=["x", "y", "z"])
import numpy as np
import pandas as pd
from .base import Sampler
from ..geometry.areas import triangle_area_multi
class MeshSampler(Sampler):
"""
"""
def __init__(self, *, pyntcloud, rgb=False, normals=False):
super().__init__(pyntcloud=pyntcloud)
self.rgb = rgb
self.normals = normals
def extract_info(self):
v1, v2, v3 = self.pyntcloud.get_mesh_vertices(
rgb=self.rgb, normals=self.normals)
self.v1_xyz = v1[:, :3]
self.v2_xyz = v2[:, :3]
self.v3_xyz = v3[:, :3]