public class Vector3d extends Object
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 $
| Modifier and Type | Field and Description |
|---|---|
(package private) double |
dec_ |
(package private) boolean |
okRaDec_ |
(package private) double |
ra_ |
(package private) double |
x_ |
(package private) double |
y_ |
(package private) double |
z_ |
| Constructor and Description |
|---|
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
|
| Modifier and Type | Method and Description |
|---|---|
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
|
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
|
double x_
double y_
double z_
double ra_
double dec_
boolean okRaDec_
public Vector3d()
public Vector3d(double x,
double y,
double z)
public Vector3d(double ra,
double dec)
public Vector3d(Vector3d copy)
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 String toString()
public boolean equal(Vector3d v)
public Vector3d mul(double n)
public double mul(Vector3d v)
public double dec()
public double ra()
protected void updateXYZ()
protected void updateRaDec()