Cad Simplification#

volmdlr cad simplification module.

class volmdlr.cad_simplification.AlphaWrapSimplify(volume_model: VolumeModel, name: str = '')[source]#

Bases: Simplify

CAD simplification using CGAL ‘alpha wrap’ method.

simplify(relative_alpha: int = 10, relative_offset: int = 300, preserve_shells: bool = False, equal_alpha: bool = True) VolumeModel[source]#

Simplify the volume model using the CGAL ‘alpha wrap’ method, and return it.

Parameters:
  • relative_alpha (int) – Control the output complexity, by defining the diameter of cavities to be explored relatively to the size of the geometry.

  • relative_offset (int) – Control how close to the input geometry the simplification is.

  • preserve_shells (bool) – Argument to chose if you want to keep the shell structures (same number of shells in the returned volume model), or if you want a volume model with only one shell including the entire input geometry.

  • equal_alpha (bool) – Control if the alpha is relative to the entire volume model bbox (equal for all shells) or relative to each shell bbox. No effect if preserve_shells is False.

Returns:

The simplified volume model.

Return type:

VolumeModel

class volmdlr.cad_simplification.Simplify(volume_model: VolumeModel, name: str = '')[source]#

Bases: DessiaObject

CAD simplification abstract class.

class volmdlr.cad_simplification.TriangleDecimationSimplify(volume_model: VolumeModel, name: str = '')[source]#

Bases: Simplify

CAD simplification based on ‘triangle decimation’ method.

simplify(target_ratio: float, update_rate: int = 5, aggressiveness: float = 7.0, max_iterations: int = 100, verbose: bool = False, lossless: bool = False, threshold_lossless: float = 0.001, alpha: float = 1e-09, k: int = 3, preserve_border: bool = True, preserve_shells: bool = True)[source]#

Simplify the VolumeModel using the ‘triangle decimation’ method, and return it.

To do so, it triangulates each shell of the given volume model and then decimates it at the given target ratio.

Note: threshold = alpha * pow(iteration + k, aggressiveness)

Parameters:
  • target_ratio (float) – Target number of triangles. Not used if lossless is True.

  • update_rate (int) – Number of iterations between each update. If lossless flag is set to True, rate is 1.

  • aggressiveness (float) – Parameter controlling the growth rate of the threshold at each iteration when lossless is False.

  • max_iterations (int) – Maximal number of iterations.

  • verbose (bool) – Control verbosity.

  • lossless (bool) – Use the lossless simplification method.

  • threshold_lossless (float) – Maximal error after which a vertex is not deleted. Only for lossless method.

  • alpha (float) – Parameter for controlling the threshold growth.

  • k (int) – Parameter for controlling the threshold growth.

  • preserve_border (bool) – Flag for preserving vertices on open border.

  • preserve_shells (bool) – Argument to chose if you want to keep the shell structures (same number of shells in the returned volume model), or if you want a volume model with only one shell including the entire input geometry.

Returns:

The decimated VolumeModel.

Return type:

VolumeModel

class volmdlr.cad_simplification.TripleExtrusionSimplify(volume_model: VolumeModel, name: str = '')[source]#

Bases: Simplify

CAD simplification based on ‘triple extrusion’ method.

static extrusion_union_cloud_simplifier(point_cloud3d: PointCloud3D) ExtrudedProfile[source]#

Simplify a point cloud using extrusion and union operations.

Parameters:

point_cloud3d (PointCloud3D) – The 3D point cloud to simplify.

Returns:

The simplified shell.

Return type:

ExtrudedProfile

simplify() VolumeModel[source]#

Simplify the volume model using the ‘triple extrusion’ method, and return it.

Returns:

The simplified volume model.

Return type:

VolumeModel

class volmdlr.cad_simplification.VoxelizationSimplify(volume_model: VolumeModel, name: str = '')[source]#

Bases: Simplify

CAD simplification using ‘voxelization’ method.

simplify(voxel_size: float, fill: bool = True) VolumeModel[source]#

Simplify the volume model using the ‘voxelization’ method, and return it.

Parameters:
  • voxel_size (float) – The size of the voxels used for simplification.

  • fill (bool) – Control the filling of the voxelization, default is True.

Returns:

The simplified volume model.

Return type:

VolumeModel