mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-02-24 09:33:26 +01:00
add experimental/pt_to_sphere
This commit is contained in:
parent
af779562ba
commit
195bf91850
16
src/experimental/pt_to_sphere.scad
Normal file
16
src/experimental/pt_to_sphere.scad
Normal file
@ -0,0 +1,16 @@
|
||||
use <rotate_p.scad>;
|
||||
|
||||
function pt_to_sphere(p, size, r, angle = [180, 360]) =
|
||||
let(
|
||||
x = p[0],
|
||||
y = p[1],
|
||||
za = angle[0],
|
||||
xa = angle[1],
|
||||
xlen = size[0],
|
||||
ylen = size[1],
|
||||
za_step = za / ylen,
|
||||
rza = za_step * y,
|
||||
rzpt = [r * cos(rza), r * sin(rza), 0],
|
||||
rxpt = rotate_p(rzpt, [xa / xlen * x, 0, 0])
|
||||
)
|
||||
rxpt;
|
Loading…
x
Reference in New Issue
Block a user