Package dev.nm.geometry
Class TrigMath
- java.lang.Object
-
- dev.nm.geometry.TrigMath
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static double
acosh(double a)
Returns the arc hyperbolic cosine of a value; the returned hyperbolic angle is positive.static double
acot(double a)
Returns the arc cotangent of a value; the returned angle is in the range -pi/2 through pi/2.static double
acot2(double x, double y)
Returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta).static double
acoth(double a)
Returns the arc hyperbolic cotangent of a value.static double
acovers(double a)
Returns the arc coversine of a value; the returned angle is in the range -pi/2 through pi/2.static double
acsc(double a)
Returns the arc cosecant of a value; the returned angle is in the range -pi/2 through pi/2.static double
acsch(double a)
Returns the arc hyperbolic cosecant of a value.static double
aexsec(double a)
Returns the arc exsecant of a value; the returned angle is in the range 0.0 through pi.static double
ahav(double a)
Returns the arc haversine of a value; the returned angle is in the range 0 to pi.static double
angle(double a, double b, double c)
Returns the angle \(\alpha\) opposite the sidea
, given the three side-lengths of the triangle.static double
angle(Pair A, Pair B, Pair C)
Given a the coordinates of A, B and C, the apices of triangle ABC, returns the value of the angle \(alpha\) at apex A.static double
asec(double a)
Returns the arc secant of a value; the returned angle is in the range 0.0 through pi.static double
asech(double a)
Returns the arc hyperbolic secant of a value.static double
asinh(double a)
Returns the arc hyperbolic sine of a value.static double
atanh(double a)
Returns the arc hyperbolic tangent of a value.static double
avers(double a)
Returns the arc versine of a value; the returned angle is in the range zero through pi.static double
cosec(double a)
Returns the cosecant of an angle.static double
cot(double a)
Returns the cotangent of an angle.static double
coth(double a)
Returns the hyperbolic cotangent of a hyperbolic angle.static double
covers(double a)
Returns the coversed sine or coversine of an angle.static double
csch(double a)
Returns the hyperbolic cosecant of a hyperbolic angle.static double
exsec(double a)
Returns the exsecant of an angle.static double
hav(double a)
Returns the haversed sine or haversine of an angle.static double
sec(double a)
Returns the secant of an angle.static double
sech(double a)
Returns the hyperbolic secant of a hyperbolic angle.static double
sinc(double a)
Returns the unnormalized sinc function of an angle.static double
vers(double a)
Returns the versed sine or versine of an angle.
-
-
-
Method Detail
-
angle
public static double angle(double a, double b, double c)
Returns the angle \(\alpha\) opposite the sidea
, given the three side-lengths of the triangle.- Parameters:
a
- the side opposite the angle to computeb
- the side bc
- the side c- Returns:
- the angle \(alpha\) opposite the side a
-
angle
public static double angle(Pair A, Pair B, Pair C)
Given a the coordinates of A, B and C, the apices of triangle ABC, returns the value of the angle \(alpha\) at apex A.- Parameters:
A
- a pair containing the coordinates of apex A, the angle at which is returnedB
- a pair containing the coordinates of apex BC
- a pair containing the coordinates of apex C- Returns:
- the angle at apex A
-
cosec
public static double cosec(double a)
Returns the cosecant of an angle. Special cases:- If the argument is
NaN
or an infinity, then the result isNaN
. - If the argument is zero then the result is infinity with the same sign as the argument.
- Parameters:
a
- an angle in radians- Returns:
- the cosecant of the argument
- If the argument is
-
sec
public static double sec(double a)
Returns the secant of an angle. Special cases:- If the argument is
NaN
or an infinity, then the result isNaN
.
- Parameters:
a
- an angle in radians- Returns:
- the secant of the argument
- If the argument is
-
cot
public static double cot(double a)
Returns the cotangent of an angle. Special cases:- If the argument is
NaN
or an infinity, then the result isNaN
. - If the argument is zero then the result is infinity with the same sign as the argument.
- Parameters:
a
- an angle in radians- Returns:
- the cotangent of the argument
- If the argument is
-
csch
public static double csch(double a)
Returns the hyperbolic cosecant of a hyperbolic angle. Special cases:- If the argument is
NaN
then the result isNaN
. - If the argument is an infinity then the result is zero with the same sign as the argument.
- If the argument is zero then the result is positive infinity.
- Parameters:
a
- a hyperbolic angle- Returns:
- the hyperbolic cosecant of the argument
- If the argument is
-
sech
public static double sech(double a)
Returns the hyperbolic secant of a hyperbolic angle. Special cases:- If the argument is
NaN
then the result isNaN
. - If the argument is an infinity then the result is zero with the same sign as the argument.
- Parameters:
a
- a hyperbolic angle- Returns:
- the hyperbolic secant of the argument
- If the argument is
-
coth
public static double coth(double a)
Returns the hyperbolic cotangent of a hyperbolic angle. Special cases:- If the argument is
NaN
then the result isNaN
. - If the argument is an infinity then the result is one with the same sign as the argument.
- If the argument is zero then the result is infinity with the same sign as the argument.
- Parameters:
a
- a hyperbolic angle- Returns:
- the hyperbolic cotangent of the argument
- If the argument is
-
vers
public static double vers(double a)
Returns the versed sine or versine of an angle. Special cases:- If the argument is
NaN
or an infinity then the result isNaN
.
- Parameters:
a
- an angle in radians- Returns:
- the versed sine of the argument
- If the argument is
-
covers
public static double covers(double a)
Returns the coversed sine or coversine of an angle. Special cases:- If the argument is
NaN
or an infinity then the result isNaN
.
- Parameters:
a
- an angle in radians- Returns:
- the coversed sine of the argument
- If the argument is
-
hav
public static double hav(double a)
Returns the haversed sine or haversine of an angle. Special cases:- If the argument is
NaN
or an infinity then the result isNaN
.
- Parameters:
a
- an angle in radians- Returns:
- the haversed sine of the argument
- If the argument is
-
exsec
public static double exsec(double a)
Returns the exsecant of an angle. Special cases:- If the argument is
NaN
or an infinity then the result isNaN
.
- Parameters:
a
- an angle in radians- Returns:
- the exsecant of the argument
- If the argument is
-
sinc
public static double sinc(double a)
Returns the unnormalized sinc function of an angle. Special cases:- If the argument is
NaN
or an infinity then the result isNaN
.
- Parameters:
a
- an angle in radians- Returns:
- the unnormalized sinc of the argument
- If the argument is
-
acot
public static double acot(double a)
Returns the arc cotangent of a value; the returned angle is in the range -pi/2 through pi/2. Special cases:- If the argument is
NaN
, then the result isNaN
. - If the argument is zero, then the result is
NaN
.
- Parameters:
a
- the value whose arg cotangent is to be returned- Returns:
- the arc cotangent of the argument
- If the argument is
-
acot2
public static double acot2(double x, double y)
Returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta). This method computes the phase theta by computing an arc tangent of y/x in the range of -pi to pi. Special cases:- If either argument is
NaN
, then the result isNaN
. - If the first argument is positive and the second argument is positive zero, or the first argument is positive infinity and finite and the second argument is positive, then the result is positive zero.
- If the first argument is positive and the second argument is negative zero, or the first argument is positive infinity and the second argument is negative and finite, then the result is negative zero.
- If the first argument is negative and the second argument is positive zero, or the first
argument is negative infinity and finite and the second argument is positive, then the result
is the
double
value closest to pi. - If the first argument is negative and the second argument is negative zero, or the first
argument is negative infinity and the second argument is negative and finite, then the result
is the
double
value closest to -pi. - If the first argument is positive zero or negative zero and the second argument is
positive, or the first argument is finite and the second argument is positive infinity, then
the result is the
double
value closest to pi/2. - If the first argument is positive zero or negative zero and the second argument is
negative, or the first argument is finite and the second argument is negative infinity, then
the result is the
double
value closest to -pi/2. - If both arguments are positive infinity, then the result is the
double
value closest to pi/4. - If the first argument is negative infinity and the second argument is positive infinity,
then the result is the
double
value closest to 3*pi/4. - If the first argument is positive infinity and the second argument is negative infinity,
then the result is the
double
value closest to -pi/4. - If both arguments are negative infinity, then the result is the
double
value closest to -3*pi/4.
- Parameters:
x
- the abscissa coordinatey
- the ordinate coordinate- Returns:
- the theta component of the point (r, theta) in polar coordinates that corresponds to the point (x, y) in Cartesian coordinates.
- If either argument is
-
asec
public static double asec(double a)
Returns the arc secant of a value; the returned angle is in the range 0.0 through pi. Special cases:- If the argument is
NaN
or its absolute value is less than 1, then the result isNaN
.
- Parameters:
a
- the value whose arc secant is to be returned- Returns:
- the arc secant of the argument
- If the argument is
-
acsc
public static double acsc(double a)
Returns the arc cosecant of a value; the returned angle is in the range -pi/2 through pi/2. Special cases:- If the argument is
NaN
or its absolute value is less than 1, then the result isNaN
.
- Parameters:
a
- the value whose arc cosecant is to be returned- Returns:
- the arc cosecant of the argument
- If the argument is
-
asinh
public static double asinh(double a)
Returns the arc hyperbolic sine of a value. Special cases:- If the argument is
NaN
, then the result isNaN
. - If the argument is is an infinity, then the result is an infinity with the same sign as the argument.
- Parameters:
a
- the value whose arc hyperbolic sine is to be returned- Returns:
- the arc hyperbolic sine of the argument
- If the argument is
-
acosh
public static double acosh(double a)
Returns the arc hyperbolic cosine of a value; the returned hyperbolic angle is positive. Special cases:- If the argument is
NaN
or its value is less than 1, then the result isNaN
.
- Parameters:
a
- the value whose arc hyperbolic cosine is to be returned- Returns:
- the arc hyperbolic sine of the argument
- If the argument is
-
atanh
public static double atanh(double a)
Returns the arc hyperbolic tangent of a value. Special cases:- If the argument is
NaN
or its absolute value is greater than 1, then the result isNaN
.
- Parameters:
a
- the value whose arc hyperbolic tangent is to be returned- Returns:
- the arc hyperbolic tangent of the argument
- If the argument is
-
acoth
public static double acoth(double a)
Returns the arc hyperbolic cotangent of a value. Special cases:- If the argument is
NaN
or its absolute value is less than 1, then the result isNaN
.
- Parameters:
a
- the value whose arc hyperbolic cotangent is to be returned- Returns:
- the arc hyperbolic cotangent of the argument
- If the argument is
-
asech
public static double asech(double a)
Returns the arc hyperbolic secant of a value. Special cases:- If the argument is
NaN
, its value is negative or its value is greater than 1, then the result isNaN
.
- Parameters:
a
- the value whose arc hyperbolic secant is to be returned- Returns:
- the arc hyperbolic secant of the argument
- If the argument is
-
acsch
public static double acsch(double a)
Returns the arc hyperbolic cosecant of a value. Special cases:- If the argument is
NaN
, then the result isNaN
. - If the argument is zero, then the result is infinity with the same sign as the argument.
- Parameters:
a
- the value whose arc hyperbolic cosecant is to be returned- Returns:
- the arc hyperbolic cosecant of the argument
- If the argument is
-
aexsec
public static double aexsec(double a)
Returns the arc exsecant of a value; the returned angle is in the range 0.0 through pi. Special cases:- If the argument is
NaN
then the result isNaN
.
- Parameters:
a
- the value whose arc exsecant is to be returned- Returns:
- the arc exsecant of the argument
- If the argument is
-
avers
public static double avers(double a)
Returns the arc versine of a value; the returned angle is in the range zero through pi. Special cases:- If the argument is
NaN
, negative or greater than 2 then the result isNaN
.
- Parameters:
a
- the value whose arc versine is to be returned- Returns:
- the arc versine of the argument
- If the argument is
-
acovers
public static double acovers(double a)
Returns the arc coversine of a value; the returned angle is in the range -pi/2 through pi/2. Special cases:- If the argument is
NaN
, negative or greater than 2 then the result isNaN
.
- Parameters:
a
- the value whose arc coversine is to be returned- Returns:
- the arc coversine of the argument
- If the argument is
-
ahav
public static double ahav(double a)
Returns the arc haversine of a value; the returned angle is in the range 0 to pi. Special cases:- If the argument is
NaN
, negative or greater than one then the result isNaN
.
- Parameters:
a
- the value whose arc haversine is to be returned- Returns:
- the arc haversine of the argument
- If the argument is
-
-