|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthealpix.essentials.Vec3
healpix.tools.SpatialVector
public class SpatialVector
The SpatialVector contains standard 3D vector 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. This code comes originally from the HTM library of Peter Kunst during his time at JHU.
Field Summary |
---|
Fields inherited from class healpix.essentials.Vec3 |
---|
x, y, z |
Constructor Summary | |
---|---|
SpatialVector()
Default constructor constructs (1,0,0), ra=0, dec=0. |
|
SpatialVector(double ra,
double dec)
Construct from ra/dec in degrees |
|
SpatialVector(double x1,
double y1,
double z1)
Constructor from three coordinates |
|
SpatialVector(SpatialVector copy)
Copy constructor - be aware this only copies x,y,z |
|
SpatialVector(Vec3 v)
|
Method Summary | |
---|---|
SpatialVector |
add(SpatialVector v)
vector addition |
double |
angle(SpatialVector v1)
Returns the angle in radians between this vector and the vector parameter; the return value is constrained to the range [0,PI]. |
SpatialVector |
cross(SpatialVector v)
vector cross product |
double |
dec()
Get the dec angle in degrees |
double |
dot(SpatialVector v1)
Computes the dot product of the this vector and vector v1. |
boolean |
equal(SpatialVector v)
Compare vectors if coordinates are equals |
boolean |
equals(Object obj)
|
double[] |
get()
Get the coordinates in a 3 elements 1D array |
int |
hashCode()
|
SpatialVector |
mul(double n)
multiply with a number |
void |
normalized()
Normalized this vector |
double |
ra()
Get the ra angle in degrees |
void |
set_z_phi(double zin,
double phi)
convenience function - added as it is in C++ version |
void |
set(double ra,
double dec)
Sets the ra and dec angles in degrees |
SpatialVector |
sub(SpatialVector v)
vector subtraction |
String |
toString()
|
double |
x()
|
double |
y()
|
double |
z()
|
Methods inherited from class healpix.essentials.Vec3 |
---|
add, angle, cross, dot, flip, length, lengthSquared, normalize, scale, sub, toArray, toArray |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SpatialVector()
public SpatialVector(double x1, double y1, double z1)
x1
- y1
- z1
- public SpatialVector(Vec3 v)
public SpatialVector(double ra, double dec)
ra
- RA in degreesdec
- DEC in degreespublic SpatialVector(SpatialVector copy)
copy
- the vector to copyMethod Detail |
---|
public void normalized()
public void set(double ra, double dec)
ra
- right ascension angle in degreesdec
- declination angle in degreespublic final double angle(SpatialVector v1)
v1
- the other vector
public double[] get()
public double x()
public double y()
public double z()
public String toString()
toString
in class Vec3
public SpatialVector cross(SpatialVector v)
v
- the vector to cross
public boolean equal(SpatialVector v)
v
- the vector to be compared with
public boolean equals(Object obj)
equals
in class Vec3
public int hashCode()
hashCode
in class Vec3
public SpatialVector mul(double n)
mul
in class Vec3
n
- the scale number to be multiply to the coordinates x,y,z
public final double dot(SpatialVector v1)
v1
- the other vector
public SpatialVector add(SpatialVector v)
v
- the vector to be added
public SpatialVector sub(SpatialVector v)
v
- the vector to be substracted
public double dec()
public double ra()
public void set_z_phi(double zin, double phi)
zin
- phi
-
|
"Built from revision exported" | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |