What are curve parameters? (AutoCAD .net API)
A perusal of the .net Reference Guide reveals these types of functions:
But as per usual, there is no explanation accompanying what exactly a parameter is. Thankfully for you, I am here to save the day.
- Suppose you have a curve (i.e. a polyline) that has n points. Or in this case, 10 points.
-
If you called
polyline.GetStartParam()you’d get a value of 0. And if you called:polyline.GetEndParam()you’d get a value of 9. You’ve got 10 points of course, but remember, you’d get a value of 9 because it’s all zero index based. Some Notable Exceptions: - Now you have to remember that Ellipses and Circles are also curves too. If you asked at arc or a circle a question about its parameter, then you are really asking it about the angle around the circle or arc (starting from 0). E.g.
circle.GetPointAtParameter(0)should give you(100,0,0)andcircle. GetPointAtParameter (2π)should give you(100,0,0). - Suppose you want to calculate the halfway distance between vertex 0 and vertex 1 for a polyline? Should you use
polyline.GetPointAtParam(0.5)? The answer is: no! This is because the mapping between parameters and points need not be linear. To be safe you should use:getDistAtParam()got get the distancesd0andd1and you should then usegetPointAtDist( (d0 + d1) / 2 ).
Written on November 20, 2017