Hello,
I want to extract the pole coordinates from a bspline curve.
In the element information dialog I can see the following:
MSElementUnion header; int type=0, rational=0; BsplineDisplay display; BsplineParam params; DPoint3d *poles=NULL; double *knots=NULL, *weights=NULL; int i; if (mdlBspline_extractCurve (&header, &type, &rational, &display, ¶ms, &poles, &knots, &weights, oEld)==SUCCESS) { for (i=0;i<params.numPoles;i++) { printf("%f %f %f\n", poles[i].x, poles[i].x, poles[i].x); } }Here I get the coordinates:
5407756.4861589409 5661054.0491611995 2147483.64699999995300963.6462771045 5554261.1976117715 2092188.67399999995407755.6605592519 5661053.2462589797 2147483.6469999999
I tried the function mdlBspline_unWeightPoles to get the correct values, but then I get these coordinates
5407756.4861589409 5661054.0491611995 2147483.64699999995441064.1282926546 5701056.1433896348 2147483.64699999995407755.6605592519 5661053.2462589797 2147483.6469999999
What must I do to get the coordinates that are shown in the element information dialog?
Best regards
Martin Roling
6330.bspline.dgn
What does the old "analyze element" dialog show for the B-spline Pole component? The values shown in analyze should match your un-weighted pole values.
* You are printing pole.x 3 times in your printf instead of x, y, z...
-B
Hello Brien,
Thanks for your answer,
The coordinates in the Information Dialog and the Analyse Dialog are the same.
(The DGN with the BSpline Curve is attachted to my first Post)
Martin
Ah, completely missed that a dgn was attached. How are you converting from uors to master units? Your model has a global origin offset...maybe you aren't accounting for that correctly?
I use
mdlCurrTrans_begin (); mdlCurrTrans_masterUnitsIdentity (TRUE); ... reading BSpline coordinates ... mdlCurrTrans_end ();
Martin,
Finally had a chance to look at this. It appears that mdlBspline_extractCurve has a bug. You can get the correct information as follows:
MSBsplineCurve curve;
if (SUCCESS == mdlBspline_convertToCurve (&curve, edP)) { if (curve.rational && curve.weights) mdlBspline_unWeightPoles (curve.poles, curve.poles, curve.weights, curve.params.numPoles);
for (int i=0;i<curve.params.numPoles;i++) printf("%f %f %f\n", curve.poles[i].x, curve.poles[i].y, curve.poles[i].z);
mdlBspline_freeCurve (&curve); }
Answer Verified By: Martin Roling