API Reference
point_cloud_utils.MORTON_MAX
point_cloud_utils.MORTON_MIN
point_cloud_utils._ray_mesh_intersector.RayMeshIntersector
Class used to find the intersection between rays and a triangle mesh.
__init__(self, mesh_v, mesh_f)
special
Create a RayMeshIntersector object which can be used to do ray/mesh queries with a triangle mesh.
Parameters: |
|
---|
intersect_rays(self, ray_o, ray_d, ray_near=0.0, ray_far=inf)
Compute intersection between a set of rays and the triangle mesh enclosed in this class
Parameters: |
|
---|
Returns: |
|
---|
point_cloud_utils._ray_point_cloud_intersector.RaySurfelIntersector
Class used to find the intersection between rays and a point cloud converted to surfels (i.e. a point cloud represented as circles centered at each point and oriented perpendicularly to each normal).
__init__(self, p, n, r=0.1, subdivs=7)
special
Construct a RayPointCloudIntersector which can be used to compute the intersection between a set of rays and a point cloud converted to circular patches oriented with the point normals
Parameters: |
|
---|
intersect_rays(self, ray_o, ray_d, ray_near=0.0, ray_far=inf)
Compute intersection between a set of rays and the point cloud converted to circular patches oriented with the point normals
Parameters: |
|
---|
Returns: |
|
---|
point_cloud_utils._mesh_io.TriangleMesh
A lightweight container class representing a triangle mesh with attributes stored at each vertex, wedge, and face, where:
- A vertex is a 3D position
- A wedge is a vertex and its two adjacent edges
- A face is a triangle connecting 3 vertices (Each triangle has 3 vertices and 3 wedges).
The data in encapsulated into vertex data and face data, accessible via TriangleMes.vertex_data
and TriangleMesh.face_data
respectively:
TriangleMesh.vertex_data
:
positions
: [V, 3]-shaped numpy array of per-vertex positionsnormals
: [V, 3]-shaped numpy array of per-vertex normals (or None)texcoords
: [V, 2]-shaped numpy array of per-vertex uv coordinates (or None)tex_ids
: [V,]-shaped numpy array of integer indices into TriangleMesh.textures indicating which texture to use at this vertex (or None)colors
: [V, 4]-shaped numpy array of per-vertex RBGA colors in [0.0, 1.0] (or None)radius
: [V,]-shaped numpy array of per-vertex curvature radii (or None)quality
: [V,]-shaped numpy array of per-vertex quality measures (or None)flags
: [V,]-shaped numpy array of 32-bit integer flags per vertex (or None)
TriangleMesh.face_data
:
vertex_ids
: [F, 3]-shaped numpy array of integer face indices into TrianglMesh.vertex_data.positionsnormals
: [F, 3]-shaped numpy array of per-face normals (or None)colors
: [F, 4]-shaped numpy array of per-face RBGA colors in [0.0, 1.0] (or None)quality
: [F,]-shaped numpy array of per-face quality measures (or None)flags
: [F,]-shaped numpy array of 32-bit integer flags per face (or None)wedge_colors
: [F, 3, 4]-shaped numpy array of per-wedge RBGA colors in [0.0, 1.0] (or None)wedge_normals
: [F, 3, 3]-shaped numpy array of per-wedge normals (or None)wedge_texcoords
: [F, 3, 2]-shaped numpy array of per-wedge] uv coordinates (or None)wedge_tex_ids
: [F, 3]-shaped numpy array of integer indices into TriangleMesh.textures indicating which texture to use at this wedge (or None)textures
: A list of paths to texture image files for this meshnormal_maps
: A list of paths to texture image files for this mesh
f
property
readonly
An (m, 3)-shaped integer array containing this mesh's face indices (None if no faces)
fc
property
readonly
An (m, 4)-shaped array containing this mesh's per-face RBGA colors (None if no face colors)
fn
property
readonly
An (m, 3)-shaped array containing this mesh's per-face normals (None if no face normals)
v
property
readonly
An (n, 3)-shaped array containing this mesh's vertex positions
vc
property
readonly
An (n, 4)-shaped array containing this mesh's per-vertex RGBA (None if no vertex colors)
vn
property
readonly
An (n, 3)-shaped array containing this mesh's per-vertex normals (None if no vertex normals)
FaceData
A lightweight container class representing per-face information within a TriangleMesh with the following attributes
vertex_ids
: [F, 3]-shaped numpy array of integer face indices into TrianglMesh.vertex_data.positionsnormals
: [F, 3]-shaped numpy array of per-face normals (or None)colors
: [F, 4]-shaped numpy array of per-face RBGA colors in [0.0, 1.0] (or None)quality
: [F,]-shaped numpy array of per-face quality measures (or None)flags
: [F,]-shaped numpy array of 32-bit integer flags per face (or None)wedge_colors
: [F, 3, 4]-shaped numpy array of per-wedge RBGA colors in [0.0, 1.0] (or None)wedge_normals
: [F, 3, 3]-shaped numpy array of per-wedge normals (or None)wedge_texcoords
: [F, 3, 2]-shaped numpy array of per-wedge] uv coordinates (or None)wedge_tex_ids
: [F, 3]-shaped numpy array of integer indices into TriangleMesh.textures indicating which texture to use at this wedge (or None)textures
: A list of paths to texture image files for this meshnormal_maps
: A list of paths to texture image files for this mesh
VertexData
A lightweight container class representing per-vertex information within a TriangleMesh with the following attributes
positions
: [V, 3]-shaped numpy array of per-vertex positionsnormals
: [V, 3]-shaped numpy array of per-vertex normals (or None)texcoords
: [V, 2]-shaped numpy array of per-vertex uv coordinates (or None)tex_ids
: [V,]-shaped numpy array of integer indices into TriangleMesh.textures indicating which texture to use at this vertex (or None)colors
: [V, 4]-shaped numpy array of per-vertex RBGA colors in [0.0, 1.0] (or None)radius
: [V,]-shaped numpy array of per-vertex curvature radii (or None)quality
: [V,]-shaped numpy array of per-vertex quality measures (or None)flags
: [V,]-shaped numpy array of 32-bit integer flags per vertex (or None)
load(self, filename, dtype=<class 'numpy.float64'>)
Load a mesh into this class from a file. The type of file is determined by the extension. Point Cloud Utils currently supports PLY, OBJ, STL, OFF, VRML 2.0, X3D, COLLADA, 3DS.
Parameters: |
|
---|
save(self, filename, dtype=<class 'numpy.float32'>)
Save this mesh to a file. The type of file is determined by the extension. Point Cloud Utils currently supports PLY, OBJ, STL, OFF, VRML 2.0, X3D, COLLADA, 3DS.
Parameters: |
|
---|
point_cloud_utils.chamfer_distance(x, y, return_index=False, p_norm=2, max_points_per_leaf=10)
Compute the chamfer distance between two point clouds x, and y
Parameters: |
|
---|
Returns: |
|
---|
point_cloud_utils._pcu_internal.closest_points_on_mesh: None
point_cloud_utils._mesh_primitives.cone_mesh(radius, height, sides=16, bottom=True)
Generate a triangle mesh for a cone centered at the origin and pointing up the y-axis.
Parameters: |
|
---|
Returns: |
|
---|
point_cloud_utils._pcu_internal.connected_components: None
point_cloud_utils._mesh_primitives.cube_mesh()
Generate a triangle mesh for a unit cube centered at the origin.
Returns: |
|
---|
point_cloud_utils._mesh_primitives.cylinder_mesh(radius, height, sides=16, top=True, bottom=True)
Generate a triangle mesh for a cylinder centered at the origin aligned with the y-axis.
Parameters: |
|
---|
Returns: |
|
---|
point_cloud_utils._pcu_internal.decimate_triangle_mesh: None
point_cloud_utils._pcu_internal.deduplicate_mesh_vertices: None
point_cloud_utils._pcu_internal.deduplicate_point_cloud: None
point_cloud_utils.downsample_point_cloud_on_voxel_grid(voxel_size, points, *args, *, min_bound=None, max_bound=None, min_points_per_voxel=1)
Downsample a point set to conform with a voxel grid by taking the average of points within each voxel.
Parameters: |
|
---|
Returns: |
|
---|
point_cloud_utils._pcu_internal.downsample_point_cloud_poisson_disk: None
point_cloud_utils._sinkhorn.earth_movers_distance(p, q, p_norm=2, eps=0.0001, max_iters=100, stop_thresh=0.001)
Compute the (batched) Sinkhorn correspondences between two dirac delta distributions, U, and V. This implementation is numerically stable with float32.
Parameters: |
|
---|
Returns: |
|
---|
point_cloud_utils._pcu_internal.estimate_mesh_face_normals: None
point_cloud_utils._pcu_internal.estimate_mesh_vertex_normals: None
point_cloud_utils._pointcloud_normals.estimate_point_cloud_normals_ball(points, ball_radius, view_directions=None, drop_angle_threshold=1.5707963267948966, min_pts_per_ball=3, max_pts_per_ball=-1, weight_function='constant', max_points_per_leaf=10, num_threads=-1)
Estimate normals for a point cloud by locally fitting a plane to all points within a radius of each point (possibly weighted by a radial basis function).
This function can optionally consider directions to the sensor for each point to compute neighborhoods of points which are all facing the same direction, and align the final normal directions.
Parameters: |
|
---|
Returns: |
|
---|
See Also: estimate_pointcloud_normals_ball
point_cloud_utils._pointcloud_normals.estimate_point_cloud_normals_knn(points, num_neighbors, view_directions=None, drop_angle_threshold=1.5707963267948966, max_points_per_leaf=10, num_threads=-1)
Estimate normals for a point cloud by locally fitting a plane to the k nearest neighbors of each point.
This function can optionally consider directions to the sensor for each point to compute neighborhoods of points which are all facing the same direction, and align the final normal directions.
Parameters: |
|
---|
Returns: |
|
---|
See Also: estimate_pointcloud_normals_ball
point_cloud_utils._voxels.flood_fill_3d(grid, start_coord, fill_value)
Flood fill a 3D grid starting from_start_coord with fill_value. This will return a copy of grid where the region in the input grid which is connected to start_coord and shares the value of start_coord is set to fill_value.
Parameters: |
|
---|
Returns: |
|
---|
point_cloud_utils.hausdorff_distance(x, y, return_index=False, squared_distances=False, max_points_per_leaf=10)
Compute the Hausdorff distance between x and y
Parameters: |
|
---|
Returns: |
|
---|
point_cloud_utils.interpolate_barycentric_coords(f, fi, bc, attribute)
Interpolate an attribute stored at each vertex of a mesh across the faces of a triangle mesh using barycentric coordinates
Parameters: |
|
---|
Returns: |
|
---|
point_cloud_utils._pcu_internal.k_nearest_neighbors: None
point_cloud_utils._pcu_internal.laplacian_smooth_mesh: None
point_cloud_utils._pcu_internal.lloyd_2d: None
point_cloud_utils._pcu_internal.lloyd_3d: None
point_cloud_utils._mesh_io.load_mesh_v(filename, dtype=<class 'float'>)
Load a point cloud consisting only of vertex positions. Point Cloud Utils currently supports PLY, OBJ, STL, OFF, VRML 2.0, X3D, COLLADA, 3DS.
Parameters: |
|
---|
Returns: |
|
---|
point_cloud_utils._mesh_io.load_mesh_vc(filename, dtype=<class 'float'>)
Load a point cloud consisting of vertex positions, and vertex colors. Point Cloud Utils currently supports PLY, OBJ, STL, OFF, VRML 2.0, X3D, COLLADA, 3DS.
Parameters: |
|
---|
Returns: |
|
---|
point_cloud_utils._mesh_io.load_mesh_vf(filename, dtype=<class 'float'>)
Load a triangle mesh consisting of vertex positions and face indices. Point Cloud Utils currently supports PLY, OBJ, STL, OFF, VRML 2.0, X3D, COLLADA, 3DS.
Parameters: |
|
---|
Returns: |
|
---|
point_cloud_utils._mesh_io.load_mesh_vfc(filename, dtype=<class 'float'>)
Load a triangle mesh consisting of vertex positions, face indices, and vertex colors. Point Cloud Utils currently supports PLY, OBJ, STL, OFF, VRML 2.0, X3D, COLLADA, 3DS.
Parameters: |
|
---|
Returns: |
|
---|
point_cloud_utils._mesh_io.load_mesh_vfn(filename, dtype=<class 'float'>)
Load a triangle mesh consisting of vertex positions, face indices, and vertex normals. Point Cloud Utils currently supports PLY, OBJ, STL, OFF, VRML 2.0, X3D, COLLADA, 3DS.
Parameters: |
|
---|
Returns: |
|
---|
point_cloud_utils._mesh_io.load_mesh_vfnc(filename, dtype=<class 'float'>)
Load a triangle mesh consisting of vertex positions, face indices, vertex normals, and vertex colors. Point Cloud Utils currently supports PLY, OBJ, STL, OFF, VRML 2.0, X3D, COLLADA, 3DS.
Parameters: |
|
---|
Returns: |
|
---|
point_cloud_utils._mesh_io.load_mesh_vn(filename, dtype=<class 'float'>)
Load a point cloud consisting of vertex positions, and vertex normals. Point Cloud Utils currently supports PLY, OBJ, STL, OFF, VRML 2.0, X3D, COLLADA, 3DS.
Parameters: |
|
---|
Returns: |
|
---|
point_cloud_utils._mesh_io.load_mesh_vnc(filename, dtype=<class 'float'>)
Load a point cloud consisting of vertex positions, vertex normals, and vertex colors. Point Cloud Utils currently supports PLY, OBJ, STL, OFF, VRML 2.0, X3D, COLLADA, 3DS.
Parameters: |
|
---|
Returns: |
|
---|
point_cloud_utils._mesh_io.load_triangle_mesh(filename, dtype=<class 'numpy.float64'>)
Load a triangle mesh into a TriangleMesh
class.
Point Cloud Utils currently supports PLY, OBJ, STL, OFF, VRML 2.0, X3D, COLLADA, 3DS.
Parameters: |
|
---|
Returns: |
|
---|
point_cloud_utils._pcu_internal.make_mesh_watertight: None
point_cloud_utils._pcu_internal.marching_cubes_sparse_voxel_grid: None
point_cloud_utils._pcu_internal.mesh_face_areas: None
point_cloud_utils._pcu_internal.morton_add: None
point_cloud_utils._pcu_internal.morton_decode: None
point_cloud_utils._pcu_internal.morton_encode: None
point_cloud_utils._pcu_internal.morton_knn: None
point_cloud_utils._pcu_internal.morton_subtract: None
point_cloud_utils._pcu_internal.one_sided_hausdorff_distance: None
point_cloud_utils._pcu_internal.orient_mesh_faces: None
point_cloud_utils._sinkhorn.pairwise_distances(a, b, p=None)
Compute the (batched) pairwise distance matrix between a and b which both have size [m, n, d] or [n, d]. The result is a tensor of size [m, n, n] (or [n, n]) whose entry [m, i, j] contains the distance_tensor between a[m, i, :] and b[m, j, :].
Parameters: |
|
---|
Returns: |
|
---|
point_cloud_utils._pcu_internal.point_cloud_fast_winding_number: None
point_cloud_utils._point_cloud_geometry.pointcloud_sphere_geometry(p, r, num_stacks, num_slices)
Generate sphere geometry for a point cloud (i.e. one sphere per point)
Parameters: |
|
---|
Returns: |
|
---|
point_cloud_utils._point_cloud_geometry.pointcloud_surfel_geometry(p, n, r=0.1, subdivs=7)
Generate geometry for a point cloud encoded as surfels (i.e. circular patches centered at each point and oriented perpendicularly to each normal)
Parameters: |
|
---|
Returns: |
|
---|
point_cloud_utils._pcu_internal.ray_mesh_intersection: None
point_cloud_utils._ray_point_cloud_intersector.ray_surfel_intersection(p, n, ray_o, ray_d, r=0.1, subdivs=4, ray_near=0.0, ray_far=inf)
Compute intersection between a set of rays and a point cloud converted to surfels (i.e. circular patches oriented with the point normals)
Parameters: |
|
---|
Returns: |
|
---|
point_cloud_utils._pcu_internal.remove_unreferenced_mesh_vertices: None
point_cloud_utils._pcu_internal.sample_mesh_lloyd: None
point_cloud_utils._pcu_internal.sample_mesh_poisson_disk: None
point_cloud_utils._pcu_internal.sample_mesh_random: None
point_cloud_utils._mesh_io.save_mesh_v(filename, v, dtype=<class 'numpy.float32'>)
Save a point cloud consisting only of vertex positions. Point Cloud Utils currently supports PLY, OBJ, STL, OFF, VRML 2.0, X3D, COLLADA, 3DS.
Parameters: |
|
---|
point_cloud_utils._mesh_io.save_mesh_vc(filename, v, c, dtype=<class 'numpy.float32'>)
Save a point cloud consisting of vertex positions and vertex colors. Point Cloud Utils currently supports PLY, OBJ, STL, OFF, VRML 2.0, X3D, COLLADA, 3DS.
Parameters: |
|
---|
point_cloud_utils._mesh_io.save_mesh_vf(filename, v, f, dtype=<class 'numpy.float32'>)
Save a triangle mesh consisting of vertex positions and face indices. Point Cloud Utils currently supports PLY, OBJ, STL, OFF, VRML 2.0, X3D, COLLADA, 3DS.
Parameters: |
|
---|
point_cloud_utils._mesh_io.save_mesh_vfc(filename, v, f, c, dtype=<class 'numpy.float32'>)
Save a triangle mesh consisting of vertex positions, face indices, and vertex colors. Point Cloud Utils currently supports PLY, OBJ, STL, OFF, VRML 2.0, X3D, COLLADA, 3DS.
Parameters: |
|
---|
point_cloud_utils._mesh_io.save_mesh_vfn(filename, v, f, n, dtype=<class 'numpy.float32'>)
Save a triangle mesh consisting of vertex positions, face indices, and vertex normals. Point Cloud Utils currently supports PLY, OBJ, STL, OFF, VRML 2.0, X3D, COLLADA, 3DS.
Parameters: |
|
---|
point_cloud_utils._mesh_io.save_mesh_vfnc(filename, v, f, n, c, dtype=<class 'numpy.float32'>)
Save a triangle mesh consisting of vertex positions, face indices, vertex normals, and vertex colors. Point Cloud Utils currently supports PLY, OBJ, STL, OFF, VRML 2.0, X3D, COLLADA, 3DS.
Parameters: |
|
---|
point_cloud_utils._mesh_io.save_mesh_vn(filename, v, n, dtype=<class 'numpy.float32'>)
Save a point cloud consisting of vertex positions and vertex normals. Point Cloud Utils currently supports PLY, OBJ, STL, OFF, VRML 2.0, X3D, COLLADA, 3DS.
Parameters: |
|
---|
point_cloud_utils._mesh_io.save_mesh_vnc(filename, v, n, c, dtype=<class 'numpy.float32'>)
Save a point cloud consisting of vertex positions, vertex normals, and vertex colors. Point Cloud Utils currently supports PLY, OBJ, STL, OFF, VRML 2.0, X3D, COLLADA, 3DS.
Parameters: |
|
---|
point_cloud_utils._mesh_io.save_triangle_mesh(filename, v, f=None, vn=None, vt=None, vc=None, vq=None, vr=None, vti=None, vflags=None, fn=None, fc=None, fq=None, fflags=None, wc=None, wn=None, wt=None, wti=None, textures=[], normal_maps=[], dtype=<class 'numpy.float32'>)
Save a triangle mesh to a file with various per-vertex, per-face, and per-wedge attributes. Each argument (except v) is optional and can be None.
Parameters: |
|
---|
point_cloud_utils._pcu_internal.signed_distance_to_mesh: None
point_cloud_utils._sinkhorn.sinkhorn(a, b, M, eps, max_iters=100, stop_thresh=0.001)
Compute the (batched) Sinkhorn correspondences between two dirac delta distributions, U, and V. This implementation is numerically stable with float32.
Parameters: |
|
---|
Returns: |
|
---|
point_cloud_utils._pcu_internal.sparse_voxel_grid_boundary: None
point_cloud_utils._mesh_primitives.sphere_mesh(subdivisions=3)
Generate a triangle mesh approximating a unit sphere centered at the origin by subdividing an isocahedron.
Parameters: |
|
---|
Returns: |
|
---|
point_cloud_utils._pcu_internal.triangle_soup_fast_winding_number: None
point_cloud_utils._pcu_internal.voronoi_centroids_unit_cube: None
point_cloud_utils._point_cloud_geometry.voxel_grid_geometry(ijk, voxel_size=array([1., 1., 1.]), voxel_origin=array([0., 0., 0.]), gap_fraction=0.0)
Generate a triangle mesh of cubes for voxel coordinates ijk. The [0, 0, 0] voxel has its center at voxel_origin and each voxel has voxel_size.
Parameters: |
|
---|
Returns: |
|
---|
point_cloud_utils._voxels.voxelize_triangle_mesh(v, f, voxel_size, voxel_origin)
Return ijk coordinates of voxels which intersect the given mesh. Each voxel is assumed to have size voxel_size (scalar or triple of floats) and the (0, 0, 0) voxel has its bottom-back-left corner at voxel_origin
Parameters: |
|
---|
Returns: |
|
---|