For all issues regarding the Forums use, please, refer to the Forum Rules.

### Our Solutions

Need professional assistance?
Consider our:

Need to speed up your development?
Have a look at our:

Need some functionality extending standard OCCT capabilities?
Check out our:

# How to get the points on the boundary of the shape in 2D case

Forums:

is there any method to get the points on the boundary of the shape in 2D case. Because I want use lines to approximate the boundaries.

thank you in advance!

Get the edges of the boundary and then get the curve of the edges.
With the curve, you can get any point you want.

Could you give me some examples? Thank you !

Here is an example in 3D case. 3D case is general.
Suppose that you have already a face that is TopoDS_Face.

double aFirst,aLast,t,x,y,z;
gp_Pnt gp;
TopExp_Explorer expw;
TopExp_Explorer expe;
for(expw.Init(face,TopAbs_WIRE);expw.More(); expw.Next())
{
TopoDS_Wire wire = TopoDS::Wire(expw.Current());
for (expe.Init(expw.Current(), TopAbs_EDGE);expe.More(); expe.Next())
{
TopoDS_Edge edge = TopoDS::Edge(expe.Current());
Handle(Geom_Curve) myCurve=BRep_Tool::Curve(edge,aFirst,aLast);
if(!myCurve.IsNull())
{
//here you can get any point on the curve, for example:
t=(aFirst+aLast)/2.;
myCurve->D0(t,gp);
x=gp.X();
y=gp.Y();
z=gp.Z();
}
}
}

Thank you :)

Another question, Have you used Poly_Polygon2/3D? It looks like can approximating representation of a curve and providing the points that are used to define Polygon.

You are welcome. But I've never used Poly_Polygon2/3D.

### FOLLOW OPEN CASCADE

Youtube

A Capgemini Group Company