lejingwang Fri, 10/20/2006 - 02:29 Forums: Other usage issuesis 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 Fri, 10/20/2006 - 13:14 Get the edges of the boundary and then get the curve of the edges. With the curve, you can get any point you want. Log in to post comments lejingwang Sat, 10/21/2006 - 12:56 Could you give me some examples? Thank you ! Log in to post comments LI Sat, 10/21/2006 - 13:09 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(); } } } Log in to post comments lejingwang Sat, 10/21/2006 - 14:45 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. Log in to post comments LI Sat, 10/21/2006 - 22:20 You are welcome. But I've never used Poly_Polygon2/3D. Log in to post comments
Fri, 10/20/2006 - 13:14
Get the edges of the boundary and then get the curve of the edges.
With the curve, you can get any point you want.
Sat, 10/21/2006 - 12:56
Could you give me some examples? Thank you !
Sat, 10/21/2006 - 13:09
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();
}
}
}
Sat, 10/21/2006 - 14:45
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.
Sat, 10/21/2006 - 22:20
You are welcome. But I've never used Poly_Polygon2/3D.