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

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

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

Samples & Tools

 

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

Adv. Components

Related pages

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

Lejing's picture
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!

LI's picture

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

Lejing's picture

Could you give me some examples? Thank you !

LI's picture

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();
}
}
}

Lejing's picture

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.

LI's picture

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

Contact us

Attention: DO NOT use this form for all kind of request for the removal of your personal data. Please follow this link for such cases.