net.grelf.grip
Class VectorFloat

java.lang.Object
  extended by net.grelf.grip.VectorFloat
All Implemented Interfaces:
java.lang.Comparable<VectorFloat>

public class VectorFloat
extends java.lang.Object
implements java.lang.Comparable<VectorFloat>

Objects of this class describe the vector connecting two detected objects (Blobs). The description is in polar coordinates: radius r (pixels) and angle theta (radians). These two values are held as floating point numbers so equality can only be determined within certain tolerances. The tolerances are set fairly wide because for astrophotography the aim is to be able to compare vectors between images taken on a tripod, so the stars will have moved slightly because of the Earth's rotation. The separation will hardly change, particularly if an inverse gnomonic projection (see class Gnomonic) has been done on each image first, but the angle change may be significant. Note: This class deliberately has a natural ordering that is inconsistent with equals.


Field Summary
 float r
          Radius, in pixels.
 float theta
          Angle anticlockwise from 0x, in radians.
 
Constructor Summary
VectorFloat(float aRadiusPixels, float anAngleRadians)
          Construct from polar coordinates.
VectorFloat(PointFloat pt1, PointFloat pt2)
          Construct from two points (each in Cartesian coordinates).
 
Method Summary
 int compareTo(VectorFloat other)
          For sorting only on angle, theta.
 boolean equals(java.lang.Object other)
          Test for equality within the radius and angle tolerances.
static float getAngleTolerance()
          Angle tolerance for comparisons, in radians.
 float getDx()
          Get the x component of this vector (convert from polar to Cartesian coordinates).
 float getDy()
          Get the y component of this vector (convert from polar to Cartesian coordinates).
static float getRadiusTolerance()
          Radius tolerance for comparisons, in pixels.
 int hashCode()
           
static void resetDefaultTolerances()
           
static void setAngleTolerance(float value)
           
static void setRadiusTolerance(float value)
           
 java.lang.String toString()
          Get a String representation of the VectorFloat
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

r

public float r
Radius, in pixels.


theta

public float theta
Angle anticlockwise from 0x, in radians.

Constructor Detail

VectorFloat

public VectorFloat(float aRadiusPixels,
                   float anAngleRadians)
Construct from polar coordinates.


VectorFloat

public VectorFloat(PointFloat pt1,
                   PointFloat pt2)
Construct from two points (each in Cartesian coordinates).

Method Detail

getDx

public float getDx()
Get the x component of this vector (convert from polar to Cartesian coordinates).


getDy

public float getDy()
Get the y component of this vector (convert from polar to Cartesian coordinates).


getRadiusTolerance

public static float getRadiusTolerance()
Radius tolerance for comparisons, in pixels.


setRadiusTolerance

public static void setRadiusTolerance(float value)

getAngleTolerance

public static float getAngleTolerance()
Angle tolerance for comparisons, in radians.


setAngleTolerance

public static void setAngleTolerance(float value)

resetDefaultTolerances

public static void resetDefaultTolerances()

equals

public boolean equals(java.lang.Object other)
Test for equality within the radius and angle tolerances.

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

compareTo

public int compareTo(VectorFloat other)
For sorting only on angle, theta. Implements java.lang.Comparable.

Specified by:
compareTo in interface java.lang.Comparable<VectorFloat>

toString

public java.lang.String toString()
Get a String representation of the VectorFloat

Overrides:
toString in class java.lang.Object