Message 1 of 1
SketchFixedSpline makes rational spline non-rational and discards weights

Not applicable
01-25-2010
08:04 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I've run into a problem using Autodesk Inventor 2010 and its API, especially.
I'm currently trying to convert every "sensible" SketchEntity in a planar sketch into a NURBS curve. This works fine for lines and, of course, B-splines. Circles, ellipses and arcs, however do not seem to fare as well, and I think that's because, seemingly, the BSplineCurve2d or the SketchFixedSpline object ignores the weights I pass into it.
When converting a circle to a NURBS, I went with the "easy to understand" approach of 9 poles placed around a square containing the circle and setting appropiate weights (1.0 for the poles at the middle of the square's edges and sqrt(2)/2 for the corner poles) for a NURBS with an order of 3.
However, when I use these values to create a BSplineCurve2d (using TransientGeometry::CreateBSplineCurve2d) and a SketchFixedSpline from that, the result is not a circle. I was confused, so I created a simple test case, using the same poles around a square, but differing weights for each corner pole, expecting to see different curvatures at each corner. The result, however, is always the same, no matter how I set up the weights of the corner poles.
So, to give an example of my problem, assume I have these poles:
(1,0), (1,1), (0,1), (-1, 1), (-1,0), (-1, -1), (0, -1), (1, -1), (1,0),
i.e. 9 poles placed around a square, start and end pole identical, and this knot vector:
( 0,0,0, Pi/2, Pi/2, Pi, Pi, 3*Pi / 2, 3*Pi / 2, 2*Pi, 2*Pi, 2*Pi )
Now, if I use weights of 1.0 for every pole, the result is identical to using weights like these:
(1.0, 0.7, 1.0, 0.7, 1.0, 0.7, 1.0, 0.7, 1.0)
That shouldn't happen, IMO. The latter case should result in something close to a circle, while the "all weights = 1" case should result in the curve being pulled out towards the corner points.
I've verified that the BSplineCurve2d contains the correct data and that it's rational, using GetBSplineInfo and GetBSplineData, but still the resulting SketchSpline looks the same, no matter what weights I use.
edit:
As stated, the BSplineCurve2d created contains the correct data. However, when I create a SketchFixedSpline out of that BSplineCurve2d using SketchFixedSplines::Add(...), the weights get discarded and the curve is now non-rational. To check that, I checked the BSplineCurve2d^ returned by the SketchFixedSpline object's Geometry property. (using C#)
Is there a way to create a SketchFixedSpline out of a BSplineCurve2d without losing data in the process? Edited by: matches81 on Jan 26, 2010 3:16 PM
I'm currently trying to convert every "sensible" SketchEntity in a planar sketch into a NURBS curve. This works fine for lines and, of course, B-splines. Circles, ellipses and arcs, however do not seem to fare as well, and I think that's because, seemingly, the BSplineCurve2d or the SketchFixedSpline object ignores the weights I pass into it.
When converting a circle to a NURBS, I went with the "easy to understand" approach of 9 poles placed around a square containing the circle and setting appropiate weights (1.0 for the poles at the middle of the square's edges and sqrt(2)/2 for the corner poles) for a NURBS with an order of 3.
However, when I use these values to create a BSplineCurve2d (using TransientGeometry::CreateBSplineCurve2d) and a SketchFixedSpline from that, the result is not a circle. I was confused, so I created a simple test case, using the same poles around a square, but differing weights for each corner pole, expecting to see different curvatures at each corner. The result, however, is always the same, no matter how I set up the weights of the corner poles.
So, to give an example of my problem, assume I have these poles:
(1,0), (1,1), (0,1), (-1, 1), (-1,0), (-1, -1), (0, -1), (1, -1), (1,0),
i.e. 9 poles placed around a square, start and end pole identical, and this knot vector:
( 0,0,0, Pi/2, Pi/2, Pi, Pi, 3*Pi / 2, 3*Pi / 2, 2*Pi, 2*Pi, 2*Pi )
Now, if I use weights of 1.0 for every pole, the result is identical to using weights like these:
(1.0, 0.7, 1.0, 0.7, 1.0, 0.7, 1.0, 0.7, 1.0)
That shouldn't happen, IMO. The latter case should result in something close to a circle, while the "all weights = 1" case should result in the curve being pulled out towards the corner points.
I've verified that the BSplineCurve2d contains the correct data and that it's rational, using GetBSplineInfo and GetBSplineData, but still the resulting SketchSpline looks the same, no matter what weights I use.
edit:
As stated, the BSplineCurve2d created contains the correct data. However, when I create a SketchFixedSpline out of that BSplineCurve2d using SketchFixedSplines::Add(...), the weights get discarded and the curve is now non-rational. To check that, I checked the BSplineCurve2d^ returned by the SketchFixedSpline object's Geometry property. (using C#)
Is there a way to create a SketchFixedSpline out of a BSplineCurve2d without losing data in the process? Edited by: matches81 on Jan 26, 2010 3:16 PM