net.talvi.puffinplot.data
Class GreatCircle

java.lang.Object
  extended by net.talvi.puffinplot.data.GreatCircle

public final class GreatCircle
extends java.lang.Object

This class represents a list of unit vectors and a best-fit great-circle path through them. The constructor calculates the best-fit circle from a supplied set of vectors.


Constructor Summary
GreatCircle(java.util.List<Vec3> vectors)
          Constructs a best-fitting great circle for the supplied vectors.
 
Method Summary
 double angleFromLast(Vec3 v)
          Returns the angle between the supplied direction and the last point on the great-circle fit.
static java.util.List<java.lang.String> getEmptyFields()
          Returns a list of empty strings equal in length to the number of parameters.
static java.util.List<java.lang.String> getHeaders()
          Returns the headers describing the parameters as a list of strings.
 double getMad1()
          Returns the MAD1 (planar maximum angular deviation) value for the great-circle fit.
 java.util.List<Vec3> getPoints()
          Returns the normalized points to which the great circle was fitted.
 Vec3 getPole()
          Returns a pole to the fitted great circle.
 Vec3 lastPoint()
          Returns the normalized final point used in the great-circle fit.
 Vec3 nearestOnCircle(Vec3 point)
          For a supplied direction, returns the nearest direction which lies on this great circle.
 java.util.List<java.lang.String> toStrings()
          Returns the statistical parameters as a list of strings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GreatCircle

public GreatCircle(java.util.List<Vec3> vectors)
Constructs a best-fitting great circle for the supplied vectors. The vectors do not need to be normalized, but only their directions are considered when fitting the circle.

Parameters:
vectors - the direction vectors for which to fit the circle
Method Detail

getPoints

public java.util.List<Vec3> getPoints()
Returns the normalized points to which the great circle was fitted.

Returns:
the normalized points to which the great circle was fitted

getPole

public Vec3 getPole()
Returns a pole to the fitted great circle. There is no guarantee as to which of the two possible pole directions will be returned.

Returns:
a pole to the fitted great circle

nearestOnCircle

public Vec3 nearestOnCircle(Vec3 point)
For a supplied direction, returns the nearest direction which lies on this great circle.

Parameters:
point - a vector specifying a direction
Returns:
a vector on this great circle, as close as possible to the specified direction

lastPoint

public Vec3 lastPoint()
Returns the normalized final point used in the great-circle fit.

Returns:
the normalized final point used in the great-circle fit

angleFromLast

public double angleFromLast(Vec3 v)
Returns the angle between the supplied direction and the last point on the great-circle fit. A negative value indicates that the supplied direction is before the last great-circle point when travelling along the great circle in the direction in which the original points were provided. A positive value indicates that the supplied direction is beyond the final great-circle point.

Parameters:
v - a direction
Returns:
the angle between the supplied direction and the last point on the great-circle fit

toStrings

public java.util.List<java.lang.String> toStrings()
Returns the statistical parameters as a list of strings. The order of the parameters is the same as the order of the headers provided by getHeaders().

Returns:
the statistical parameters as a list of strings

getEmptyFields

public static java.util.List<java.lang.String> getEmptyFields()
Returns a list of empty strings equal in length to the number of parameters.

Returns:
a list of empty strings equal in length to the number of parameters

getHeaders

public static java.util.List<java.lang.String> getHeaders()
Returns the headers describing the parameters as a list of strings.

Returns:
the headers describing the parameters

getMad1

public double getMad1()
Returns the MAD1 (planar maximum angular deviation) value for the great-circle fit.

Returns:
the MAD1 value for the great-circle fit.