Class Vector
java.lang.Object
org.shredzone.commons.suncalc.util.Vector
A three dimensional vector.
Objects are is immutable and threadsafe.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoublebooleandoublegetPhi()Returns the azimuthal angle (φ) in radians.doublegetR()Returns the polar radial distance (r).doublegetTheta()Returns the polar angle (θ) in radians.doublegetX()Returns the cartesian X coordinate.doublegetY()Returns the cartesian Y coordinate.doublegetZ()Returns the cartesian Z coordinate.inthashCode()multiply(double scalar) negate()Returns the negation of thisVector.doublenorm()Returns the norm of thisVector.static VectorofPolar(double φ, double θ) Creates a newVectorof the given polar coordinates, with a radial distance of 1.static VectorofPolar(double φ, double θ, double r) Creates a newVectorof the given polar coordinates.toString()
-
Constructor Details
-
Method Details
-
ofPolar
Creates a newVectorof the given polar coordinates, with a radial distance of 1.- Parameters:
\u03c6- Azimuthal Angle\u03b8- Polar Angle- Returns:
- Created
Vector
-
ofPolar
Creates a newVectorof 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-Vectorto multiply- Returns:
- Resulting dot product
-
norm
Returns the norm of thisVector.- Returns:
- Norm of this vector
-
equals
-
hashCode
-
toString
-