Last active
August 29, 2015 14:26
-
-
Save madhephaestus/4c3c01da3880be96293c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a cube | |
import eu.mihosoft.vrl.v3d.STL; | |
double size =40; | |
CSG cube = new Cube(size).toCSG() | |
//create a sphere | |
CSG sphere = new Sphere(size/20*12.5).toCSG() | |
//perform a difference | |
// perform union, difference and intersection | |
CSG cubePlusSphere = cube.union(sphere); | |
CSG cubeMinusSphere = cube.difference(sphere); | |
CSG cubeIntersectSphere = cube.intersect(sphere); | |
// translate geometries to prevent overlapping | |
CSG union = cube. | |
union(sphere.transformed(Transform.unity().translateZ(size*1.5))). | |
union(cubePlusSphere.transformed(Transform.unity().translateY(size*3))). | |
union(cubeMinusSphere.transformed(Transform.unity().translateY(size*5))). | |
union(cubeIntersectSphere.transformed(Transform.unity().translateY(size*7))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment