mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-10 16:54:23 +02:00
add simple doc
This commit is contained in:
@@ -1,16 +1,22 @@
|
|||||||
use <rotate_p.scad>;
|
use <rotate_p.scad>;
|
||||||
|
|
||||||
function pt_to_sphere(p, size, r, angle = [180, 360]) =
|
/*
|
||||||
|
size: The size of the rectangle mapping to a sphere.
|
||||||
|
p: A point in the rectangle.
|
||||||
|
r: sphere radius.
|
||||||
|
angle: [za, xa] mapping angles.
|
||||||
|
*/
|
||||||
|
function pt_to_sphere(size, p, r, angle = [180, 360]) =
|
||||||
let(
|
let(
|
||||||
x = p[0],
|
x = p[0],
|
||||||
y = p[1],
|
y = p[1],
|
||||||
za = angle[0],
|
za = angle[0],
|
||||||
xa = angle[1],
|
xa = angle[1],
|
||||||
xlen = size[0],
|
xlen = size[0],
|
||||||
ylen = size[1],
|
ylen = size[1],
|
||||||
za_step = za / ylen,
|
za_step = za / ylen,
|
||||||
rza = za_step * y,
|
rza = za_step * y,
|
||||||
rzpt = [r * cos(rza), r * sin(rza), 0],
|
rzpt = [r * cos(rza), r * sin(rza), 0],
|
||||||
rxpt = rotate_p(rzpt, [xa / xlen * x, 0, 0])
|
rxpt = rotate_p(rzpt, [xa / xlen * x, 0, 0])
|
||||||
)
|
)
|
||||||
rxpt;
|
rxpt;
|
Reference in New Issue
Block a user