|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.jhu.htm.core.Vector3d
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 = 1This 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 $
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 |
public Vector3d()
public Vector3d(double x, double y, double z)
public Vector3d(double ra, double dec)
public Vector3d(Vector3d copy)
Method Detail |
public void set(double x, double y, double z)
public void set(double ra, double dec)
public double[] get()
public double length()
public double x()
public double y()
public double z()
public void normalize()
public java.lang.String toString()
toString
in class java.lang.Object
public Vector3d cross(Vector3d v)
public boolean equal(Vector3d v)
public Vector3d mul(double n)
public double mul(Vector3d v)
public Vector3d add(Vector3d v)
public Vector3d sub(Vector3d v)
public double dec()
public double ra()
protected void updateXYZ()
protected void updateRaDec()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |