mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-15 11:14:17 +02:00
refactor/format
This commit is contained in:
@@ -17,7 +17,6 @@ module bauer_text_sphere(radius, font_name, font_size, txt_extrude, txt_scale, b
|
|||||||
pts = bauer_spiral(n, radius);
|
pts = bauer_spiral(n, radius);
|
||||||
|
|
||||||
if(ball) {
|
if(ball) {
|
||||||
render()
|
|
||||||
sphere(radius * 0.9);
|
sphere(radius * 0.9);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@@ -25,10 +24,10 @@ module bauer_text_sphere(radius, font_name, font_size, txt_extrude, txt_scale, b
|
|||||||
Bauer R. Distribution of points on a sphere with application to star catalogs. Journal of Guidance, Control, and Dynamics. 2000;23(1):130–137
|
Bauer R. Distribution of points on a sphere with application to star catalogs. Journal of Guidance, Control, and Dynamics. 2000;23(1):130–137
|
||||||
*/
|
*/
|
||||||
for(i = [0:n - 1]) {
|
for(i = [0:n - 1]) {
|
||||||
x = pts[i][0];
|
x = pts[i].x;
|
||||||
y = pts[i][1];
|
y = pts[i].y;
|
||||||
z = pts[i][2];
|
z = pts[i].z;
|
||||||
ya = atan2(z, sqrt(x * x + y * y));
|
ya = atan2(z, norm([x, y]));
|
||||||
za = atan2(y, x);
|
za = atan2(y, x);
|
||||||
|
|
||||||
render()
|
render()
|
||||||
|
@@ -10,7 +10,7 @@ module heart(radius, center = false) {
|
|||||||
|
|
||||||
module heart_sub_component() {
|
module heart_sub_component() {
|
||||||
translate([-radius * cos(rotated_angle), 0, 0])
|
translate([-radius * cos(rotated_angle), 0, 0])
|
||||||
rotate(-rotated_angle) union() {
|
rotate(-rotated_angle) {
|
||||||
circle(radius);
|
circle(radius);
|
||||||
translate([0, -radius, 0])
|
translate([0, -radius, 0])
|
||||||
square(diameter);
|
square(diameter);
|
||||||
|
@@ -20,7 +20,7 @@ module nautilus_shell(chambered_section_max_angle, steps, thickness) {
|
|||||||
];
|
];
|
||||||
|
|
||||||
half_thickness = thickness / 2;
|
half_thickness = thickness / 2;
|
||||||
render() {
|
|
||||||
polyline_join(spiral)
|
polyline_join(spiral)
|
||||||
circle(half_thickness);
|
circle(half_thickness);
|
||||||
|
|
||||||
@@ -34,8 +34,6 @@ module nautilus_shell(chambered_section_max_angle, steps, thickness) {
|
|||||||
polyline_join(bezier_curve(0.1, [p1, p2, p3]))
|
polyline_join(bezier_curve(0.1, [p1, p2, p3]))
|
||||||
circle(half_thickness);
|
circle(half_thickness);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ellipse_extrude(semi_minor_axis, height = height, slices = slices)
|
ellipse_extrude(semi_minor_axis, height = height, slices = slices)
|
||||||
|
@@ -58,14 +58,8 @@ module seashell() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
points = [
|
points = [
|
||||||
for(s = [s_s:s_step:s_e])
|
for(s = [s_s:s_step:s_e], theta = [theta_s:theta_step:theta_e])
|
||||||
for(theta = [theta_s:theta_step:theta_e])
|
[x(theta, s), y(theta, s), z(theta, s)]
|
||||||
let(
|
|
||||||
x = x(theta, s),
|
|
||||||
y = y(theta, s),
|
|
||||||
z = z(theta, s)
|
|
||||||
)
|
|
||||||
[x, y, z]
|
|
||||||
];
|
];
|
||||||
|
|
||||||
slen = floor((s_e - s_s) / s_step);
|
slen = floor((s_e - s_s) / s_step);
|
||||||
@@ -73,15 +67,12 @@ module seashell() {
|
|||||||
|
|
||||||
c = thetalen + 1;
|
c = thetalen + 1;
|
||||||
triangles = [
|
triangles = [
|
||||||
for(s = [0:slen - 1])
|
for(s = [0:slen - 1], theta = [0:thetalen - 1])
|
||||||
for(theta = [0:thetalen - 1])
|
|
||||||
each [
|
each [
|
||||||
[theta + s * c, theta + 1 + s * c, theta + (s + 1) * c],
|
[theta + s * c, theta + 1 + s * c, theta + (s + 1) * c],
|
||||||
[theta + 1 + s * c, theta + 1 + (s + 1) * c, theta + (s + 1) * c]
|
[theta + 1 + s * c, theta + 1 + (s + 1) * c, theta + (s + 1) * c]
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
sf_thickenT(points, thickness, triangles);
|
sf_thickenT(points, thickness, triangles);
|
||||||
}
|
}
|
||||||
|
@@ -39,8 +39,7 @@ module spiral_city(num_of_buildings, seed_value) {
|
|||||||
ra_arc = atan2(mid_pt[1], mid_pt[0]) - (i > leng_pts - 4 ? arc_a / 4.5 : arc_a / 5);
|
ra_arc = atan2(mid_pt[1], mid_pt[0]) - (i > leng_pts - 4 ? arc_a / 4.5 : arc_a / 5);
|
||||||
|
|
||||||
translate(mid_pt)
|
translate(mid_pt)
|
||||||
rotate(ra_arc)
|
rotate(ra_arc) {
|
||||||
union() {
|
|
||||||
difference() {
|
difference() {
|
||||||
union() {
|
union() {
|
||||||
linear_extrude(building_h)
|
linear_extrude(building_h)
|
||||||
@@ -55,7 +54,6 @@ module spiral_city(num_of_buildings, seed_value) {
|
|||||||
cubes(i, arm_distance, building_h, w_size, arc_a, arc_r, seed_value);
|
cubes(i, arm_distance, building_h, w_size, arc_a, arc_r, seed_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
roof(i, arm_distance, building_h, roof_h, arc_a, arc_r);
|
roof(i, arm_distance, building_h, roof_h, arc_a, arc_r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -66,7 +64,7 @@ module spiral_city(num_of_buildings, seed_value) {
|
|||||||
half_a = arc_a / 2;
|
half_a = arc_a / 2;
|
||||||
is_even = i % 2 == 0;
|
is_even = i % 2 == 0;
|
||||||
arc_w = arm_distance / (is_even ? 2.5 : 1.7);
|
arc_w = arm_distance / (is_even ? 2.5 : 1.7);
|
||||||
union() {
|
|
||||||
rs = is_undef(seed_value) ?
|
rs = is_undef(seed_value) ?
|
||||||
rands(-1, 1, 4) :
|
rands(-1, 1, 4) :
|
||||||
rands(-1, 1, 4, seed_value = seed_value + i);
|
rands(-1, 1, 4, seed_value = seed_value + i);
|
||||||
@@ -102,7 +100,6 @@ module spiral_city(num_of_buildings, seed_value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
module roof(i, arm_distance, building_h, roof_h, arc_a, arc_r) {
|
module roof(i, arm_distance, building_h, roof_h, arc_a, arc_r) {
|
||||||
is_even = i % 2 == 0;
|
is_even = i % 2 == 0;
|
||||||
|
@@ -30,9 +30,9 @@ module spiral_math_constants(n, radius, constants, font_name, font_size, txt_ext
|
|||||||
|
|
||||||
module constant_on_spiral(constant, spiral) {
|
module constant_on_spiral(constant, spiral) {
|
||||||
for(i = [0:len(spiral) - 1]) {
|
for(i = [0:len(spiral) - 1]) {
|
||||||
x = spiral[i][0];
|
x = spiral[i].x;
|
||||||
y = spiral[i][1];
|
y = spiral[i].y;
|
||||||
z = spiral[i][2];
|
z = spiral[i].z;
|
||||||
ya = atan2(z, sqrt(x * x + y * y));
|
ya = atan2(z, sqrt(x * x + y * y));
|
||||||
za = atan2(y, x);
|
za = atan2(y, x);
|
||||||
|
|
||||||
|
@@ -48,8 +48,7 @@ module dog_back(head_r, peg_radius) {
|
|||||||
$fn = 36;
|
$fn = 36;
|
||||||
|
|
||||||
module foot() {
|
module foot() {
|
||||||
translate([head_r, 0, 0])
|
translate([head_r, 0, 0]) {
|
||||||
union() {
|
|
||||||
color("PapayaWhip")
|
color("PapayaWhip")
|
||||||
ellipse_extrude(head_r / 3)
|
ellipse_extrude(head_r / 3)
|
||||||
polygon(shape_ellipse([head_r / 3, head_r / 2]));
|
polygon(shape_ellipse([head_r / 3, head_r / 2]));
|
||||||
|
@@ -10,12 +10,8 @@ model = "Tetrahedron"; // [Tetrahedron, Base, Both]
|
|||||||
module string_tetrahedron(leng, diameter, segs_per_side, line_fn) {
|
module string_tetrahedron(leng, diameter, segs_per_side, line_fn) {
|
||||||
module lines_between(side1, side2, diameter, segs) {
|
module lines_between(side1, side2, diameter, segs) {
|
||||||
function pts(p1, p2, segs) =
|
function pts(p1, p2, segs) =
|
||||||
let(
|
let(p = p2 - p1)
|
||||||
p = p2 - p1,
|
[for(i = [0:segs]) p1 + p / segs * i];
|
||||||
dx = p[0] / segs,
|
|
||||||
dy = p[1] / segs,
|
|
||||||
dz = p[2] / segs
|
|
||||||
) [for(i = [0:segs]) p1 + [dx, dy, dz] * i];
|
|
||||||
|
|
||||||
pts1 = pts(side1[0], side1[1], segs);
|
pts1 = pts(side1[0], side1[1], segs);
|
||||||
pts2 = pts(side2[0], side2[1], segs);
|
pts2 = pts(side2[0], side2[1], segs);
|
||||||
|
@@ -9,12 +9,7 @@ center = false;
|
|||||||
module string_tetrahedron(leng, diameter, segs_per_side, line_fn) {
|
module string_tetrahedron(leng, diameter, segs_per_side, line_fn) {
|
||||||
module lines_between(side1, side2, diameter, segs) {
|
module lines_between(side1, side2, diameter, segs) {
|
||||||
function pts(p1, p2, segs) =
|
function pts(p1, p2, segs) =
|
||||||
let(
|
let(p = p2 - p1) [for(i = [0:segs]) p1 + p / segs * i];
|
||||||
p = p2 - p1,
|
|
||||||
dx = p[0] / segs,
|
|
||||||
dy = p[1] / segs,
|
|
||||||
dz = p[2] / segs
|
|
||||||
) [for(i = [0:segs]) p1 + [dx, dy, dz] * i];
|
|
||||||
|
|
||||||
pts1 = pts(side1[0], side1[1], segs);
|
pts1 = pts(side1[0], side1[1], segs);
|
||||||
pts2 = pts(side2[0], side2[1], segs);
|
pts2 = pts(side2[0], side2[1], segs);
|
||||||
@@ -95,7 +90,6 @@ module string_tetrahedrons(level, leng, diameter, segs_per_side, center) {
|
|||||||
|
|
||||||
for(i = [0:120:240]) {
|
for(i = [0:120:240]) {
|
||||||
rotate(i)
|
rotate(i)
|
||||||
|
|
||||||
translate([0, -center_y * 2])
|
translate([0, -center_y * 2])
|
||||||
rotate([a, 0, 0])
|
rotate([a, 0, 0])
|
||||||
translate([0, center_y * 2])
|
translate([0, center_y * 2])
|
||||||
|
@@ -9,7 +9,7 @@ linear_extrude(2)
|
|||||||
translate(pts[i])
|
translate(pts[i])
|
||||||
difference() {
|
difference() {
|
||||||
square(7, center = true);
|
square(7, center = true);
|
||||||
render() for(p = vx_ascii(tx[i], center = true)) {
|
for(p = vx_ascii(tx[i], center = true)) {
|
||||||
translate(p) square(.8);
|
translate(p) square(.8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user