Belle II Software development
AngleUtil Struct Reference

Utility functions to be used with angular quantities. More...

#include <Angle.h>

Static Public Member Functions

static double average (const double angle1, double angle2)
 Combines two angluar values to the one that lies half way between them on the short arc.
 
static double normalised (const double angle)
 Normalise an angle to lie in the range from [-pi, pi].
 
static void normalise (double &angle)
 Normalise an angle inplace to lie in the range from [-pi, pi].
 
static double fullNormalised (const double angle)
 Normalise an angle to lie in the range from [-pi, pi].
 
static double reversed (const double angle)
 Get the angle that point in the opposite direction.
 

Detailed Description

Utility functions to be used with angular quantities.

All angles are normalised to be in the range [-pi, pi]

Definition at line 24 of file Angle.h.

Member Function Documentation

◆ average()

static double average ( const double  angle1,
double  angle2 
)
inlinestatic

Combines two angluar values to the one that lies half way between them on the short arc.

Definition at line 27 of file Angle.h.

28 {
29 return normalised(angle1 + normalised(angle2 - angle1) / 2);
30 }
static double normalised(const double angle)
Normalise an angle to lie in the range from [-pi, pi].
Definition: Angle.h:33

◆ fullNormalised()

static double fullNormalised ( const double  angle)
inlinestatic

Normalise an angle to lie in the range from [-pi, pi].

Definition at line 48 of file Angle.h.

49 {
50 return std::remainder(angle, 2 * M_PI);
51 }

◆ normalise()

static void normalise ( double &  angle)
inlinestatic

Normalise an angle inplace to lie in the range from [-pi, pi].

Definition at line 41 of file Angle.h.

42 {
43 if (angle > M_PI) angle -= 2 * M_PI;
44 if (angle < -M_PI) angle += 2 * M_PI;
45 }

◆ normalised()

static double normalised ( const double  angle)
inlinestatic

Normalise an angle to lie in the range from [-pi, pi].

Definition at line 33 of file Angle.h.

34 {
35 if (angle > M_PI) return angle - 2 * M_PI;
36 if (angle < -M_PI) return angle + 2 * M_PI;
37 return angle;
38 }

◆ reversed()

static double reversed ( const double  angle)
inlinestatic

Get the angle that point in the opposite direction.

Definition at line 54 of file Angle.h.

55 {
56 return angle > 0 ? angle - M_PI : angle + M_PI;
57 }

The documentation for this struct was generated from the following file: