|
HTM Index 1.0![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jhu.htmIndex.SpatialVector
The SpatialVector 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.
2 2 2 x + y + z = 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.
Constructor Summary | |
SpatialVector()
Default cunstructor constructs (1,0,0), ra=0, dec=0. |
|
SpatialVector(double ra,
double dec)
Construct from ra/dec |
|
SpatialVector(double x,
double y,
double z)
Constructor from three coordinates |
|
SpatialVector(SpatialVector copy)
Copy constructor |
Method Summary | |
SpatialVector |
add(SpatialVector v)
vector addition |
SpatialVector |
cross(SpatialVector v)
vector cross product |
double |
dec()
return dec |
boolean |
equal(SpatialVector v)
comparison |
double[] |
get()
Get x,y,z |
double |
length()
return length of vector |
SpatialVector |
mul(double n)
multiply with a number |
double |
mul(SpatialVector v)
dot product |
void |
normalize()
Normalize vector length to 1 |
double |
ra()
return ra |
void |
read(java.io.Reader in)
read from a stream as X Y Z |
void |
readRaDec(java.io.Reader in)
read from a stream as RA DEC |
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 |
SpatialVector |
sub(SpatialVector 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 SpatialVector()
public SpatialVector(double x, double y, double z)
public SpatialVector(double ra, double dec)
public SpatialVector(SpatialVector 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()
public SpatialVector cross(SpatialVector v)
public boolean equal(SpatialVector v)
public SpatialVector mul(double n)
public double mul(SpatialVector v)
public SpatialVector add(SpatialVector v)
public SpatialVector sub(SpatialVector v)
public double dec()
public double ra()
protected void updateXYZ()
protected void updateRaDec()
public void read(java.io.Reader in) throws java.io.IOException
public void readRaDec(java.io.Reader in) throws java.io.IOException
|
HTM Index 1.0![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |