algorithmic modeling for Rhino
Hi,
What may cause mesh topologyvertex change order?
Here I duplicate meshes and set their vertices to a new position.
When I output vertex list it is the same as original. I also see mesh faces correctly.
But vertextopolgy is not the same and it shifts from frame to frame. I see all mesh faces correctly too.
Or is it possible to change the vertex typology order of the mesh?
Mesh[] tempMeshes = new Mesh[meshes.Length];
int loop = 0;
for (int k = 0; k < meshes.Length; k++)
{
Mesh tempMesh = meshes[k].DuplicateMesh();
var tp = meshes[k].TopologyVertices;
for (int i = 0; i < tp.Count; i++)
{
int index = tp.TopologyVertexIndex(i);
tempMesh.Vertices.SetVertex(i, PS.GetPosition(loop + index));
}
loop += meshes[k].Vertices.Count;
tempMeshes[k]=tempMesh;
}
DA.SetDataList(0, tempMeshes[0].TopologyVertices);//Order that changes from frame to frame
DA.SetDataList(1, meshes[0].TopologyVertices); //Original order
DA.SetDataList(2, tempMeshes[0].Vertices); //Same order
DA.SetDataList(3, meshes[0].Vertices); //Original order
Tags:
Topological vertices are sorted along X (then Y, then Z). This speeds up the building of the topology, but it does mean you cannot rely on the order of topological vertices to be the same as the regular vertices. You must look at the index mapping on each topological vertex to see which regular vertices are associated with it.
Thanks I did not know that that the order may differ.
By index mapping do you mean:
tempMesh.TopologyVertices.MeshVertexIndices(i)[0]
?
I have attached the mesh that has this issue.
Is it possible to map one mesh to another, so that the topologicalVertex would be the same on both meshes?
I used
var tp = meshes[z].TopologyVertices;
for (int t = 0; t < tp.Count; t++)
{
int tempIndex = tp.MeshVertexIndices(t)[0];
int mappedIndex = originalMesh[z].TopologyVertices.TopologyVertexIndex(tempIndex);
}
It works in my case. It would be nice that there would be no difference between the two.
Give Plankton a go!
I know, I ' ve already seen how clean some of the Kangaroo Goals are written, instead of using mesh typology. I must give it a go.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by