mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-05 06:17:32 +02:00
delegated to rotate_extrude directly
This commit is contained in:
@@ -15,43 +15,49 @@ include <__private__/__frags.scad>;
|
|||||||
include <__private__/__ra_to_xy.scad>;
|
include <__private__/__ra_to_xy.scad>;
|
||||||
|
|
||||||
module ring_extrude(shape_pts, radius, angle = 360, twist = 0, scale = 1.0, triangles = "SOLID") {
|
module ring_extrude(shape_pts, radius, angle = 360, twist = 0, scale = 1.0, triangles = "SOLID") {
|
||||||
|
if(angle == 360 && twist == 0 && scale == 1.0) {
|
||||||
|
rotate_extrude()
|
||||||
|
translate([radius, 0, 0])
|
||||||
|
polygon(shape_pts);
|
||||||
|
} else {
|
||||||
|
a_step = 360 / __frags(radius);
|
||||||
|
|
||||||
a_step = 360 / __frags(radius);
|
angles = __is_vector(angle) ? angle : [0, angle];
|
||||||
|
|
||||||
angles = __is_vector(angle) ? angle : [0, angle];
|
m = floor(angles[0] / a_step) + 1;
|
||||||
|
n = floor(angles[1] / a_step);
|
||||||
|
|
||||||
m = floor(angles[0] / a_step) + 1;
|
leng = radius * cos(a_step / 2);
|
||||||
n = floor(angles[1] / a_step);
|
|
||||||
|
|
||||||
leng = radius * cos(a_step / 2);
|
begin_r =
|
||||||
|
leng / cos((m - 0.5) * a_step - angles[0]);
|
||||||
|
|
||||||
begin_r =
|
end_r =
|
||||||
leng / cos((m - 0.5) * a_step - angles[0]);
|
leng / cos((n + 0.5) * a_step - angles[1]);
|
||||||
|
|
||||||
end_r =
|
angs = concat(
|
||||||
leng / cos((n + 0.5) * a_step - angles[1]);
|
[[90, 0, angles[0]]],
|
||||||
|
m > n ? [] : [for(i = [m:n]) [90, 0, a_step * i]]
|
||||||
|
);
|
||||||
|
pts = concat(
|
||||||
|
[__ra_to_xy(begin_r, angles[0])],
|
||||||
|
m > n ? [] : [for(i = [m:n]) __ra_to_xy(radius, a_step * i)]
|
||||||
|
);
|
||||||
|
|
||||||
angs = concat(
|
is_angle_frag_end = angs[len(angs) - 1][2] == angles[1];
|
||||||
[[90, 0, angles[0]]],
|
|
||||||
m > n ? [] : [for(i = [m:n]) [90, 0, a_step * i]]
|
|
||||||
);
|
|
||||||
pts = concat(
|
|
||||||
[__ra_to_xy(begin_r, angles[0])],
|
|
||||||
m > n ? [] : [for(i = [m:n]) __ra_to_xy(radius, a_step * i)]
|
|
||||||
);
|
|
||||||
|
|
||||||
is_angle_frag_end = angs[len(angs) - 1][2] == angles[1];
|
|
||||||
|
|
||||||
all_angles = is_angle_frag_end ?
|
|
||||||
angs :
|
|
||||||
concat(angs, [[90, 0, angles[1]]]);
|
|
||||||
|
|
||||||
all_points = is_angle_frag_end ?
|
all_angles = is_angle_frag_end ?
|
||||||
pts :
|
angs :
|
||||||
concat(pts, [__ra_to_xy(end_r(), angles[1])]);
|
concat(angs, [[90, 0, angles[1]]]);
|
||||||
|
|
||||||
|
all_points = is_angle_frag_end ?
|
||||||
|
pts :
|
||||||
|
concat(pts, [__ra_to_xy(end_r(), angles[1])]);
|
||||||
|
|
||||||
polysections(
|
polysections(
|
||||||
cross_sections(shape_pts, all_points, all_angles, twist, scale),
|
cross_sections(shape_pts, all_points, all_angles, twist, scale),
|
||||||
triangles = triangles
|
triangles = triangles
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Reference in New Issue
Block a user