Surface Cutting
SurfaceMeshCutter
Given a surface mesh and a set of edges, this utility class will perform cuts along the prescribed edges, disconnecting their two adjacent faces.
Usage
or
Bases: Worker
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mesh
|
SurfaceMesh
|
input mesh |
required |
verbose
|
bool
|
verbose mode. Defaults to False. |
False
|
Attributes:
Name | Type | Description |
---|---|---|
cut_edges |
set
|
indices of edges that were cut |
cut_mesh |
SurfaceMesh
|
a copy of the mesh where specified edges have been cut |
cut_graph
property
The graph formed by all cut edges as a Polyline object
Returns:
Name | Type | Description |
---|---|---|
PolyLine |
PolyLine
|
the cut graph |
cut(edges_to_cut)
Cut the mesh. Alias for SurfaceMeshCutter.run
duplicated_vertices(v)
Given the index v of a vertex in the input mesh, returns the set of all copies of v in the cut mesh.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
v
|
int
|
index of a vertex in the input mesh |
required |
Returns:
Type | Description |
---|---|
set
|
set[int]: all vertex indices corresponding to copies of v in the cut mesh |
ref_vertex(v_cut)
Given the index v_cut
of a vertex in the cut mesh, returns the index of the corresponding vertex in the original mesh.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
v_cut
|
int
|
index of a vertex in the cut mesh. If the index is invalid, returns None |
required |
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
index of the reference vertex in the original mesh |
run(edges_to_cut)
Cut the mesh. Fills the attributes and builds cut_mesh
, which is a copy of the input mesh with corresponding edges disconnected
Parameters:
Name | Type | Description | Default |
---|---|---|---|
edges_to_cut
|
Iterable
|
containers of all the indices of edges to be cut |
required |
SingularityCutter
Given some indices in the mesh, performs cuts on the same so that:
1) every prescribed vertex becomes a boundary vertex
2) the final mesh has disk topology.
This utility class allows to define the discontinuities of a seamless global parametrization and go back and forth between the original mesh and the cut mesh.
Three strategies for computing the cuts are available:
- (A) Simple strategy: no heuristics. Computes a valid seam graph with no geometrical consideration.
- (B) Shortest path strategy: tries to minimize the total length of seams by encouraging cuts to follow shortest paths between singularities.
- (C) Follow features strategy: minimize the number of seam edges that do not belong to the feature graph (i.e. sharp edges) of the model. Requires to first run a FeatureEdgeDetector
on the mesh.
Usage
Bases: SurfaceMeshCutter
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mesh
|
SurfaceMesh
|
input mesh |
required |
singularities
|
list
|
indices of the singular vertices |
required |
strategy
|
str
|
which strategy to use. Choices are ["simple", "short", "feat"] |
'simple'
|
verbose
|
bool
|
verbose mode. Defaults to False. |
False
|
Other Parameters:
Name | Type | Description |
---|---|---|
features |
FeatureEdgeDetector
|
feature edge data structure. If provided, the cuts will follow the feature as much as possible. Defaults to None. |
debug |
bool
|
debug mode. Computes additionnal outputs as mesh attributes. Defaults to False |
Attributes:
Name | Type | Description |
---|---|---|
cut_edges |
set
|
indices of edges that were cut |
cut_mesh |
SurfaceMesh
|
a copy of the mesh where specified edges have been cut |
cut_graph
property
The graph formed by all cut edges as a Polyline object
Returns:
Name | Type | Description |
---|---|---|
PolyLine |
PolyLine
|
the cut graph |
duplicated_vertices(v)
Given the index v of a vertex in the input mesh, returns the set of all copies of v in the cut mesh.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
v
|
int
|
index of a vertex in the input mesh |
required |
Returns:
Type | Description |
---|---|
set
|
set[int]: all vertex indices corresponding to copies of v in the cut mesh |
ref_vertex(v_cut)
Given the index v_cut
of a vertex in the cut mesh, returns the index of the corresponding vertex in the original mesh.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
v_cut
|
int
|
index of a vertex in the cut mesh. If the index is invalid, returns None |
required |
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
index of the reference vertex in the original mesh |
run()
Runs the cutting process