eu.mihosoft.vrl.v3d.ext.quickhull3d.SimpleExample Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jcsg Show documentation
Show all versions of jcsg Show documentation
Java implementation of BSP based CSG (Constructive Solid Geometry)
package eu.mihosoft.vrl.v3d.ext.quickhull3d;
/**
* Simple example usage of QuickHull3D. Run as the command
*
* java quickhull3d.SimpleExample
*
*/
class SimpleExample
{
/**
* Run for a simple demonstration of QuickHull3D.
*/
public static void main (String[] args)
{
// x y z coordinates of 6 points
Point3d[] points = new Point3d[]
{ new Point3d (0.0, 0.0, 0.0),
new Point3d (1.0, 0.5, 0.0),
new Point3d (2.0, 0.0, 0.0),
new Point3d (0.5, 0.5, 0.5),
new Point3d (0.0, 0.0, 2.0),
new Point3d (0.1, 0.2, 0.3),
new Point3d (0.0, 2.0, 0.0),
};
QuickHull3D hull = new QuickHull3D();
hull.build (points);
System.out.println ("Vertices:");
Point3d[] vertices = hull.getVertices();
for (int i=0; i