What are curve parameters? (AutoCAD .net API)

Posted on Posted in 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 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) 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 ).

Leave a Reply

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