Merge pull request #21 from ether42/master

Fix non isosceles triangle case for right_triangle with ORIENT_Z
This commit is contained in:
Revar Desmera 2019-05-18 16:50:33 -07:00 committed by GitHub
commit 339ef3fbd8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -343,29 +343,23 @@ module right_triangle(size=[1, 1, 1], orient=ORIENT_Y, anchor=ALLNEG, center=und
if (orient == ORIENT_X) {
ang = atan2(size.y, size.z);
masksize = [size.x, size.y, norm([size.y,size.z])] + [1,1,1];
xrot(ang) {
difference() {
xrot(-ang) cube(size, center=true);
back(masksize.y/2) cube(masksize, center=true);
}
difference() {
cube(size, center=true);
xrot(ang) back(masksize.y/2) cube(masksize, center=true);
}
} else if (orient == ORIENT_Y) {
ang = atan2(size.x, size.z);
masksize = [size.x, size.y, norm([size.x,size.z])] + [1,1,1];
yrot(-ang) {
difference() {
yrot(ang) cube(size, center=true);
right(masksize.x/2) cube(masksize, center=true);
}
difference() {
cube(size, center=true);
yrot(-ang) right(masksize.x/2) cube(masksize, center=true);
}
} else if (orient == ORIENT_Z) {
ang = atan2(size.x, size.y);
masksize = [norm([size.x,size.y]), size.y, size.z] + [1,1,1];
zrot(-ang) {
difference() {
zrot(ang) cube(size, center=true);
back(masksize.y/2) cube(masksize, center=true);
}
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();