I use the MergeAllCoplanarFaces command on this mesh. And after that, all the vertices are still in place, though seem like they aren’t actually “functioning” is there a way to clean them out?
Hello- there is not, that I know of.
-Pascal
if that is a planar surface, you can extract it, rebuild it, then retrim it.
I haven’t played with ShrinkWrap that much … maybe it could keep the same mesh geometry and eliminate the extra vertices?
Short of that, you might try Meshlab, I think that has a filter to remove unused vertices.
If that is a mesh, than MergeAllCoplanarFaces simply makes n-gons out of coplanar mesh facets. All an n-gon in Rhino is (as far as I know) is a set of coplanar mesh faces where Rhino just doesn’t show you the internal edges. But the original mesh structure remains in the background and so the control points will still be there.
Geometry:
Valid mesh.
Open double precision polygon mesh: 121 vertices, 100 faces with normals (1 n-gon)
The unused vertices can be removed with a script that:
(1) Goes thru the faces list and collects the vertex indices in a set.
(2) Loops thru the set and build a translation table from old to new vertex index.
(3) Loops thru the faces and replaces old vertex number with new using the translation table
(4) Creates new mesh with renumbered faces and a list of the new vertices.
(5) I suggest putting the new mesh on its own layer for ease of handling.
It is also possible to translate colors, textures, vertex normals and copy over face normals as part of this flow.
Currently the script I have written does not handle n-gons but it could be extended to do that.
Regards,
Terry.
How does Rhino handle this new mesh that is no longer composed of just triangles/quads?
The script would have to be updated to include n-gons in the cleanup.
What I was trying to ask is how do you avoid having the mesh vertices there in Rhino? I was just not sure if Rhino’s data structure for storing meshes can accommodate anything that is not exclusively composed of tringles and/or quads.
The ON_Mesh Class includes the Public Member Function:
int AddNgon (unsigned int Vcount, const unsigned int *ngon_vi, unsigned int Fcount, const unsigned int *ngon_fi)
Description: Add a new ngon to the mesh. Parameters: Vcount - number of vertices and number of sides in the n-gon ngon_vi - in An array of N distinct ON_Mesh.m_V vertex indices Fcount - [in] Number of face that make up the ngon. ngon_fi An array of N distinct ON_Mesh.m_F face indices The outer boundary of this group of faces should be the list of vertices passes as ngon_vi Returns: index of the new n-gon. -1: If input information is not valid.
which I have never used but looks like it will support n-gons.
The mystery to me is what does the mesh do with all those unused vertices? If the mesh is exported as a .obj file and then imported are the extra vertices still there? I would try that and see what happens.
Regards,
Terry.
The n-gons are still made up of individual faces it seems (which is what I expected). So the vertices are also still there. I just don’t think you can have a single mesh face in Rhino that has more than 4 vertices.
I took a mesh with quads, converted it to ngons, extracted one interesting looking face and asked for its properties:
Seems like your conjecture is true. This “face” is actually 5 faces that use 11 vertices.
I exported this 1 “face” and got this for the .obj file:
mtllib A ngon of 5 faces 11 vertices.mtl
usemtl diffuse_0_0_0_255
v -13.3215036 1.92876804 -2.12337708
v -13.3228674 1.92388105 -2.507689
v -13.2515774 1.70118713 -2.507689
v -13.2493982 1.70554304 -2.12337708
v -13.247221 1.70990014 -1.73906493
v -13.3201418 1.93364906 -1.73906493
v -13.3399477 1.98586607 -2.12337708
v -13.3411627 1.98103106 -2.507689
v -13.2450409 1.71425605 -1.35475302
v -13.318779 1.93853009 -1.35475302
v -13.3387346 1.99069905 -1.73906493
f 2 3 4 5 9 10 6 11 7 8
I imported this and got a “face” that looks like the original but the properties say it now has 10 vertices and 8 faces. I exported this and now get the following obj file:
mtllib A ngon 8 face 10 vertices.mtl
usemtl diffuse_0_0_0_255
v -13.3228674 1.92388105 -2.507689
v -13.2515774 1.70118713 -2.507689
v -13.2493982 1.70554304 -2.12337708
v -13.247221 1.70990014 -1.73906493
v -13.3201418 1.93364906 -1.73906493
v -13.3399477 1.98586607 -2.12337708
v -13.3411627 1.98103106 -2.507689
v -13.2450409 1.71425605 -1.35475302
v -13.318779 1.93853009 -1.35475302
v -13.3387346 1.99069905 -1.73906493
f 1 2 3 4 8 9 5 10 6 7
The only difference to the prior is that the 1st vertex in the first file is missing.
I imported this and got the same looking “face” and the properties are now stable at 10 vertices and 8 faces.
This tells us something I am just not sure what. The .obj file makes it seem like there is 1 face with 10 vertices. But the Rhino Properties shows a different story. The .obj file shows 3 vertices on the bottom edge, 3 on the top edge and 3 on the shelf edge. How this leads to the 8 alleged faces I do not know.
An interesting puzzle.
Regards,
Terry,