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 doubleacosh(double a)Returns the arc hyperbolic cosine of a value; the returned hyperbolic angle is positive.static doubleacot(double a)Returns the arc cotangent of a value; the returned angle is in the range -pi/2 through pi/2.static doubleacot2(double x, double y)Returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta).static doubleacoth(double a)Returns the arc hyperbolic cotangent of a value.static doubleacovers(double a)Returns the arc coversine of a value; the returned angle is in the range -pi/2 through pi/2.static doubleacsc(double a)Returns the arc cosecant of a value; the returned angle is in the range -pi/2 through pi/2.static doubleacsch(double a)Returns the arc hyperbolic cosecant of a value.static doubleaexsec(double a)Returns the arc exsecant of a value; the returned angle is in the range 0.0 through pi.static doubleahav(double a)Returns the arc haversine of a value; the returned angle is in the range 0 to pi.static doubleangle(double a, double b, double c)Returns the angle \(\alpha\) opposite the sidea, given the three side-lengths of the triangle.static doubleangle(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 doubleasec(double a)Returns the arc secant of a value; the returned angle is in the range 0.0 through pi.static doubleasech(double a)Returns the arc hyperbolic secant of a value.static doubleasinh(double a)Returns the arc hyperbolic sine of a value.static doubleatanh(double a)Returns the arc hyperbolic tangent of a value.static doubleavers(double a)Returns the arc versine of a value; the returned angle is in the range zero through pi.static doublecosec(double a)Returns the cosecant of an angle.static doublecot(double a)Returns the cotangent of an angle.static doublecoth(double a)Returns the hyperbolic cotangent of a hyperbolic angle.static doublecovers(double a)Returns the coversed sine or coversine of an angle.static doublecsch(double a)Returns the hyperbolic cosecant of a hyperbolic angle.static doubleexsec(double a)Returns the exsecant of an angle.static doublehav(double a)Returns the haversed sine or haversine of an angle.static doublesec(double a)Returns the secant of an angle.static doublesech(double a)Returns the hyperbolic secant of a hyperbolic angle.static doublesinc(double a)Returns the unnormalized sinc function of an angle.static doublevers(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
NaNor 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
NaNor 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
NaNor 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
NaNthen 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
NaNthen 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
NaNthen 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
NaNor 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
NaNor 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
NaNor 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
NaNor 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
NaNor 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
doublevalue 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
doublevalue 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
doublevalue 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
doublevalue closest to -pi/2. - If both arguments are positive infinity, then the result is the
doublevalue closest to pi/4. - If the first argument is negative infinity and the second argument is positive infinity,
then the result is the
doublevalue closest to 3*pi/4. - If the first argument is positive infinity and the second argument is negative infinity,
then the result is the
doublevalue closest to -pi/4. - If both arguments are negative infinity, then the result is the
doublevalue 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
NaNor 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
NaNor 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
NaNor 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
NaNor 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
NaNor 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
NaNthen 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
-
-