mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-04 03:09:45 +00:00
Re-implemented right_triangle()
This commit is contained in:
parent
bb10d40dc7
commit
d281978cfb
1 changed files with 4 additions and 22 deletions
26
shapes.scad
26
shapes.scad
|
@ -339,28 +339,10 @@ module rounded_prismoid(
|
||||||
module right_triangle(size=[1, 1, 1], anchor=ALLNEG, spin=0, orient=UP, center=undef)
|
module right_triangle(size=[1, 1, 1], anchor=ALLNEG, spin=0, orient=UP, center=undef)
|
||||||
{
|
{
|
||||||
size = scalar_vec3(size);
|
size = scalar_vec3(size);
|
||||||
orient_and_anchor(size, orient, anchor, spin=spin, center=center, chain=true) {
|
orient_and_anchor(size, orient, anchor, spin=spin, center=center, noncentered=ALLNEG, chain=true) {
|
||||||
if (orient == RIGHT) {
|
xrot(90)
|
||||||
ang = atan2(size.y, size.z);
|
linear_extrude(height=size.y, convexity=2, center=true) {
|
||||||
masksize = [size.x, size.y, norm([size.y,size.z])] + [1,1,1];
|
polygon([[-size.x/2,-size.z/2], [-size.x/2,size.z/2], [size.x/2,-size.z/2]]);
|
||||||
difference() {
|
|
||||||
cube(size, center=true);
|
|
||||||
xrot(ang) back(masksize.y/2) cube(masksize, center=true);
|
|
||||||
}
|
|
||||||
} else if (orient == BACK) {
|
|
||||||
ang = atan2(size.x, size.z);
|
|
||||||
masksize = [size.x, size.y, norm([size.x,size.z])] + [1,1,1];
|
|
||||||
difference() {
|
|
||||||
cube(size, center=true);
|
|
||||||
yrot(-ang) right(masksize.x/2) cube(masksize, center=true);
|
|
||||||
}
|
|
||||||
} else if (orient == UP) {
|
|
||||||
ang = atan2(size.x, size.y);
|
|
||||||
masksize = [size.y, norm([size.x,size.y]), size.z] + [1,1,1];
|
|
||||||
difference() {
|
|
||||||
cube(size, center=true);
|
|
||||||
zrot(ang) right(masksize.x/2) cube(masksize, center=true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
children();
|
children();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue