STEP/STL model traversal vertices question

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()) {

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;


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.


Dmitrii Pasukhin's picture

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.

sunlin0oo's picture

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.

Dmitrii Pasukhin's picture

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.

Aaron Lau's picture

Is there a way to get the real-world coordinates of a TopoDS_Vertex? Or a TopoDS_Edge?

Dmitrii Pasukhin's picture

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.