1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-13 10:14:41 +02:00
This commit is contained in:
Justin Lin
2020-02-24 10:10:51 +08:00
parent 3b14f473c8
commit 330d523736
18 changed files with 39 additions and 39 deletions

View File

@@ -1,5 +1,5 @@
use <pixel/px_gray.scad>; use <pixel/px_gray.scad>;
use <experimental/tf_sphere.scad>; use <experimental/ptf_sphere.scad>;
photo_size = [100, 100]; photo_size = [100, 100];
radius = 50; radius = 50;
@@ -110,14 +110,14 @@ dots = px_gray(levels, center = true, normalize = true);
color("white") color("white")
for(dot = dots) { for(dot = dots) {
translate(tf_sphere(photo_size, dot[0] + photo_size / 2, radius, [180, 180])) translate(ptf_sphere(photo_size, dot[0] + photo_size / 2, radius, [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(tf_sphere(photo_size, dot[0] + photo_size / 2, radius, [180, 180])) translate(ptf_sphere(photo_size, dot[0] + photo_size / 2, radius, [180, 180]))
square(dot[1] * 2.5); square(dot[1] * 2.5);
} }

View File

@@ -1,7 +1,7 @@
use <hull_polyline3d.scad>; use <hull_polyline3d.scad>;
use <util/rand.scad>; use <util/rand.scad>;
use <experimental/tri_bisectors.scad>; use <experimental/tri_bisectors.scad>;
use <experimental/tf_bend.scad>; use <experimental/ptf_bend.scad>;
width = 5; width = 5;
columns = 30; columns = 30;
@@ -47,7 +47,7 @@ lines = concat(
); );
for(line = lines) { for(line = lines) {
transformed = [for(pt = line) tf_bend([columns * width, rows * width], pt, radius, angle)]; transformed = [for(pt = line) ptf_bend([columns * width, rows * width], pt, radius, angle)];
hull_polyline3d(transformed, thickness, $fn = 4); hull_polyline3d(transformed, thickness, $fn = 4);
} }

View File

@@ -1,7 +1,7 @@
use <hull_polyline3d.scad>; use <hull_polyline3d.scad>;
use <experimental/mz_blocks.scad>; use <experimental/mz_blocks.scad>;
use <experimental/mz_walls.scad>; use <experimental/mz_walls.scad>;
use <experimental/tf_ring.scad>; use <experimental/ptf_ring.scad>;
rows = 48; rows = 48;
columns = 8; columns = 8;
@@ -24,6 +24,6 @@ walls = mz_walls(blocks, rows, columns, block_width, bottom_border = false);
size = [columns * block_width, rows * block_width]; size = [columns * block_width, rows * block_width];
for(wall_pts = walls) { for(wall_pts = walls) {
transformed = [for(pt = wall_pts) tf_ring(size, pt, radius, 360, angle)]; transformed = [for(pt = wall_pts) ptf_ring(size, pt, radius, 360, angle)];
hull_polyline3d(transformed, wall_thickness); hull_polyline3d(transformed, wall_thickness);
} }

View File

@@ -2,7 +2,7 @@ use <hull_polyline3d.scad>;
use <matrix/m_rotation.scad>; use <matrix/m_rotation.scad>;
use <experimental/mz_blocks.scad>; use <experimental/mz_blocks.scad>;
use <experimental/mz_walls.scad>; use <experimental/mz_walls.scad>;
use <experimental/tf_sphere.scad>; use <experimental/ptf_sphere.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)
tf_sphere(size, mr * [p[0], p[1], 0, 0] + p_offset, r) ptf_sphere(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 <hull_polyline3d.scad>; use <hull_polyline3d.scad>;
use <experimental/tf_torus.scad>; use <experimental/ptf_torus.scad>;
use <experimental/mz_blocks.scad>; use <experimental/mz_blocks.scad>;
use <experimental/mz_walls.scad>; use <experimental/mz_walls.scad>;
@@ -24,7 +24,7 @@ walls = mz_walls(blocks, rows, columns, block_width, left_border = false, bottom
size = [columns * block_width, rows * block_width]; size = [columns * block_width, rows * block_width];
for(wall_pts = walls) { for(wall_pts = walls) {
transformed = [for(pt = wall_pts) tf_torus(size, pt, [radius, radius / 2], twist = twist)]; transformed = [for(pt = wall_pts) ptf_torus(size, pt, [radius, radius / 2], twist = twist)];
hull_polyline3d(transformed, wall_thickness, $fn = 4); hull_polyline3d(transformed, wall_thickness, $fn = 4);
} }

View File

@@ -1,7 +1,7 @@
use <hull_polyline3d.scad>; use <hull_polyline3d.scad>;
use <experimental/mz_blocks.scad>; use <experimental/mz_blocks.scad>;
use <experimental/mz_walls.scad>; use <experimental/mz_walls.scad>;
use <experimental/tf_y_twist.scad>; use <experimental/ptf_y_twist.scad>;
rows = 16; rows = 16;
columns = 8; columns = 8;
@@ -19,6 +19,6 @@ walls = mz_walls(blocks, rows, columns, block_width);
size = [columns * block_width, rows * block_width]; size = [columns * block_width, rows * block_width];
for(wall_pts = walls) { for(wall_pts = walls) {
transformed = [for(pt = wall_pts) tf_y_twist(size, pt, angle)]; transformed = [for(pt = wall_pts) ptf_y_twist(size, pt, angle)];
hull_polyline3d(transformed, wall_thickness); hull_polyline3d(transformed, wall_thickness);
} }

View File

@@ -1,6 +1,6 @@
use <util/rand.scad>; use <util/rand.scad>;
use <hull_polyline3d.scad>; use <hull_polyline3d.scad>;
use <experimental/tf_ring.scad>; use <experimental/ptf_ring.scad>;
size = [20, 100]; size = [20, 100];
line_width = 1; line_width = 1;
@@ -32,7 +32,7 @@ module tiled_line_mobius(size, twist, step, line_width = 1) {
); );
for(line = lines) { for(line = lines) {
pts = [for(p = line) tf_ring(size, p, size[0], twist = twist)]; pts = [for(p = line) ptf_ring(size, p, size[0], twist = twist)];
hull_polyline3d(pts, thickness = line_width); hull_polyline3d(pts, thickness = line_width);
} }
} }

View File

@@ -1,6 +1,6 @@
use <util/rand.scad>; use <util/rand.scad>;
use <hull_polyline3d.scad>; use <hull_polyline3d.scad>;
use <experimental/tf_torus.scad>; use <experimental/ptf_torus.scad>;
size = [20, 50]; size = [20, 50];
line_width = 1; line_width = 1;
@@ -24,7 +24,7 @@ module tiled_line_torus(size, twist, step, line_width = 1) {
); );
for(line = lines) { for(line = lines) {
pts = [for(p = line) tf_torus(size, p, [size[0], size[0] / 2], twist = twist)]; pts = [for(p = line) ptf_torus(size, p, [size[0], size[0] / 2], twist = twist)];
hull_polyline3d(pts, thickness = line_width); hull_polyline3d(pts, thickness = line_width);
} }
} }

View File

@@ -5,7 +5,7 @@
angle: The central angle of the arc. angle: The central angle of the arc.
*/ */
function tf_bend(size, point, radius, angle) = function ptf_bend(size, point, radius, angle) =
let( let(
xlen = size[0], xlen = size[0],
// ignored // ignored

View File

@@ -1,5 +1,5 @@
use <rotate_p.scad>; use <rotate_p.scad>;
use <experimental/tf_y_twist.scad>; use <experimental/ptf_y_twist.scad>;
/* /*
size: The size of a rectangle. size: The size of a rectangle.
@@ -8,10 +8,10 @@ use <experimental/tf_y_twist.scad>;
angle: arc angle. angle: arc angle.
twist: The number of degrees of through which the rectangle is twisted. twist: The number of degrees of through which the rectangle is twisted.
*/ */
function tf_ring(size, point, radius, angle = 360, twist = 0) = function ptf_ring(size, point, radius, angle = 360, twist = 0) =
let( let(
yleng = size[1], yleng = size[1],
a_step = angle / yleng, a_step = angle / yleng,
twisted = tf_y_twist(size, point, twist) twisted = ptf_y_twist(size, point, twist)
) )
rotate_p([radius + twisted[0], 0, twisted[2]], a_step * twisted[1]); rotate_p([radius + twisted[0], 0, twisted[2]], a_step * twisted[1]);

View File

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

View File

@@ -7,7 +7,7 @@ use <rotate_p.scad>;
angle: torus [A, a]. angle: torus [A, a].
twist: The number of degrees of through which the rectangle is twisted. twist: The number of degrees of through which the rectangle is twisted.
*/ */
function tf_torus(size, point, radius, angle = [360, 360], twist = 0) = function ptf_torus(size, point, radius, angle = [360, 360], twist = 0) =
let( let(
xlen = size[0], xlen = size[0],
ylen = size[1], ylen = size[1],

View File

@@ -5,7 +5,7 @@ use <rotate_p.scad>;
point: A point in the rectangle. point: A point in the rectangle.
angle: twisted angle. angle: twisted angle.
*/ */
function tf_x_twist(size, point, angle) = function ptf_x_twist(size, point, angle) =
let( let(
xlen = size[0], xlen = size[0],
ylen = size[1], ylen = size[1],

View File

@@ -5,7 +5,7 @@ use <rotate_p.scad>;
point: A point in the rectangle. point: A point in the rectangle.
angle: twisted angle. angle: twisted angle.
*/ */
function tf_y_twist(size, point, angle) = function ptf_y_twist(size, point, angle) =
let( let(
xlen = size[0], xlen = size[0],
ylen = size[1], ylen = size[1],

View File

@@ -1,6 +1,6 @@
use <experimental/_impl/_sf_square_surfaces.scad>; use <experimental/_impl/_sf_square_surfaces.scad>;
use <experimental/sf_solidify.scad>; use <experimental/sf_solidify.scad>;
use <experimental/tf_bend.scad>; use <experimental/ptf_bend.scad>;
/* /*
levels : A list of numbers (0 ~ 255). levels : A list of numbers (0 ~ 255).
@@ -23,13 +23,13 @@ module sf_bend(levels, radius, thickness, depth, angle = 180, invert = false) {
[ [
for(row = surface[0]) for(row = surface[0])
[ [
for(p = row) tf_bend(size, p, r, angle) for(p = row) ptf_bend(size, p, r, angle)
] ]
], ],
[ [
for(row = surface[1]) for(row = surface[1])
[ [
for(p = row) tf_bend(size, p, radius, angle) for(p = row) ptf_bend(size, p, radius, angle)
] ]
] ]
); );

View File

@@ -1,6 +1,6 @@
use <experimental/_impl/_sf_square_surfaces.scad>; use <experimental/_impl/_sf_square_surfaces.scad>;
use <experimental/sf_solidify.scad>; use <experimental/sf_solidify.scad>;
use <experimental/tf_ring.scad>; use <experimental/ptf_ring.scad>;
/* /*
levels : A list of numbers (0 ~ 255). levels : A list of numbers (0 ~ 255).
@@ -28,14 +28,14 @@ module sf_ring(levels, radius, thickness, depth, angle = 360, twist = 0, invert
for(row = surface[1]) for(row = surface[1])
[ [
for(p = row) for(p = row)
tf_ring(size, p + centered, radius, angle, twist) ptf_ring(size, p + centered, radius, angle, twist)
] ]
], ],
[ [
for(row = surface[0]) for(row = surface[0])
[ [
for(p = row) for(p = row)
tf_ring(size, [p[0], p[1], -p[2]], radius, angle, twist) ptf_ring(size, [p[0], p[1], -p[2]], radius, angle, twist)
] ]
] ]
@@ -46,14 +46,14 @@ module sf_ring(levels, radius, thickness, depth, angle = 360, twist = 0, invert
for(row = surface[0]) for(row = surface[0])
[ [
for(p = row) for(p = row)
tf_ring(size, p - centered, radius, angle, twist) + [0, 0, offset_z] ptf_ring(size, p - centered, radius, angle, twist) + [0, 0, offset_z]
] ]
], ],
[ [
for(row = surface[1]) for(row = surface[1])
[ [
for(p = row) for(p = row)
tf_ring(size, p - centered, radius, angle, twist) ptf_ring(size, p - centered, radius, angle, twist)
] ]
] ]
); );

View File

@@ -1,6 +1,6 @@
use <experimental/_impl/_sf_square_surfaces.scad>; use <experimental/_impl/_sf_square_surfaces.scad>;
use <experimental/sf_solidify.scad>; use <experimental/sf_solidify.scad>;
use <experimental/tf_sphere.scad>; use <experimental/ptf_sphere.scad>;
/* /*
levels : A list of numbers (0 ~ 255). levels : A list of numbers (0 ~ 255).
@@ -23,14 +23,14 @@ module sf_sphere(levels, radius, thickness, depth, angle = [180, 360], invert =
[ [
for(row = surface[0]) for(row = surface[0])
[ [
for(p = row) tf_sphere(size, p, r, angle) for(p = row) ptf_sphere(size, p, r, angle)
] ]
] ]
, ,
[ [
for(row = surface[1]) for(row = surface[1])
[ [
for(p = row) tf_sphere(size, p, radius, angle) for(p = row) ptf_sphere(size, p, radius, angle)
] ]
] ]
); );

View File

@@ -1,6 +1,6 @@
use <experimental/_impl/_sf_square_surfaces.scad>; use <experimental/_impl/_sf_square_surfaces.scad>;
use <experimental/sf_solidify.scad>; use <experimental/sf_solidify.scad>;
use <experimental/tf_torus.scad>; use <experimental/ptf_torus.scad>;
/* /*
levels : A list of numbers (0 ~ 255). levels : A list of numbers (0 ~ 255).
@@ -30,13 +30,13 @@ module sf_torus(levels, radius, thickness, depth, angle = [360, 360], twist = 0,
[ [
for(row = surface[0]) for(row = surface[0])
[ [
for(p = row) tf_torus(size, p, tr1, angle, twist) for(p = row) ptf_torus(size, p, tr1, angle, twist)
] ]
], ],
[ [
for(row = surface[1]) for(row = surface[1])
[ [
for(p = row) tf_torus(size, p, tr2, angle, twist) for(p = row) ptf_torus(size, p, tr2, angle, twist)
] ]
] ]
); );