1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-21 05:52:16 +02:00
This commit is contained in:
Justin Lin
2020-02-12 17:55:23 +08:00
parent 5567476120
commit 00c7c10b22
3 changed files with 6 additions and 6 deletions

View File

@@ -2,7 +2,7 @@ use <hull_polyline3d.scad>;
use <rotate_p.scad>; use <rotate_p.scad>;
use <square_maze.scad>; use <square_maze.scad>;
use <matrix/m_rotation.scad>; use <matrix/m_rotation.scad>;
use <experimental/pt_to_sphere.scad>; use <experimental/pt2sphere.scad>;
r = 10; r = 10;
rows = 24; rows = 24;
@@ -26,7 +26,7 @@ module sphere_maze() {
for(wall_pts = walls) { for(wall_pts = walls) {
rxpts = [ rxpts = [
for(p = wall_pts) for(p = wall_pts)
pt_to_sphere(size, mr * [p[0], p[1], 0, 0] + p_offset, r) pt2sphere(size, mr * [p[0], p[1], 0, 0] + p_offset, r)
]; ];
hull_polyline3d(rxpts, wall_thickness, $fn = 6); hull_polyline3d(rxpts, wall_thickness, $fn = 6);
} }

View File

@@ -1,5 +1,5 @@
use <pixel/px_gray.scad>; use <pixel/px_gray.scad>;
use <experimental/pt_to_sphere.scad>; use <experimental/pt2sphere.scad>;
photo_size = [100, 100]; photo_size = [100, 100];
levels = [ levels = [
@@ -110,14 +110,14 @@ dots = px_gray(levels, center = true, normalize = true);
color("white") color("white")
for(dot = dots) { for(dot = dots) {
translate(pt_to_sphere(photo_size, dot[0] + [50, 50], 50, [180, 180])) translate(pt2sphere(photo_size, dot[0] + [50, 50], 50, [180, 180]))
square(dot[1] * 2.5); square(dot[1] * 2.5);
} }
rotate([180, 0, 0]) rotate([180, 0, 0])
color("white") color("white")
for(dot = dots) { for(dot = dots) {
translate(pt_to_sphere(photo_size, dot[0] + [50, 50], 50, [180, 180])) translate(pt2sphere(photo_size, dot[0] + [50, 50], 50, [180, 180]))
square(dot[1] * 2.5); square(dot[1] * 2.5);
} }

View File

@@ -6,7 +6,7 @@ use <rotate_p.scad>;
r: sphere radius. r: sphere radius.
angle: [za, xa] mapping angles. angle: [za, xa] mapping angles.
*/ */
function pt_to_sphere(size, p, r, angle = [180, 360]) = function pt2sphere(size, p, r, angle = [180, 360]) =
let( let(
x = p[0], x = p[0],
y = p[1], y = p[1],