edu.jhu.htm.core
Class Vector3d

java.lang.Object
  |
  +--edu.jhu.htm.core.Vector3d

public class Vector3d
extends java.lang.Object

3-d vector class with conversion to ra/dec

The Vector3d is a standard 3D vector class with the addition that each coordinate (x,y,z) is also kept in ra,dec since we expect the vector to live on the surface of the unit sphere, i.e.

   x2 + y2 + z2  = 1
 
This is not enforced, so you can specify a vector that has not unit length. If you request the ra/dec of such a vector, it will be automatically normalized to length 1 and you get the ra/dec of that vector (the intersection of the vector's direction with the unit sphere. Vector multiplaction addition etc are inplemented on this class
  Current Version
  ===============
  ID:	$Id: Vector3d.java,v 1.3 2003/02/19 15:46:11 womullan Exp $
  Revision: 	$Revision: 1.3 $
  Date/time:	$Date: 2003/02/19 15:46:11 $
 

Version:
$Revision: 1.3 $

Constructor Summary
Vector3d()
          Default cunstructor constructs (1,0,0), ra=0, dec=0.
Vector3d(double ra, double dec)
          Construct from ra/dec
Vector3d(double x, double y, double z)
          Constructor from three coordinates
Vector3d(Vector3d copy)
          Copy constructor
 
Method Summary
 Vector3d add(Vector3d v)
          vector addition
 Vector3d cross(Vector3d v)
          vector cross product
 double dec()
          return dec
 boolean equal(Vector3d v)
          comparison
 double[] get()
          Get x,y,z
 double length()
          return length of vector
 Vector3d mul(double n)
          multiply with a number
 double mul(Vector3d v)
          dot product
 void normalize()
          Normalize vector length to 1
 double ra()
          return ra
 void set(double ra, double dec)
          Set member function: set values using ra/dec
 void set(double x, double y, double z)
          Set member function: set values
 Vector3d sub(Vector3d v)
          vector subtraction
 java.lang.String toString()
          convert to string : print x y z as "x y z"
protected  void updateRaDec()
          Update ra_ and dec_ from x_ y_ z_ variables
protected  void updateXYZ()
          Update x_ y_ z_ from ra_ and dec_ variables
 double x()
          return x (only as rvalue)
 double y()
          return y
 double z()
          return z
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Vector3d

public Vector3d()
Default cunstructor constructs (1,0,0), ra=0, dec=0.


Vector3d

public Vector3d(double x,
                double y,
                double z)
Constructor from three coordinates


Vector3d

public Vector3d(double ra,
                double dec)
Construct from ra/dec


Vector3d

public Vector3d(Vector3d copy)
Copy constructor

Method Detail

set

public void set(double x,
                double y,
                double z)
Set member function: set values


set

public void set(double ra,
                double dec)
Set member function: set values using ra/dec


get

public double[] get()
Get x,y,z


length

public double length()
return length of vector


x

public double x()
return x (only as rvalue)


y

public double y()
return y


z

public double z()
return z


normalize

public void normalize()
Normalize vector length to 1


toString

public java.lang.String toString()
convert to string : print x y z as "x y z"

Overrides:
toString in class java.lang.Object

cross

public Vector3d cross(Vector3d v)
vector cross product


equal

public boolean equal(Vector3d v)
comparison


mul

public Vector3d mul(double n)
multiply with a number


mul

public double mul(Vector3d v)
dot product


add

public Vector3d add(Vector3d v)
vector addition


sub

public Vector3d sub(Vector3d v)
vector subtraction


dec

public double dec()
return dec


ra

public double ra()
return ra


updateXYZ

protected void updateXYZ()
Update x_ y_ z_ from ra_ and dec_ variables


updateRaDec

protected void updateRaDec()
Update ra_ and dec_ from x_ y_ z_ variables