quickhull3d
Class QuickHull3DTest

java.lang.Object
  extended by quickhull3d.QuickHull3DTest

public class QuickHull3DTest
extends java.lang.Object

Testing class for QuickHull3D. Running the command

   java quickhull3d.QuickHull3DTest
 
will cause QuickHull3D to be tested on a number of randomly choosen input sets, with degenerate points added near the edges and vertics of the convex hull.

The command

   java quickhull3d.QuickHull3DTest -timing
 
will cause timing information to be produced instead.

Author:
John E. Lloyd, Fall 2004

Constructor Summary
QuickHull3DTest()
          Creates a testing object.
 
Method Summary
 void explicitAndRandomTests()
          Runs a set of explicit and random tests on QuickHull3D, and prints Passed to System.out if all is well.
 boolean faceIndicesEqual(int[] indices1, int[] indices2)
          Returns true if two face index sets are equal, modulo a cyclical permuation.
static void main(java.lang.String[] args)
          Runs a set of tests on the QuickHull3D class, and prints Passed if all is well.
 double[] randomCubedPoints(int num, double range, double max)
          Returns the coordinates for num points whose x, y, and z values are each randomly chosen to lie within a specified range, and then clipped to a maximum absolute value.
 double[] randomDegeneratePoints(int num, int dimen)
          Returns the coordinates for num randomly chosen points which are degenerate which respect to the specified dimensionality.
 double[] randomGridPoints(int gridSize, double width)
          Returns randomly shuffled coordinates for points on a three-dimensional grid, with a presecribed width between each point.
 double[] randomPoints(int num, double range)
          Returns the coordinates for num points whose x, y, and z values are randomly chosen within a given range.
 double[] randomSphericalPoints(int num, double radius)
          Returns the coordinates for num points whose x, y, and z values are randomly chosen to lie within a sphere.
 void timingTests()
          Runs timing tests on QuickHull3D, and prints the results to System.out.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QuickHull3DTest

public QuickHull3DTest()
Creates a testing object.

Method Detail

faceIndicesEqual

public boolean faceIndicesEqual(int[] indices1,
                                int[] indices2)
Returns true if two face index sets are equal, modulo a cyclical permuation.

Parameters:
indices1 - index set for first face
indices2 - index set for second face
Returns:
true if the index sets are equivalent

randomPoints

public double[] randomPoints(int num,
                             double range)
Returns the coordinates for num points whose x, y, and z values are randomly chosen within a given range.

Parameters:
num - number of points to produce
range - coordinate values will lie between -range and range
Returns:
array of coordinate values

randomDegeneratePoints

public double[] randomDegeneratePoints(int num,
                                       int dimen)
Returns the coordinates for num randomly chosen points which are degenerate which respect to the specified dimensionality.

Parameters:
num - number of points to produce
dimen - dimensionality of degeneracy: 0 = coincident, 1 = colinear, 2 = coplaner.
Returns:
array of coordinate values

randomSphericalPoints

public double[] randomSphericalPoints(int num,
                                      double radius)
Returns the coordinates for num points whose x, y, and z values are randomly chosen to lie within a sphere.

Parameters:
num - number of points to produce
radius - radius of the sphere
Returns:
array of coordinate values

randomCubedPoints

public double[] randomCubedPoints(int num,
                                  double range,
                                  double max)
Returns the coordinates for num points whose x, y, and z values are each randomly chosen to lie within a specified range, and then clipped to a maximum absolute value. This means a large number of points may lie on the surface of cube, which is useful for creating degenerate convex hull situations.

Parameters:
num - number of points to produce
range - coordinate values will lie between -range and range, before clipping
max - maximum absolute value to which the coordinates are clipped
Returns:
array of coordinate values

randomGridPoints

public double[] randomGridPoints(int gridSize,
                                 double width)
Returns randomly shuffled coordinates for points on a three-dimensional grid, with a presecribed width between each point.

Parameters:
gridSize - number of points in each direction, so that the total number of points produced is the cube of gridSize.
width - distance between each point along a particular direction
Returns:
array of coordinate values

explicitAndRandomTests

public void explicitAndRandomTests()
Runs a set of explicit and random tests on QuickHull3D, and prints Passed to System.out if all is well.


timingTests

public void timingTests()
Runs timing tests on QuickHull3D, and prints the results to System.out.


main

public static void main(java.lang.String[] args)
Runs a set of tests on the QuickHull3D class, and prints Passed if all is well. Otherwise, an error message and stack trace are printed.

If the option -timing is supplied, then timing information is produced instead.