compas_cgal.meshing
¤
Functions:¤
trimesh_dual
¤
trimesh_dual(
mesh: VerticesFaces,
length_factor: float = 1.0,
number_of_iterations: int = 10,
angle_radians: float = 0.9,
scale_factor: float = 1.0,
fixed_vertices: list[int] = [],
) -> tuple[ndarray, list[list[int]]]
Create a dual mesh from a triangular mesh with variable-length faces.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mesh
|
VerticesFaces
|
The mesh to create a dual from. |
required |
angle_radians
|
float
|
Angle limit in radians for boundary vertices to remove. |
0.9
|
length_factor
|
float
|
Length factor for remeshing. |
1.0
|
number_of_iterations
|
int
|
Number of remeshing iterations. |
10
|
scale_factor
|
float
|
Scale factor for inner vertices. |
1.0
|
fixed_vertices
|
list[int]
|
List of vertex indices to keep fixed during remeshing. |
[]
|
Returns:
| Type | Description |
|---|---|
tuple
|
A tuple containing:
|
Notes
This dual mesh implementation includes proper boundary handling by: 1. Creating vertices at face centroids of the primal mesh 2. Creating additional vertices at boundary edge midpoints 3. Creating proper connections for boundary edges
trimesh_remesh
¤
trimesh_remesh(
mesh: VerticesFaces,
target_edge_length: float,
number_of_iterations: int = 10,
do_project: bool = True,
protect_boundary: bool = False,
protect_sharp_edges_angle_deg: float = 0.0,
keep_points=None,
) -> VerticesFacesNumpy
Remeshing of a triangle mesh.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mesh
|
VerticesFaces
|
The mesh to remesh. |
required |
target_edge_length
|
float
|
The target edge length. |
required |
number_of_iterations
|
int
|
Number of remeshing iterations. |
10
|
do_project
|
bool
|
If True, reproject vertices onto the input surface when they are created or displaced. |
True
|
protect_boundary
|
bool
|
If True, constrain all boundary edges so they are NOT split, collapsed, or flipped during remeshing. Use this to preserve the input mesh's boundary curve verbatim — including sharp corners that the default smoothing pass would otherwise round. |
False
|
protect_sharp_edges_angle_deg
|
float
|
Dihedral threshold in degrees for interior feature detection. Edges
whose adjacent faces form a dihedral angle ≥ this value are marked
constrained and preserved. |
0.0
|
keep_points
|
array - like
|
An Nx3 array of points. The mesh vertex coincident with each point
(matched by coordinate, within tolerance) is pinned: it is neither
moved nor removed during remeshing, while the edges between such
points are still re-sampled. Use this to keep only specific vertices
— e.g. the four corners of an open patch — rather than the whole
boundary. |
None
|
Returns:
| Type | Description |
|---|---|
VerticesFacesNumpy
|
|
Notes
Without protect_boundary or protect_sharp_edges_angle_deg set,
boundary edges follow CGAL's default remeshing behaviour: re-sampled
to target_edge_length (visible corner rounding is the cost).
Examples: