1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-17 22:28:16 +01:00

change body path

This commit is contained in:
Justin Lin 2021-08-03 08:57:25 +08:00
parent 50f87275e0
commit 179701330f

View File

@ -7,6 +7,8 @@ use <hull_polyline3d.scad>;
use <bezier_smooth.scad>;
use <dragon_claw.scad>;
dragon();
function __angy_angz(p1, p2) =
let(
dx = p2[0] - p1[0],
@ -23,11 +25,11 @@ module one_segment(body_r, body_fn, one_scale_data) {
dragon_body_scales(body_r, body_fn, one_scale_data);
// dorsal fin
translate([0, 4, -3])
translate([0, 4, -1])
rotate([-65, 0, 0])
shear(sy = [0, 3])
linear_extrude(2.25, scale = 0.2)
square([2, 12], center = true);
shear(sy = [0, 1.75])
linear_extrude(3, scale = 0.3)
square([1.5, 12], center = true);
// belly
translate([0, -2.5, .8])
@ -39,7 +41,7 @@ module one_segment(body_r, body_fn, one_scale_data) {
module tail() {
$fn = 4;
scale([1,0.85, 1]) union() {
scale([1, 1, 1]) union() {
tail_scales(75, 2.5, 4.25, -4, 1.25);
tail_scales(100, 1.25, 4.5, -7, 1);
tail_scales(110, 1.25, 3, -9, 1);
@ -47,24 +49,61 @@ module tail() {
}
}
module knee_scales(ang, leng, radius, height, thickness) {
module one_scale() {
rotate([0, ang, 0])
shear(sx = [0, -2])
linear_extrude(thickness, center = true)
scale([leng, 1])
circle(1);
}
for(a = [0:60:300]) {
hull() {
rotate(a)
translate([radius, 0, height])
one_scale();
rotate(a + 15)
translate([radius, 0, height + 1.75])
one_scale();
}
}
}
module knee() {
$fn = 4;
scale([1,0.85, 1]) union() {
knee_scales(75, 2.5, 4.25, -4, 1.25);
knee_scales(100, 1.25, 4.5, -7, 1);
knee_scales(110, 1.25, 3, -9, 1);
knee_scales(120, 2.5, 2, -9, 1);
}
}
module foot() {
pts = [[.5, 1, 10], [1.25, 6.25, 11.25], [2, 11.5, 12.5], [2, 16.75, 13.75], [1.9, 20, 14.25]];
pts2 = [[2, 22, 14], [3.5, 21, 10], [4.5, 20.3, 6.5]];
upper_arm_r = 3.6;
lower_arm_r = 2.7;
arm_fn = 6;
scale_fn = 4;
scale_tilt_a = 6;
one_body_scale_data1 = one_body_scale(body_r * 0.6, 6, scale_fn, scale_tilt_a);
one_body_scale_data2 = one_body_scale(body_r * 0.45, 6, scale_fn, scale_tilt_a);
upper_arm_path = [[.5, 1, 10], [1.25, 6.25, 11.25], [2, 11.5, 12.5], [2, 16.75, 13.75], [1.9, 20, 14.25]];
lower_arm_path = [[2, 22, 14], [3.5, 21, 10], [4.5, 20.3, 6.5]];
along_with(pts, scale = 0.75, method = "EULER_ANGLE")
upper_arm_scale_data = one_body_scale(upper_arm_r, arm_fn, scale_fn, scale_tilt_a);
lower_arm_scale_data = one_body_scale(lower_arm_r, arm_fn, scale_fn, scale_tilt_a);
along_with(upper_arm_path, scale = 0.75, method = "EULER_ANGLE")
rotate([-90, 0, 0])
dragon_body_scales(body_r * 0.6, 6, one_body_scale_data1);
along_with(pts2, scale = 0.6, method = "EULER_ANGLE")
dragon_body_scales(upper_arm_r, arm_fn, upper_arm_scale_data);
along_with(lower_arm_path, scale = 0.6, method = "EULER_ANGLE")
rotate([-90, 0, 0])
dragon_body_scales(body_r * 0.5, 6, one_body_scale_data2);
dragon_body_scales(lower_arm_r, arm_fn, lower_arm_scale_data);
translate([2.25, 14.5, 12.75])
scale([0.7, 1.15, .8])
rotate([107, 9, 1])
tail();
rotate([108, 9, 1])
knee();
translate([6, 19.25, 0])
rotate([10, 10, 185])
@ -72,63 +111,61 @@ module foot() {
dragon_claw();
}
x1 = 30;
x2 = 30;
x3 = 0;
x4 = 0;
module dragon() {
body_path = bezier_curve(0.0225, [
[0, 0, 15],
[0, 30, 0],
[-30, 50, -55],
[-50, 70, 0],
[20, 90, 60],
[50, 110, 0],
[0, 120, -30],
[-10, 130, 0],
[-10, 155, 0]
]);
leng_body_path = len(body_path);
t_step = 0.02;
translate([0, -2, 16])
rotate([-115, 0, 0])
scale(1.15)
dragon_head(__angy_angz(body_path[0], body_path[1]));
p0 = [0, 0, 0];
p1 = [0, 50, 35];
p2 = [-50, 70, 0];
p3 = [x1, 90, -15];
p4 = [x2, 150, -20];
p5 = [x3, 160, -3];
p6 = [x4, 180, 10];
body_r = 6;
body_fn = 12;
scale_fn = 4;
scale_tilt_a = 6;
one_body_scale_data = one_body_scale(body_r, body_fn, scale_fn, scale_tilt_a);
path_pts = bezier_curve(t_step,
[p0, p1, p2, p3, p4, p5, p6]
);
along_with(body_path, scale = 0.6, method = "EULER_ANGLE")
one_segment(body_r, body_fn, one_body_scale_data);
scale(1.1)
dragon_head(__angy_angz(path_pts[0], path_pts[1]));
ayz = __angy_angz(body_path[leng_body_path - 2], body_path[leng_body_path - 1]);
body_r = 6;
body_fn = 12;
scale_fn = 4;
scale_tilt_a = 6;
one_body_scale_data = one_body_scale(body_r, body_fn, scale_fn, scale_tilt_a);
translate(body_path[leng_body_path - 1])
rotate([0, ayz[0] + 90, ayz[1]])
mirror([0, 0, 1])
rotate(-12)
scale(0.775)
tail();
along_with(path_pts, scale = 0.6, method = "EULER_ANGLE")
one_segment(body_r, body_fn, one_body_scale_data);
translate([-5, 25, -14])
rotate([-20, 0, -15])
foot();
ayz = __angy_angz(path_pts[len(path_pts) - 2], path_pts[len(path_pts) - 1]);
translate([-12, 15, -8])
rotate([-60, 45, 25])
mirror([1, 0, 0])
foot();
translate(path_pts[len(path_pts) - 1])
rotate([0, ayz[0] + 25, ayz[1]])
mirror([0, 0, 1])
rotate(-12)
scale(0.775)
tail();
translate([13, 110, -5])
rotate([-10, 20, -50])
scale(0.75)
foot();
translate([-2, 30, 3])
rotate(-15)
foot();
translate([-7.5, 20, 10])
rotate([-60, 45, 25])
mirror([1, 0, 0])
foot();
translate([9, 120, -17])
rotate([10, 20, -60])
scale(0.8)
foot();
translate([9, 125, -14])
rotate([20, 20, 30])
rotate([10, -60, 0])
scale(0.8)
mirror([1, 0, 0])
foot();
translate([7, 108, -2])
rotate([5, 20, 60])
rotate([10, -30, 0])
scale(0.75)
mirror([1, 0, 0])
foot();
}