// AngelCAD code.
shape@ main_shape()
{
// create cube & sphere in default positions
double d = 100;
solid@ mycub = cube(size:d);
solid@ mysph = sphere(r:d*0.8);
// create intersection between cube and sphere
solid@ xsect = mycub & translate(0,0,d)*mysph;
// get the bounding box of the intersection
boundingbox@ b = xsect.box();
// print the bounding box ranges in x,y and z
cout << "xlow, xhigh = " << b.p1().x() << ' ' << b.p2().x() << endl;
cout << "ylow, yhigh = " << b.p1().y() << ' ' << b.p2().y() << endl;
cout << "zlow, zhigh = " << b.p1().z() << ' ' << b.p2().z() << endl;
// output from the above is
//
// xlow, xhigh = 0 80
// ylow, yhigh = 0 80
// zlow, zhigh = 20 100
return xsect;
}
void main()
{
shape@ obj = main_shape();
obj.write_xcsg(GetInputFullPath(),secant_tolerance:-1.0);
}
Last active
March 28, 2020 12:38
-
-
Save arnholm/e8eacdfb0293e3ddc7cc4705c189ffaf 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