Skip to content

Instantly share code, notes, and snippets.

@arnholm arnholm/pyramid_round.md
Last active Apr 26, 2019

Embed
What would you like to do?
// AngelCAD code:  pyramid_round.as
pos3d@ p(double x, double y, double z) { return pos3d(x,y,z);}

shape@ main_shape()
{
   // pyramid dimensions
   double x = 50;
   double y = 50;
   double z = 50;
   // radius of rounding sphere
   double r=4;
   
   // triangular pyramid   
   array<pos3d@> pnts = {p(-x+r, -y+r, 0+r),
                         p( x-r, -y+r, 0+r),
                         p( 0  ,  y-r, 0+r),
                         p( 0  ,    0, z-r)
                        };
   solid@ pyramid = polyhedron(pnts);

   // if radius greater than zero, run minkowski
   if(r>0) return minkowski3d(pyramid,sphere(r));
   else    return pyramid;
}

void main()
{
   shape@ obj = main_shape();
   obj.write_xcsg(GetInputFullPath(),secant_tolerance:0.01);
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.