cut_edges
cut_edges(F, E)
Cut a triangle mesh along a specified set of edges.
Given a triangle mesh and a set of edges, this returns a new mesh that has been "cut" along those edges; meaning, such that the two faces incident on that edge are no longer combinatorially connected. This is done by duplicating vertices along the cut edges (see note), and creating a new geometrically identical edge between the duplicated vertices.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
F |
(m,3) numpy int array
|
face index list of a triangle mesh |
required |
E |
(k,2) numpy int array
|
index list of edges to cut, indexing the same array as F. If E contains edges that are not present in F, they will be ignored. |
required |
Returns:
Name | Type | Description |
---|---|---|
G |
(m,3) numpy int array
|
face index list of cut triangle mesh |
I |
(l,) numpy int array
|
list of indices into V of vertices in new mesh such that V[I,:] are the vertices in the new mesh. This takes care of correctly duplicating vertices. |
Notes
Since only vertices that no longer share an edge in common are duplicated, you cannot cut a single interior edge. This function mirrors gptoolbox's cut_edges (https://github.com/alecjacobson/gptoolbox/blob/master/mesh/cut_edges.m)
Examples:
_,F = gpy.read_mesh("mesh.obj")
E = np.array([[0,1], [1,2]])
G,I = gpy.cut_edges(F,G)
W = V[I,:]
# My new mesh is now W,G
Source code in src/gpytoolbox/cut_edges.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
|