Mon, 08/14/2023 - 06:59
Firstly, the rectangular model is used as the standard to explain, and the number of vertices is 8.
Next, I read the model and use the code to traverse the number of vertices of the model:
for (aVertexExp.Init(shape, TopAbs_VERTEX, TopAbs_SHAPE); aVertexExp.More(); aVertexExp.Next()) {
vertexCount++;
}
The number of vertices obtained here is 48;
Finally I use other methods to get vertices:
TopLoc_Location aLocation;
Handle(Poly_Triangulation) myT = BRep_Tool::Triangulation(myFace, aLocation);
TColgp_Array1OfPnt nodes(1, myT->NbNodes());
for (int i = 0; i < nodes.Length(); i++) {
gp_Trsf edgeTransf = aLocation.Transformation();
gp_Pnt aPoint = nodes.Value(i + 1);
// cout << "Point info -> " << aPoint.X() << "," << aPoint.Y() << "," << aPoint.Z() << endl;
gp_Pnt p = aPoint.Transformed(edgeTransf);
// cout << "Point info -> " << aPoint.X() << "," << aPoint.Y() << "," << aPoint.Z() << endl;
// cout << "Point info -> " << p.X() << "," << p.Y() << "," << p.Z() << endl;
this_face.vertex_coord.push_back(p.X());
this_face.vertex_coord.push_back(p.Y());
this_face.vertex_coord.push_back(p.Z());
}
The number of vertices obtained by this method is 24.
Because a vertex will be shared by all three edges, it is three times the number of vertices after meshing.
I can use this method to filter out duplicate vertices and get non-redundant vertices.
However, I can't understand why the first method is 6 times the number of vertices.Hope someone can answer the question.
Looking forward to your reply!
thanks agin.
Sunlin.
Mon, 08/14/2023 - 15:07
Hello. TopoDS_Vertex not related with nodes.
TopoDS_Vertex related to the Edges of the face. Pnts that you extract from mesh just a nodes.
Best regards, Dmitrii.
Tue, 08/15/2023 - 11:11
Thanks for your answer Dmitrii.
Could you explain in detail how TopoDS_Vertex related to the Edges of the face? Or is there any relevant documentation that can be provided?
If I want to obtain the number of vertices of the real model through OCCT, which data should I obtain?
Best regards, Sunlin.
Thu, 08/31/2023 - 12:00
They are not related at all.
TopoDS_Vertex a topology component. It can be free vertex or begin or end of the TopoDS_Edge (topology component).
Poly_Triangulation is a mesh structure. nodes in this structure a vertices is triangle vertices.
Best regards, Dmitrii.
Fri, 09/01/2023 - 21:27
Is there a way to get the real-world coordinates of a TopoDS_Vertex? Or a TopoDS_Edge?
Fri, 09/01/2023 - 21:48
TopoDS_Vertex is just an gp_Pnt. TopoDS_Edge can contains any types of curves.
To extract geometry from topology, you can use:BRep_Tool
Best regards, Dmitrii.