Class ExtendedMath
java.lang.Object
org.shredzone.commons.suncalc.util.ExtendedMath
Contains constants and mathematical operations that are not available in
Math.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doubleArc-Seconds per Radian.static final doubleMean radius of the earth, in kilometers.static final doublePI * 2 -
Method Summary
Modifier and TypeMethodDescriptionstatic doubleapparentRefraction(double ha) Calculates the atmospheric refraction of an object at the given apparent altitude.static MatrixCreates a rotationalMatrixfor converting equatorial to ecliptical coordinates.static VectorequatorialToHorizontal(double tau, double dec, double dist, double lat) Converts equatorial coordinates to horizontal coordinates.static doublefrac(double a) Returns the decimal part of a value.static booleanisZero(double d) Performs a safe check if the given double is actually zero (0.0).static doubleparallax(double height, double distance) Returns the parallax for objects at the horizon.static doublerefraction(double h) Calculates the atmospheric refraction of an object at the given altitude.
-
Field Details
-
PI2
PI * 2- See Also:
-
ARCS
Arc-Seconds per Radian. -
EARTH_MEAN_RADIUS
Mean radius of the earth, in kilometers.- See Also:
-
-
Method Details
-
frac
Returns the decimal part of a value.- Parameters:
a- Value- Returns:
- Fraction of that value. It has the same sign as the input value.
-
isZero
Performs a safe check if the given double is actually zero (0.0).Note that "almost zero" returns
false, so this method should not be used for comparing calculation results to zero.- Parameters:
d- double to check for zero.- Returns:
trueif the value was zero, or negative zero.
-
equatorialToHorizontal
Converts equatorial coordinates to horizontal coordinates.- Parameters:
tau- Hour angle (radians)dec- Declination (radians)dist- Distance of the objectlat- Latitude of the observer (radians)- Returns:
Vectorcontaining the horizontal coordinates
-
equatorialToEcliptical
Creates a rotationalMatrixfor converting equatorial to ecliptical coordinates.- Parameters:
t-JulianDateto use- Returns:
Matrixfor converting equatorial to ecliptical coordinates
-
parallax
Returns the parallax for objects at the horizon.- Parameters:
height- Observer's height, in meters above sea level. Must not be negative.distance- Distance of the sun, in kilometers.- Returns:
- parallax, in radians
-
apparentRefraction
Calculates the atmospheric refraction of an object at the given apparent altitude.The result is only valid for positive altitude angles. If negative, 0.0 is returned.
Assumes an atmospheric pressure of 1010 hPa and a temperature of 10 °C.
- Parameters:
ha- Apparent altitude, in radians.- Returns:
- Refraction at this altitude
- See Also:
-
refraction
Calculates the atmospheric refraction of an object at the given altitude.The result is only valid for positive altitude angles. If negative, 0.0 is returned.
Assumes an atmospheric pressure of 1010 hPa and a temperature of 10 °C.
- Parameters:
h- True altitude, in radians.- Returns:
- Refraction at this altitude
- See Also:
-