decimate
decimate(V, F, face_ratio=0.1, num_faces=None, method='shortest_edge')
Reduce the number of faces of a triangle mesh.
From a manifold triangle mesh, builds a new triangle mesh with fewer faces than the original one using libigl's decimation algorithm.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
V |
(n,d) numpy array
|
vertex list of a triangle mesh |
required |
F |
(m,3) numpy int array
|
face index list of a triangle mesh |
required |
face_ratio |
Desired ratio of output faces to input faces |
0.1
|
|
num_faces |
int, optional (default None)
|
Desired number of faces in output mesh (superseeds face_ratio if set) |
None
|
method |
string, optional (default shortest_edge)
|
Which mesh decimation algorithm to use. Options are 'shortest_edge' and 'qslim' |
'shortest_edge'
|
Returns:
Name | Type | Description |
---|---|---|
U |
numpy double array
|
Matrix of mesh vertices |
G |
numpy int array
|
Matrix of triangle indices |
I |
numpy int array
|
Vector of indices into F of the original faces in G |
J |
numpy int array
|
Vector of indices into V of the original vertices in U |
See Also
lazy_cage.
Notes
As described in libigl, this collapses the shortest edges first, placing the new vertex at the edge midpoint, and stops when the desired number of faces is reached or no face can be collapsed without going below the desired number of faces.
Examples:
# Mesh in v,f
u,g,i,j = gpytoolbox.decimate(v,f,num_faces=100)
# New mesh in u,g
Source code in src/gpytoolbox/decimate.py
3 4 5 6 7 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 |
|