Trying to figure out if a curved path can constitute a portion of a perfect circle
Copy link to clipboard
Copied
Hello community,
I've been trying to use scripting to find out if a user-selected curved path (formed from two anchor points) can be part of a perfect circle, and if so, draw the circle with the appropriate circumference on the artboard.
It's a pretty complex topic that (in my mind) requires some mathematical knowledge to figure out. I've found the following article that does a pretty good job explaining how a circle can be approximated based on a cubic Bezier curve. However, I got stuck pretty early on because I didn't know exactly how to translate the two anchor point path I have on the screen into the four control points that form a cubic Bezier curve. Especially when it comes to referencing such coordinates via scripting.
Hoping that some of your bright minds might want to jump in on the challenge!
Explore related tutorials & articles
Copy link to clipboard
Copied
Haha, excellent @Jacob Bugge you are right of course. I wonder if, in the case of H1 length = H2 length, that the difference between RM and (R1 or R2) could be used to calculate an ellipse? @femkeblanco might know. 🙂
Copy link to clipboard
Copied
It certainly can, Mark, directly by the ratio of RM to R1 (or R2), which are termed a and b in connexion with ellipses,
https://duckduckgo.com/?t=ftsa&q=ellipse&atb=v320-1&ia=web
and the ellipticity is (R1-RM)/R1 or (a-b)/a as the (first) flattening, and then some more.
https://duckduckgo.com/?t=ftsa&q=ellipticity&atb=v320-1&ia=web
Copy link to clipboard
Copied
Hi @Jacob Bugge, I had a bit of a look at the possibility of adjusting the script to detect bezier segments that were part of an ellipse (and the circle being a limit), but it got very hard for my poor maths skill. The problem is that, if you imagine a basic Illustrator-style ellipse of say 100 x 50, and then cut out a section from between two arbitrary points on one of the four bezier segments, then that curve can be different depending on where on the segment it came from. I just couldn't work out how to analyse it.
- Mark
Copy link to clipboard
Copied
Mark,
Without symmetry as in H1 = H2, even with an efficient(ly) customized programme/script, I believe it would be a long wait for the answer, which might be smoke (and maybe fire) filling the room.
Copy link to clipboard
Copied
Yes I suspect you are right, Jacob. Truly the project has now lost much of its appeal. Haha.


-
- 1
- 2