functions for plotting arcs in SCAD
array<array<x,y>> arc(x, y, from, to, [radius], [diameter], [$fn], [$fa], [$fs])
x number The center x point of the arc y number The center y point of the arc from number The starting angle of the arc to number The ending angle of the arc radius number (optional) The radius of the arc diameter number (optional) The diameter of the arc $fn number (optional) The number of segments of the arc $fa number (optional) The angle the arc will be segmented by $fs number (optional) The magnitude the arc will be segmented by returns array<array<number, number>> Returns the collection of 2d points for the arc
x
,y
,from
,to
and eitherradius
ordiameter
are required. The default segment setting is$fs=1
.
// Draws a 90 degree pie slice starting at 45 degrees polygon(points = concat( [[0,0]], // center point arc(0,0,45,135,radius=50) ));
// Draws a square with rounded corners size = 20; corner = 5; polygon(points = concat( arc(corner,corner,-90,-180,radius=corner), // lower-left corner arc(size-corner,corner,180,90,radius=corner), // lower-right corner arc(size-corner,size-corner,90,0,radius=corner), // upper-right corner arc(corner,size-corner,0,-90,radius=corner) // upper-left corner ));
// Compares two arcs set to $fn=5 (i.e. 5 "total" segments) polygon(points = concat( [[0,0]], arc(0,0,0,90,20,$fn=5) )); polygon(points = concat( [[30,0]], arc(30,0,0,90,40,$fn=5) ));
// Compares two arcs set to $fa=5 (i.e. segment per 5 degrees) polygon(points = concat( [[0,0]], arc(0,0,0,90,20,$fa=5) )); polygon(points = concat( [[30,0]], arc(30,0,0,90,40,$fa=5) ));
// Compares two arcs set to $fs=5 (i.e. segment per 5mm) polygon(points = concat( [[0,0]], arc(0,0,0,90,20,$fs=5) )); polygon(points = concat( [[30,0]], arc(30,0,0,90,40,$fs=5) ));