Approximate Ellipse from Sketch Lines

Approximate Ellipse from Sketch Lines

Anonymous
Not applicable
567 Views
2 Replies
Message 1 of 3

Approximate Ellipse from Sketch Lines

Anonymous
Not applicable

Hi! I've been using a script to create a series of sketch lines that represent an ellipse-like cross section of a body. Just wondering if there is any easy(ish) way to create an ellipse approximation from a series of lines (or points) like this? The lines all lie on a 2D plane. I've tried writing a basic approximation algorithm myself but it's very rudimentary and inaccurate... I've looked online as well, but the mathematical methods I've found are a bit beyond me. Any help would be appreciated!

0 Likes
568 Views
2 Replies
Replies (2)
Message 2 of 3

ekinsb
Alumni
Alumni

There's nothing in the API that would help with this.  What you're already doing with calculating the ellipse on your own is the only solution I'm aware of.  I haven't done anything like you're doing but just thinking about it now I think the approach I would take is:

 

  1. Get the end points of the lines.
  2. Find the two points that are the furthest away from each other and use those at the major axis.
  3. Find a point on each side of the major axis line that is the furthest from the axis and use those to define the minor axis.

It will depend on what your input data looks like as to how successful this is.  If there are any points that deviate outside of the desired ellipse by much they would mess up this approach. 


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
0 Likes
Message 3 of 3

Anonymous
Not applicable

Thanks for the reply! Funnily enough, the process you described is almost exactly what I currently have implemented 🙂 I guess I'll just have to keep refining it based on the type of data I am using as input... Thanks for the help!

0 Likes