Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
3

Trying to figure out if a curved path can constitute a portion of a perfect circle

Participant ,
Nov 16, 2023 Nov 16, 2023

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!

TOPICS
Scripting
1.5K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Nov 19, 2023 Nov 19, 2023

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. 🙂

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 20, 2023 Nov 20, 2023

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

 

 

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 20, 2023 Nov 20, 2023

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 21, 2023 Nov 21, 2023

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.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 21, 2023 Nov 21, 2023
LATEST

Yes I suspect you are right, Jacob. Truly the project has now lost much of its appeal. Haha.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines