mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-29 17:30:11 +02:00
support twist
This commit is contained in:
@@ -7,30 +7,53 @@ use <experimental/tf_ring.scad>;
|
|||||||
radius: ring radius.
|
radius: ring radius.
|
||||||
thickness: thickness
|
thickness: thickness
|
||||||
angle: arc angle.
|
angle: arc angle.
|
||||||
|
twist: The number of degrees of through which the rectangle is twisted.
|
||||||
invert: inverts how the gray levels are translated into height values.
|
invert: inverts how the gray levels are translated into height values.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module sf_ring(levels, radius, thickness, angle = 360, invert = false) {
|
module sf_ring(levels, radius, thickness, angle = 360, twist = 0, invert = false) {
|
||||||
surface = _sf_square_surfaces(levels, thickness, invert);
|
surface = _sf_square_surfaces(levels, thickness, invert);
|
||||||
rows = len(levels);
|
rows = len(levels);
|
||||||
columns = len(levels[0]);
|
columns = len(levels[0]);
|
||||||
size = [columns - 1, rows - 1];
|
size = [columns - 1, rows - 1];
|
||||||
|
|
||||||
offset_z = invert ? thickness : 0;
|
offset_z = invert ? thickness : 0;
|
||||||
sf_solidify(
|
centered = invert ? [0, 0, thickness] : [0, 0, thickness / 2];
|
||||||
[
|
if(invert) {
|
||||||
for(row = surface[0])
|
mirror([0, 0, 1])
|
||||||
|
sf_solidify(
|
||||||
|
[
|
||||||
|
for(row = surface[1])
|
||||||
|
[
|
||||||
|
for(p = row)
|
||||||
|
tf_ring(size, p + centered, radius, angle, twist)
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
for(row = surface[0])
|
||||||
|
[
|
||||||
|
for(p = row)
|
||||||
|
tf_ring(size, [p[0], p[1], -p[2]], radius, angle, twist)
|
||||||
|
]
|
||||||
|
]
|
||||||
|
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
sf_solidify(
|
||||||
[
|
[
|
||||||
for(p = row)
|
for(row = surface[0])
|
||||||
tf_ring(size, p, radius, angle, 0) + + [0, 0, offset_z]
|
[
|
||||||
]
|
for(p = row)
|
||||||
],
|
tf_ring(size, p - centered, radius, angle, twist) + [0, 0, offset_z]
|
||||||
[
|
]
|
||||||
for(row = surface[1])
|
],
|
||||||
[
|
[
|
||||||
for(p = row)
|
for(row = surface[1])
|
||||||
tf_ring(size, p, radius, angle, 0)
|
[
|
||||||
|
for(p = row)
|
||||||
|
tf_ring(size, p - centered, radius, angle, twist)
|
||||||
|
]
|
||||||
]
|
]
|
||||||
]
|
);
|
||||||
);
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user