1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-23 23:03:23 +02:00
This commit is contained in:
Justin Lin
2020-02-13 10:47:03 +08:00
parent 1900801cad
commit 57e3facaa9

View File

@@ -3,10 +3,10 @@ use <rotate_p.scad>;
/* /*
size: The size of the rectangle mapping to a sphere. size: The size of the rectangle mapping to a sphere.
point: A point in the rectangle. point: A point in the rectangle.
r: sphere radius. radius: sphere radius.
angle: [za, xa] mapping angles. angle: [za, xa] mapping angles.
*/ */
function tf_sphere(size, point, r, angle = [180, 360]) = function tf_sphere(size, point, radius, angle = [180, 360]) =
let( let(
x = point[0], x = point[0],
y = point[1], y = point[1],
@@ -16,7 +16,7 @@ function tf_sphere(size, point, r, angle = [180, 360]) =
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 = [radius * cos(rza), radius * sin(rza), 0],
rxpt = rotate_p(rzpt, [xa / xlen * x, 0, 0]) rxpt = rotate_p(rzpt, [xa / xlen * x, 0, 0])
) )
rxpt; rxpt;