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

Can you create circle with CreatePath expression?

Engaged ,
Jul 05, 2023 Jul 05, 2023

Copy link to clipboard

Copied

Can you create a circle with CreatePath()?

If not, is there another way to create a circle using expression?

 

TOPICS
Expressions , How to

Views

443

Translate

Translate

Report

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 ,
Jul 05, 2023 Jul 05, 2023

Copy link to clipboard

Copied

Something like this should work:

r = 100; // radius
ratio = .5523;
t = r*ratio;
vertices = [[r,0],[0,r],[r,2*r],[2*r,r]];
inTangents = [[t,0],[0,-t],[-t,0],[0,t]];
outTangents = [[-t,0],[0,t],[t,0],[0,-t]];
closed = true;
createPath(vertices,inTangents,outTangents,closed);

Votes

Translate

Translate

Report

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 ,
Jul 05, 2023 Jul 05, 2023

Copy link to clipboard

Copied

This version might be better--it's centered at the anchor point:

r = 100; // radius
ratio = .5523;
t = r*ratio;
vertices = [[0,-r],[r,0],[0,r],[-r,0]];
inTangents = [[-t,0],[0,-t],[t,0],[0,t]];
outTangents = [[t,0],[0,t],[-t,0],[0,-t]];
closed = true;
createPath(vertices,inTangents,outTangents,closed);

Votes

Translate

Translate

Report

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
Explorer ,
Aug 08, 2023 Aug 08, 2023

Copy link to clipboard

Copied

This is great. I clearly didn't pay close attention in my maths classes. But why is the ratio .5523?
Plus it's super fun to link both radius and ratio to sliders and play around with them.

Votes

Translate

Translate

Report

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 ,
Aug 08, 2023 Aug 08, 2023

Copy link to clipboard

Copied

LATEST

I think the actual formula is:

ratio = (Math.SQRT2 - 1)*(4/3);

Votes

Translate

Translate

Report

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