Class Vector
java.lang.Object
org.shredzone.commons.suncalc.util.Vector
A three dimensional vector.
Objects are is immutable and threadsafe.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondouble
boolean
double
getPhi()
Returns the azimuthal angle (φ) in radians.double
getR()
Returns the polar radial distance (r).double
getTheta()
Returns the polar angle (θ) in radians.double
getX()
Returns the cartesian X coordinate.double
getY()
Returns the cartesian Y coordinate.double
getZ()
Returns the cartesian Z coordinate.int
hashCode()
multiply
(double scalar) negate()
Returns the negation of thisVector
.double
norm()
Returns the norm of thisVector
.static Vector
ofPolar
(double φ, double θ) Creates a newVector
of the given polar coordinates, with a radial distance of 1.static Vector
ofPolar
(double φ, double θ, double r) Creates a newVector
of the given polar coordinates.toString()
-
Constructor Details
-
Method Details
-
ofPolar
Creates a newVector
of the given polar coordinates, with a radial distance of 1.- Parameters:
\u03c6
- Azimuthal Angle\u03b8
- Polar Angle- Returns:
- Created
Vector
-
ofPolar
Creates a newVector
of the given polar coordinates.- Parameters:
\u03c6
- Azimuthal Angle\u03b8
- Polar Angler
- Radial Distance- Returns:
- Created
Vector
-
getX
Returns the cartesian X coordinate. -
getY
Returns the cartesian Y coordinate. -
getZ
Returns the cartesian Z coordinate. -
getPhi
Returns the azimuthal angle (φ) in radians. -
getTheta
Returns the polar angle (θ) in radians. -
getR
Returns the polar radial distance (r). -
add
-
subtract
-
multiply
- Parameters:
scalar
- Scalar to multiply- Returns:
- Resulting
Vector
-
negate
Returns the negation of thisVector
.- Returns:
- Resulting
Vector
-
cross
-
dot
- Parameters:
right
-Vector
to multiply- Returns:
- Resulting dot product
-
norm
Returns the norm of thisVector
.- Returns:
- Norm of this vector
-
equals
-
hashCode
-
toString
-