Make VertexList from Face Problem


These days, I make a vertex List(Exactly speaking gp_Pnt List) from Face

So, I try to find the vertex using by TopTools_IndexMapofShape. below is my code

TopExp_Explorer exp;
TopTools_IndexMapofShape MapVertex;

// Extract vertex from vertex and then store the Map
for(exp.Init(aShape, TopAbs_Vertex), exp.More(); exp.Next());

TopoDS_Shape CurrentShape = exp.Current();
TopoDS_Vertex Vertex = TopoDS::Vertex(CurrentShape);

BRep_Tool::MapShapes(Vertex, MapVertex);

// Store the data at Handle(TColgp_HSequenceOfPnt)
Handle(TColgp_HSequenceOfPnt) SequenceOfPoint;
for(int i=1; i {

TopoDS_Shape TempShape = MapVertex.FindKey(i);
TopoDS_Vertex VertexInMap = TopoDS::Vertex(TempShape);
gp_Pnt Point = BRep_Tool::Pnt(VertexInMap);


Of Course, I have no problem getting point on face.
But, My problem is order of point.

i use my code, i get the point which order is free.
this means, for example,

there are Edge which is compose with e1, e2, e3
e1 is consist with p1, p2
e2 is p2, p3.
e3 is p3, p4.

free means that SequenceOfPoint order is p1 p3 p4 p2 .

So, I want to make a point which order is correctly.

Can you help me?

shudolf's picture

extract vertext from face sorry

shudolf's picture

Sorry, I can find it.

Using BRepTools_WireExplorer, I can correctly sort the Sequence data.

TopoDS_Wire W = .... // In my case, I use TopExp_Explorer and extract the Wire.
BRepTools_WireExplorer Ex;
for(Ex.Init(W); Ex.More(); ExNext())

// If you want to extract the current edge, use Current() Method
TopoDS_Edge E = Ex.Current();

// If you want to extract the Vertex belongs to Edge1, Edge2. use CurrentVertex() Method

TopoDS_Vertex V = V.CurrentVertex();


Have a nice day