What are curve parameters? (AutoCAD .net API)

A perusal of the .net Reference Guide reveals these types of functions:

This is a snapshot of the .net API Reference guide.
This is a snapshot of the .net API Reference guide.

 

But as per usual, there is no explanation in the documentation as to what a exactly a parameter is. This is best explained by example. Stay with me here:

  • 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 an 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) and circle. 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() to get the distances d0 and d1 and you should then use getPointAtDist( (d0 + d1) / 2 ).


Comments

2 responses to “What are curve parameters? (AutoCAD .net API)”

Leave a Reply

Your email address will not be published. Required fields are marked *