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

# Can you create circle with CreatePath expression?

Engaged ,
Jul 05, 2023 Jul 05, 2023

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

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
4 Replies 4
Community Expert ,
Jul 05, 2023 Jul 05, 2023

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);``````

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

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);``````

Report

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

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.

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

Copied

LATEST

I think the actual formula is:

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