24 #ifndef _UTILS_MATH_ANGLE_H_
25 #define _UTILS_MATH_ANGLE_H_
38 return (deg * M_PI / 180.f);
48 return (rad * 180.f / M_PI);
59 distance(
float x1,
float y1,
float x2,
float y2)
61 return sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
74 const float pi =
static_cast<float>(M_PI);
75 if ((angle_rad < -1.0f * pi) || (angle_rad >= pi)) {
76 return (angle_rad - 2.0f * pi * round(angle_rad / (2.0f * pi)));
92 const float twopi =
static_cast<float>(2 * M_PI);
93 if ((angle_rad < 0) || (angle_rad >= twopi)) {
94 return angle_rad - twopi * floor(angle_rad / twopi);
110 if ((angle_rad < -2 * M_PI) || (angle_rad > 2 * M_PI)) {
Fawkes library namespace.
float distance(float x1, float y1, float x2, float y2)
Get distance between two 2D cartesian coordinates.
float deg2rad(float deg)
Convert an angle given in degrees to radians.
float normalize_mirror_rad(float angle_rad)
Normalize angle in radian between -PI (inclusive) and PI (exclusive).
float normalize_rad(float angle_rad)
Normalize angle in radian between 0 (inclusive) and 2*PI (exclusive).
float angle_distance(float angle_rad1, float angle_rad2)
Determines the distance between two angle provided as radians.
float normalize_bigmirror_rad(float angle_rad)
Normalizes angle in radian between -3*PI and 3*PI.
float angle_distance_signed(float angle_from, float angle_to)
Determines the signed distance between from "angle_from" to "angle_to" provided as radians.
float rad2deg(float rad)
Convert an angle given in radians to degrees.