Skip to content

Instantly share code, notes, and snippets.

@madhephaestus
Last active April 19, 2024 00:49
Show Gist options
  • Save madhephaestus/721302a0ff6d2809b997 to your computer and use it in GitHub Desktop.
Save madhephaestus/721302a0ff6d2809b997 to your computer and use it in GitHub Desktop.
/.settings
/.project
/.classpath
/.cproject
/cache/
/*.class
import eu.mihosoft.vrl.v3d.ext.quickhull3d.*
import eu.mihosoft.vrl.v3d.Vector3d
//Move and rotate opperations
double size =40;
CSG cube = new Cube( size,// X dimention
size,// Y dimention
size// Z dimention
).toCSG()
CSG movedCube = new Sphere(size).toCSG()
.movex(-20)
.movey(-40)
.movez(60)
//This section is how you for a shape of the "shrinkwrap" of the 2 shapes.
CSG hulledCubes = cube.union(movedCube).hull();
//Alternate way to perform a Hull
hulledCubes = CSG.hullAll([cube,movedCube])
//A Now make a triangle
def points = [ new Vector3d(10, 50, 10),
new Vector3d(10, 40, 10),
new Vector3d(-10, 50, 10),
new Vector3d(-10, 40, 10),
new Vector3d(0, 50, 60)
]
CSG hullSection = HullUtil.hull(points)
return [cube,movedCube,hulledCubes.movex(size*2),hullSection]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment