// AngelCAD sample: basic_octahedron.as
// Illustrate creation and use of octahedron
solid@ octahedron(double size)
{
// An octahedron is a convex object so it can be defined
// as a polyhedron simply through an array of octahedron vertices
pos3d@[] p =
{
pos3d(0,0,size)
,pos3d(+size,0,0)
,pos3d(0,+size,0)
,pos3d(-size,0,0)
,pos3d(0,-size,0)
,pos3d(0,0,-size)
};
return polyhedron(p);
}
shape@ main_shape()
{
// intersect a cube with the octahedron to create a cube with trimmed corners
double cornerwid = 5;
double wid = 20;
return octahedron(size:wid*sqrt(2)-cornerwid/2) & cube(size:wid,center:true);
}
void main()
{
shape@ obj = main_shape();
obj.write_xcsg(GetInputFullPath(),secant_tolerance:-1.0);
}
Last active
August 7, 2018 11:06
-
-
Save arnholm/c71852301b56b318a83a59c20bb29fe8 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment