From 7d5e2c3a1d8a8f9b0fbcd6ecf3803467cab4eb16 Mon Sep 17 00:00:00 2001 From: Kevin Boulain Date: Sat, 18 May 2019 23:46:26 +0200 Subject: [PATCH 1/2] Fix right_triangle ORIENT_Z --- shapes.scad | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/shapes.scad b/shapes.scad index 76d3a4c..a3d53ec 100644 --- a/shapes.scad +++ b/shapes.scad @@ -360,11 +360,11 @@ module right_triangle(size=[1, 1, 1], orient=ORIENT_Y, anchor=ALLNEG, center=und } } 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) { + masksize = [size.y, norm([size.x,size.y]), size.z] + [1,1,1]; + zrot(ang) { difference() { - zrot(ang) cube(size, center=true); - back(masksize.y/2) cube(masksize, center=true); + zrot(-ang) cube(size, center=true); + right(masksize.x/2) cube(masksize, center=true); } } } From 886ffcf2a52a24054bc727c2dea0140110698456 Mon Sep 17 00:00:00 2001 From: Kevin Boulain Date: Sat, 18 May 2019 23:48:16 +0200 Subject: [PATCH 2/2] Remove redundant rotations in right_triangle --- shapes.scad | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/shapes.scad b/shapes.scad index a3d53ec..b2ef71a 100644 --- a/shapes.scad +++ b/shapes.scad @@ -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 = [size.y, norm([size.x,size.y]), size.z] + [1,1,1]; - zrot(ang) { - difference() { - zrot(-ang) cube(size, center=true); - right(masksize.x/2) cube(masksize, center=true); - } + difference() { + cube(size, center=true); + zrot(ang) right(masksize.x/2) cube(masksize, center=true); } } children();