From 88bf287928ae8f23af86fbf3b5e3bdeaa3d9647e Mon Sep 17 00:00:00 2001 From: Elmom Date: Tue, 15 Feb 2011 07:28:26 +0200 Subject: [PATCH] Made square pyramid actually work --- regular_shapes.scad | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/regular_shapes.scad b/regular_shapes.scad index 0f97169..67fee52 100644 --- a/regular_shapes.scad +++ b/regular_shapes.scad @@ -194,9 +194,13 @@ module triangle_pyramid(radius) 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]]); } -module square_pyramid(width,height,depth) +module square_pyramid(base_x, base_y,height) { - w=width/2; - h=height/2; - 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]]); + w=base_x/2; + h=base_y/2; + 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]]); } + +// Tests: + +test_square_pyramid(){square_pyramid(10, 20, 30);}