1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-29 11:58:39 +01:00

re-design body scales

This commit is contained in:
Justin Lin 2021-08-01 13:10:15 +08:00
parent 3784469c59
commit 5a5ee9cc0c
2 changed files with 71 additions and 35 deletions

View File

@ -0,0 +1,43 @@
use <shape_circle.scad>;
use <polyhedron_hull.scad>;
use <ptf/ptf_rotate.scad>;
use <experimental/convex_hull3.scad>;
function one_body_scale(body_r, body_fn, scale_fn, scale_tilt_a) =
let(
scale_r = PI * body_r / body_fn,
double_scale_r = scale_r * 2,
shape_scale = shape_circle(scale_r, $fn = scale_fn),
scale_pts = concat(
[[0, 0, scale_r / 2 + body_r]],
[
for(p = shape_scale)
ptf_rotate([p[0], p[1] * 2.01, body_r], [scale_tilt_a, 0, 0])
],
[for(p = shape_scale) [p[0], p[1] * 2.01, 0]]
)
)
convex_hull3(scale_pts);
module dragon_body_scales(body_r, body_fn, one_scale_points_faces) {
double_scale_r = PI * body_r / body_fn * 2;
module ring_scales() {
a_step = 360 / body_fn;
for(a = [0:body_fn - 1]) {
rotate([0, a * a_step, 0])
polyhedron(
one_scale_points_faces[0],
one_scale_points_faces[1]
);
}
}
a = 180 / body_fn;
for(y = [0:1]) {
translate([0, y * double_scale_r])
rotate([0, (y % 2) * a])
ring_scales();
}
}

View File

@ -3,18 +3,25 @@ use <shear.scad>;
use <along_with.scad>;
use <util/reverse.scad>;
use <dragon_head.scad>;
use <dragon_body_scales.scad>;
torus_knot_dragon();
module torus_knot_dragon() {
phi_step = 0.05;
phi_step = 0.0525;
body_r = 6;
body_fn = 12;
scale_fn = 8;
scale_tilt_a = 3;
knot = torus_knot(2, 3, phi_step);
d_path = reverse([for(i = [6:len(knot) - 4]) knot[i]]);
one_body_scale_data = one_body_scale(body_r, body_fn, scale_fn, scale_tilt_a);
along_with(d_path, scale = 0.85, method = "EULER_ANGLE")
scale(0.06)
one_segment();
one_segment(body_r, body_fn, one_body_scale_data);
function __angy_angz(p1, p2) =
let(
@ -34,20 +41,20 @@ module torus_knot_dragon() {
t_angy_angz = __angy_angz(d_path[1], d_path[0]);
translate([2.25, 1.5, -.8])
translate([2.17, 1.53, -.775])
rotate([0, t_angy_angz[0], t_angy_angz[1]])
rotate([0, -100, -90])
scale([0.0525, 0.0525, 0.06])
rotate([0, -85, -90])
scale(0.055)
tail();
}
module scales(ang, leng, radius, height, thickness) {
module tail_scales(ang, leng, radius, height, thickness) {
module one_scale() {
rotate([0, ang, 0])
shear(sx = [0, -1.5])
linear_extrude(thickness, center = true)
scale([leng, 1])
circle(1, $fn = 4);
circle(1, $fn = 8);
}
for(a = [0:30:330]) {
@ -63,16 +70,11 @@ module scales(ang, leng, radius, height, thickness) {
}
}
module one_segment() {
module one_segment(body_r, body_fn, one_scale_data) {
// scales
scale([1,0.85,1]) union() {
scales(60, 4, 5, 0, 1.5);
scales(75, 2.5, 5, -4, 1.25);
scales(100, 1.25, 4.5, -7, 1);
// %scales(110, 1.25, 3, -9, 1);
// %scales(120, 2.5, 2, -9, 1);
}
rotate([-90, 0, 0])
dragon_body_scales(body_r, body_fn, one_scale_data);
// dorsal fin
translate([0, 2.5, -3])
rotate([-65, 0, 0])
@ -80,26 +82,17 @@ module one_segment() {
linear_extrude(4, scale = 0.2)
square([2, 10], center = true);
// belly
hull() {
translate([0, -2.5, 1])
rotate([-10, 0, 0])
scale([1.1, 0.8, 1.25])
sphere(5.8, $fn = 8);
translate([0, 0, -1.65])
rotate([-5, 0, 0])
scale([1, 0.8, 1.6])
sphere(5.5, $fn = 8);
}
// belly
translate([0, -2.5, .8])
rotate([-5, 0, 0])
scale([1, 1, 1.4])
sphere(5.8, $fn = 8);
}
module tail() {
scale([1,0.85,1]) union() {
// scales(60, 4, 5, 0, 1.5);
scales(75, 2.5, 5, -4, 1.25);
scales(100, 1.25, 4.5, -7, 1);
scales(110, 1.25, 3, -9, 1);
scales(120, 2.5, 2, -9, 1);
}
tail_scales(75, 2.5, 5, -4, 1.25);
tail_scales(100, 1.25, 4.5, -7, 1);
tail_scales(110, 1.25, 3, -9, 1);
tail_scales(120, 2.5, 2, -9, 1);
}