Package cds.healpix.common.sphgeom
Class Vect3D
- java.lang.Object
-
- cds.healpix.common.sphgeom.Vect3D
-
public final class Vect3D extends java.lang.Object
Three dimensional vector.- Author:
- F.-X. Pineau
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Vect3D
clone()
static Vect3D
crossProd(Vect3D v1, Vect3D v2)
Returns the cross product of v1 by v2.double
norm()
Returns the norm of this vector.Vect3D
normalized()
Returns the vector having the same direction than this vector, but normalized (norm = 1).Vect3D
opposite()
Returns a vector having the opposite coordinates of this vector.static double
scalarProd(Vect3D v1, Vect3D v2)
Returns the scalar product of v1 by v2.double
toLat()
Returns the latitude coordinates from the vector, in radians.double
toLon()
Returns the longitude coordinate from the vector, in radians.java.lang.String
toString()
double
x()
Getterdouble
y()
Getterdouble
z()
Getter
-
-
-
Constructor Detail
-
Vect3D
public Vect3D(double x, double y, double z)
Constructor for the Cartesian coordiantes.- Parameters:
x
- first Cartesian coordinatey
- second Cartesian coordinatez
- thrid Cartesian coordinate
-
Vect3D
public Vect3D(double lonRad, double latRad)
Constructor from the spherical coordinates on the unit sphere.- Parameters:
lonRad
- longitude, in radianslatRad
- latitude, in radians
-
-
Method Detail
-
x
public final double x()
Getter- Returns:
- the x cartesian coordinate
-
y
public final double y()
Getter- Returns:
- the y cartesian coordinate
-
z
public final double z()
Getter- Returns:
- the z cartesian coordinate
-
clone
public Vect3D clone()
-
toLon
public double toLon()
Returns the longitude coordinate from the vector, in radians.- Returns:
- the longitude coordinate from the vector, in radians.
-
toLat
public double toLat()
Returns the latitude coordinates from the vector, in radians.- Returns:
- the latitude coordinates from the vector, in radians.
-
opposite
public Vect3D opposite()
Returns a vector having the opposite coordinates of this vector.- Returns:
- a vector having the opposite coordinates of this vector.
-
norm
public double norm()
Returns the norm of this vector.- Returns:
- the norm of this vector.
-
normalized
public final Vect3D normalized()
Returns the vector having the same direction than this vector, but normalized (norm = 1).- Returns:
- the vector having the same direction than this vector, but normalized (norm = 1).
-
scalarProd
public static double scalarProd(Vect3D v1, Vect3D v2)
Returns the scalar product of v1 by v2.- Parameters:
v1
- vector 1v2
- vector 2- Returns:
- the scalar product of v1 by v2.
-
crossProd
public static Vect3D crossProd(Vect3D v1, Vect3D v2)
Returns the cross product of v1 by v2.- Parameters:
v1
- vector 1v2
- vector 2- Returns:
- the cross product of v1 by v2.
-
toString
public final java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-