public final class AngleTools extends Object
This class provides static methods for angles :
- angles computation,
- comparison,
- arithmetic and trigonometric operations.
- In order to compute the angle between two vectors :
double angle = AngleTools.getAngleBewteen2Vector3D(vector1, vector2);
- To compute the angle 2PI modulo in the given interval : (can throw a MathIllegalArgumentException)
double res = AngleTools.angleInInterval(angle, angleInterval);
- To compare two angles in a given interval : (can throw a MathIllegalArgumentException)
boolean isEqual = AngleTools.equal(angle1, angle2, angleInterval);
- To compute the complementary angle in a given interval : (can throw a MathIllegalArgumentException)
double res = AngleTools.complementaryAngle(angle, angleInterval);
See DV-MATHS_60, 70, 80, 90, 100 .Modifier and Type | Method and Description |
---|---|
static double |
angleInInterval(double angle,
AngleInterval interval)
Computes the angle in the given interval modulo 2pi.
|
static double |
complementaryAngle(double angle,
AngleInterval interval)
Computes the complementary (PI/2 - angle) of the input angle, and then tries to express it in the
input interval.
|
static boolean |
equal(double alpha,
double beta,
AngleInterval interval)
Tests the equality of two angles after expressing them in the same interval.
|
static double |
getAngleBewteen2Vector3D(Vector3D vector1,
Vector3D vector2)
Computes the angle between 2 vectors 3D.
|
static double |
getAngleFromCosineAndSine(double cos,
double sin)
Computes an angle from the sine and the cosine
|
static double |
getOrientedAngleBetween2Vector2D(Vector2D vector1,
Vector2D vector2)
Computes the oriented angle between 2 vectors 2D.
|
static double |
getOrientedAngleBewteen2Vector3D(Vector3D vector1,
Vector3D vector2,
Vector3D vector3)
Computes the oriented angle between 2 vectors 3D.
|
static boolean |
greaterOrEqual(double alpha,
double beta,
AngleInterval interval)
Tests if one angle is greater or equal to another after expressing them in the same interval.
|
static boolean |
greaterStrict(double alpha,
double beta,
AngleInterval interval)
Tests if one angle is strictly greater than another after expressing them in the same interval.
|
static boolean |
lowerOrEqual(double alpha,
double beta,
AngleInterval interval)
Tests if one angle is lower or equal to another after expressing them in the same interval.
|
static boolean |
lowerStrict(double alpha,
double beta,
AngleInterval interval)
Tests if one angle is strictly lower than another after expressing them in the same interval.
|
static double |
meanAngle(double... angles)
Computes the mean of two circular quantities or angles.
|
static double |
modulo(double value,
double moduloMax)
Compute the modulo value
|
static List<Double> |
modulo(List<Double> values,
double moduloMax)
Compute the modulo for all elements of a list
|
static double |
moduloTwoPi(double value)
Compute the modulo 2PI value
|
static double |
oppositeAngle(double angle,
AngleInterval interval)
Computes the opposite of the input angle, and then tries to express it in the input interval.
|
static double |
supplementaryAngle(double angle,
AngleInterval interval)
Computes the supplementary (PI - angle) of the input angle, and then tries to express it in the
input interval.
|
static void |
unMod(List<Double> y)
Make angular data continuous by removing modulo every time a jump larger than pi is detected
|
static void |
unMod(List<Double> y,
double a)
Make angular data continuous by removing modulo every time a jump larger than pi is detected
|
static void |
unMod(List<Double> x,
List<Double> y,
double a,
double slope)
Make angular data continuous by removing modulo every time a jump larger than pi is detected
|
public static double getAngleBewteen2Vector3D(Vector3D vector1, Vector3D vector2)
Vector3D
.vector1
- the first vectorvector2
- the second vector0
and PI
.
See DV-MATHS_100Vector3D.angle(Vector3D, Vector3D)
public static double getOrientedAngleBetween2Vector2D(Vector2D vector1, Vector2D vector2)
vector1
- the first vectorvector2
- the second vector-2 PI
and 2 PI
.
See DV-MATHS_100 .MathIllegalArgumentException
- if at least one norm is zeroMathIllegalArgumentException
- if at least one norm is infinitypublic static double getOrientedAngleBewteen2Vector3D(Vector3D vector1, Vector3D vector2, Vector3D vector3)
vector1
- the first vectorvector2
- the second vectorvector3
- the third vector which defines the orientation-PI
and PI
.
See DV-MATHS_100 .IllegalArgumentException
- if the cross product is wrongpublic static double getAngleFromCosineAndSine(double cos, double sin)
cos
- : the cosine of the angle we want to know the valuesin
- : the sine of the angle we want to know the value-PI
and PI
See DV-MATHS_100 .public static double angleInInterval(double angle, AngleInterval interval)
angle
- angle to be expressed inside the given intervalinterval
- interval of expressionMathIllegalArgumentException
- the angle is'nt in the interval modulo 2PIpublic static boolean equal(double alpha, double beta, AngleInterval interval)
alpha
- one anglebeta
- one angleinterval
- the interval to express the anglesMathIllegalArgumentException
- if one angle is'nt in the interval, modulo 2PIpublic static boolean lowerOrEqual(double alpha, double beta, AngleInterval interval)
alpha
- one anglebeta
- one angleinterval
- the interval to express the anglesMathIllegalArgumentException
- if one angle is'nt in the interval, modulo 2PIpublic static boolean lowerStrict(double alpha, double beta, AngleInterval interval)
alpha
- : one anglebeta
- : one angleinterval
- the interval to express the anglesMathIllegalArgumentException
- if one angle is'nt in the interval, modulo 2PIpublic static boolean greaterOrEqual(double alpha, double beta, AngleInterval interval)
alpha
- : one anglebeta
- : one angleinterval
- the interval to express the anglesMathIllegalArgumentException
- if one angle is'nt in the interval, modulo 2PIpublic static boolean greaterStrict(double alpha, double beta, AngleInterval interval)
alpha
- : one anglebeta
- : one angleinterval
- the interval to express the anglesMathIllegalArgumentException
- if one angle is'nt in the interval, modulo 2PIpublic static double supplementaryAngle(double angle, AngleInterval interval)
angle
- the angle to get the supplementaryinterval
- the interval to express the resultMathIllegalArgumentException
- if the resulting angle is'nt in the interval, modulo 2PI
See DV-MATHS_80 .public static double complementaryAngle(double angle, AngleInterval interval)
angle
- the angle to get the complementaryinterval
- the interval to express the resultMathIllegalArgumentException
- if the resulting angle is'nt in the interval, modulo 2PI
See DV-MATHS_80 .public static double oppositeAngle(double angle, AngleInterval interval)
angle
- the angle to get the complementaryinterval
- the interval to express the resultMathIllegalArgumentException
- if the resulting angle is'nt in the interval, modulo 2PI
See DV-MATHS_80 .public static double meanAngle(double... angles)
For the case of more than two input angles, since the arithmetic mean is not appropriate for circular quantities due to angular wrapping, the angles are converted to their corresponding points on the unit circle, i.e. converting its polar coordinates to cartesian, and then computing the arithmetic mean of those two points.
Note: Results produced by this computation may seem counterintuitive since they are different from what would be obtained using a standard arithmetic mean of the values, with this difference being greater when the angles are widely distributed.
angles
- set of input angles [rad]public static double modulo(double value, double moduloMax)
value
- input valuemoduloMax
- maximum valuepublic static double moduloTwoPi(double value)
value
- input valuepublic static List<Double> modulo(List<Double> values, double moduloMax)
values
- input listmoduloMax
- maximum valuepublic static void unMod(List<Double> y, double a)
A user-input shift is added when necessary when a jump is detected. Warning: This function is
not valid if the "distance" between 2 points is larger than a/2, in which case function
#unMod(double[], double[], double, double)
shall be used.
y
- Array of data to be unmoda
- Size of jump to be corrected (the absolute value will be always used)public static void unMod(List<Double> y)
A two-pi shift is added when necessary when a jump is detected. Warning: This function is not
valid if the "distance" between 2 points is larger than pi, in which case function
#unMod(double[], double[], double, double)
shall be used.
y
- Array of data to be unmodpublic static void unMod(List<Double> x, List<Double> y, double a, double slope)
A user-input shift is added when necessary when a jump is detected. This function is valid even if the "distance" between two point is larger than a/2. In that case the approximate slope shall be provided to enable reconstruction by the algorithm.
x
- Array of abscissasy
- Array of ordinatesa
- Size of jump to be corrected (the absolute value will be always used)slope
- Approximate value of dy/dxCopyright © 2023 CNES. All rights reserved.