1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-02-12 03:14:23 +01:00
dotSCAD/src/ptf/ptf_circle.scad
2020-03-26 17:33:35 +08:00

19 lines
450 B
OpenSCAD

/**
* ptf_circle.scad
*
* @copyright Justin Lin, 2020
* @license https://opensource.org/licenses/lgpl-3.0.html
*
* @see https://openhome.cc/eGossip/OpenSCAD/lib2x-ptf_circle.html
*
**/
function ptf_circle(size, point) =
let(
p_offset = -size / 2,
p = [point[0] + p_offset[1], point[1] + p_offset[0]],
n = max(abs(p[0]), abs(p[1])),
r = n * 1.414,
a = atan2(p[0], p[1])
)
[r * cos(a), r * sin(a)];