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

19 lines
450 B
OpenSCAD
Raw Normal View History

2020-03-26 17:33:35 +08:00
/**
* 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
*
**/
2020-03-24 17:45:30 +08:00
function ptf_circle(size, point) =
2020-03-11 09:48:34 +08:00
let(
2020-03-24 17:45:30 +08:00
p_offset = -size / 2,
p = [point[0] + p_offset[1], point[1] + p_offset[0]],
2020-03-11 09:48:34 +08:00
n = max(abs(p[0]), abs(p[1])),
r = n * 1.414,
a = atan2(p[0], p[1])
)
[r * cos(a), r * sin(a)];