jme.math
Class Approximation

java.lang.Object
  extended byjme.math.Approximation

public class Approximation
extends java.lang.Object

Approximation is a static class that will create a piece of geometry (line, rectangle, etc) that best fits a collection of points.

NOTE: See 3D Game Engine Design. David H. Eberly.

Version:
$Id: Approximation.java,v 1.2 2003/08/27 21:05:42 mojomonkey Exp $
Author:
Mark Powell

Constructor Summary
Approximation()
           
 
Method Summary
static void gaussPointsFit(Vector[] points, Vector center, Vector[] axis, float[] extent)
          gaussPointsFit generates a rectangle based on supplied points such that the center is calculated as the average of points and the extents are determined by the eigenvectors.
static Line orthogonalLineFit(Vector[] points)
          orthogonalLineFit creates a line that uses least squares and measures errors orthogonally rather than linearly.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Approximation

public Approximation()
Method Detail

orthogonalLineFit

public static Line orthogonalLineFit(Vector[] points)
orthogonalLineFit creates a line that uses least squares and measures errors orthogonally rather than linearly.

Parameters:
points - the points to fit a line to.
Returns:
the line that best fits the points.

gaussPointsFit

public static void gaussPointsFit(Vector[] points,
                                  Vector center,
                                  Vector[] axis,
                                  float[] extent)
gaussPointsFit generates a rectangle based on supplied points such that the center is calculated as the average of points and the extents are determined by the eigenvectors.

Parameters:
points - the collection of points to generate the rectangle.
center - storage for the center point of the points.
axis - storage for the orientation of the rectangle.
extent - storage for the length of the rectangle.