/ src / shape_circle.scad
shape_circle.scad
 1  /**
 2  * shape_circle.scad
 3  *
 4  * @copyright Justin Lin, 2020
 5  * @license https://opensource.org/licenses/lgpl-3.0.html
 6  *
 7  * @see https://openhome.cc/eGossip/OpenSCAD/lib3x-shape_circle.html
 8  *
 9  **/
10  
11  use <__comm__/__frags.scad>
12  
13  function shape_circle(radius, n) =
14      let(
15          _frags = __frags(radius),
16          step_a = 360 / _frags,
17          to = (is_undef(n) || n > _frags) ? _frags - 1: n - 1
18      )
19      [
20          for(a = [each [0:to]] * step_a) 
21          [radius * cos(a), radius * sin(a)]
22      ];