compas_cgal.reconstruction
¤
Functions¤
pointset_normal_estimation
¤
pointset_normal_estimation(
points: list[Point] | FloatNx3, neighbors: int = 8, erase: bool = False
) -> tuple[FloatNx3, FloatNx3]
Remove outliers from a point cloud using the point set outlier removal algorithm.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
points
|
list[Point] | FloatNx3
|
The points of the point cloud. |
required |
neighbors
|
int
|
The number of nearest neighbors to consider for each point. |
8
|
erase
|
bool
|
Erase points that are not oriented properly. |
False
|
Returns:
| Type | Description |
|---|---|
ndarray
|
The vectors of the point cloud. |
pointset_outlier_removal
¤
pointset_outlier_removal(
points: list[Point] | FloatNx3, nnnbrs: int = 10, radius: float = 1.0
) -> FloatNx3
Remove outliers from a point cloud using the point set outlier removal algorithm.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
points
|
list[Point] | FloatNx3
|
The points of the point cloud. |
required |
nnnbrs
|
int
|
The number of nearest neighbors to consider for each point. |
10
|
radius
|
float
|
The radius of the sphere to consider for each point as a multiplication factor of the average point spacing. |
1.0
|
Returns:
| Type | Description |
|---|---|
ndarray
|
The points of the point cloud without outliers. |
pointset_reduction
¤
pointset_smoothing
¤
pointset_smoothing(
points: list[Point] | FloatNx3, neighbors: int = 8, iterations: int = 1
) -> FloatNx3
Remove outliers from a point cloud using the point set outlier removal algorithm.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
points
|
list[Point] | FloatNx3
|
The points of the point cloud. |
required |
neighbors
|
int
|
The number of nearest neighbors to consider for each point. |
8
|
Returns:
| Type | Description |
|---|---|
ndarray
|
The vectors of the point cloud. |
poisson_surface_reconstruction
¤
poisson_surface_reconstruction(
points: list[Point] | FloatNx3,
normals: list[Vector] | FloatNx3,
sm_angle: float = 20.0,
sm_radius: float = 30.0,
sm_distance: float = 0.375,
) -> tuple[FloatNx3, IntNx3]
Reconstruct a surface from a point cloud using the Poisson surface reconstruction algorithm.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
points
|
list[Point] | FloatNx3
|
The points of the point cloud. |
required |
normals
|
list[Vector] | FloatNx3
|
The normals of the point cloud. |
required |
sm_angle
|
float
|
Surface meshing angle bound in degrees. Controls the minimum angle of triangles in the output mesh. Default is 20.0. |
20.0
|
sm_radius
|
float
|
Surface meshing radius bound as a factor of average spacing. Controls the size of triangles relative to the point cloud density. Larger values result in coarser meshes with fewer vertices. Default is 30.0. |
30.0
|
sm_distance
|
float
|
Surface meshing approximation error bound as a factor of average spacing. Controls how closely the mesh approximates the implicit surface. Larger values result in coarser meshes with fewer vertices that may deviate more from the original point cloud. Default is 0.375. |
0.375
|
Returns:
| Type | Description |
|---|---|
tuple[ndarray]
|
The vertices and faces of the reconstructed surface. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If points or normals are not 3D If number of points and normals don't match If less than 3 points are provided If points are not well-distributed for reconstruction |
RuntimeError
|
If the reconstruction algorithm fails |
Notes
The Poisson surface reconstruction algorithm requires: 1. A sufficiently dense point cloud 2. Well-oriented normals 3. Points distributed across a meaningful surface
The surface meshing parameters (sm_angle, sm_radius, sm_distance) control the quality and density of the output mesh. Increasing sm_radius and sm_distance will typically result in fewer mesh vertices, which can help filter out vertices that don't belong to the original point cloud, but may also reduce detail.
Examples:
>>> points = [[0, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1]]
>>> normals = [[0, 0, 1], [0, 0, 1], [0, 0, 1], [0, 0, 1]]
>>> V, F = poisson_surface_reconstruction(points, normals)
>>> # Use larger sm_radius and sm_distance to reduce mesh complexity
>>> V, F = poisson_surface_reconstruction(points, normals, sm_radius=50.0, sm_distance=0.5)