how to use only the OCC mathematical API's in the VC++ 6.0 application

Hi

how to use only the OCC mathematical API's in the VC++ 6.0 application.

Is it possible to use only the mathematical logical stuffs which deals with BSpline , interpolation and method to get the distance between a point and BSpline curve.

If yes , provide me required information regarding the same and it would be so grateful if you could explain with some sample application

rgds
Senthil

himanshun's picture

You can create a b-spline curve with control points, knots and multiplicities vector.
Standard_Integer nPoints = NUMBER_OF_BSPLINE_POINTS;
TColgp_Array1OfPnt bPoints(1,nPoints);
TColStd_Array1OfReal bKnots(1,nPoints);
TColStd_Array1OfInteger bMult(1,nPoints);
for ( unsigned int i = 1; i <= nPoints; i++ )
{
Standard_Real U = startU + (i-1)*(endU - startU)/(nPoints - 1);
gp_Pnt P = brepAdaptorCurve.Value(U);
bPoints.SetValue(i,P);
bKnots.SetValue(i,U);
bMult.SetValue(i,1);
}
bMult.SetValue(1,2);
bMult.SetValue(nPoints,2);
Handle(Geom_BSplineCurve) geomBSplineCurve = new Geom_BSplineCurve( bPoints, bKnots, bMult, 1);

Hope this helps you.

senthilsp's picture

Thanks himanshun for prompt reply,

I have started to study on your code .

Could you please explain the following details
1)About the startU and endU declaration.
2)About brepAdaptorCurve
while compiling , am receiving
"error C2065: 'brepAdaptorCurve' : undeclared identifier"

Please let me know whether you have any sample application matching with my request.
if so let me know ....

rgds
Senthil

himanshun's picture

Hi,

You can create this curve from TopoDS_Edge input.
startU and endU is parameter on curve. Mostly, 0 and 1 respectively.
BRepAdaptor_Curve brepAdaptorCurve( cascadeEdge);

Regards,
Himanshu