Skip to content

Commit 88bf287

Browse files
committed
Made square pyramid actually work
1 parent 4db6fc8 commit 88bf287

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

regular_shapes.scad

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,13 @@ module triangle_pyramid(radius)
194194
polyhedron(points=[[-a,-o,-o],[a,-o,-o],[0,radius,-o],[0,0,radius]],triangles=[[0,1,2],[1,2,3],[0,1,3],[0,2,3]]);
195195
}
196196

197-
module square_pyramid(width,height,depth)
197+
module square_pyramid(base_x, base_y,height)
198198
{
199-
w=width/2;
200-
h=height/2;
201-
polyhedron(points=[[-w,-h,0],[-w,h,0],[w,h,0],[w,-h,0],[0,0,depth]],triangles=[[0,1,2],[0,1,4],[0,1,3],[0,2,3]]);
199+
w=base_x/2;
200+
h=base_y/2;
201+
polyhedron(points=[[-w,-h,0],[-w,h,0],[w,h,0],[w,-h,0],[0,0,height]],triangles=[[0,3,2,1], [0,1,4], [1,2,4], [2,3,4], [3,0,4]]);
202202
}
203+
204+
// Tests:
205+
206+
test_square_pyramid(){square_pyramid(10, 20, 30);}

0 commit comments

Comments
 (0)