Evaluating a Point Along a TopoDS_Edge

Hi Everyone,

I'm new to OpenCascade and I'm having a problem getting a 3D point a given distance along a BRep edge (TopoDS_Edge). I am using the following code:

// assumes that 'dist' is between 0.0 and length of edge

BRepAdaptor_Curve adaptorCurve( oc_topoEdge );

Standard_Real begUVal = 0.0;

GCPnts_AbscissaPoint absc( adaptorCurve, dist, begUVal );

if( !absc.IsDone() ) {
return FALSE;
}

double param = absc.Parameter();

Standard_Integer maxdegree = 0; // only compute point, no derivatives

BRepLProp_CLProps cprops( adaptorCurve, param, maxdegree, Precision::Intersection() );

gp_Pnt p = cprops.Value();

In this code, 'oc_topoEdge' is my TopoDS_Edge and 'p' is the 3D point I am trying to get at curvilinear distance 'dist' along the edge. It is, however, not returning the expected point. It happens that the TopoDS_Edge I'm using here is a Geom_Circle bounded by two verticies. I'm assuming that the TopoDS_Edge generated from a circle and two verticies is an arc running counterclockwise about the normal of the circle from the first vertex to the second. Is this true? If not, then that might explain why the point is not coming out as expected. Does anyone else see something I'm missing?

Thanks in advance,
Tom.

Tom_MacAdam's picture

Ok, after further investigation it seems that the BRepLProp_CLProps object is evaluating the point relative to the begin parameter of the original circle (Geom_Circle) that was used to create the TopoDS_Edge. Is it not the case that when you create a TopoDS_Edge by restricting an original curve, the first vertex of that TopoDS_Edge takes on parameter value 0.0?

Tom.