PebbleOS
Loading...
Searching...
No Matches
Macros | Functions
Trigonometry

Fixed-point trigonometry helpers. More...

Macros

#define TRIG_PI   0x8000
 Angle value that corresponds to 180 degrees or PI radians.
 
#define TRIG_FP   16
 Number of fractional bits of the fixed-point ratio used by atan2_lookup().
 

Functions

uint32_t normalize_angle (int32_t angle)
 Normalize an angle to the range [0, TRIG_MAX_ANGLE].
 

Detailed Description

Fixed-point trigonometry helpers.

Angles are scaled so that TRIG_MAX_ANGLE is a full turn. Entities shared with the app SDK are documented in the SDK's Math group.

Macro Definition Documentation

◆ TRIG_FP

#define TRIG_FP   16

Number of fractional bits of the fixed-point ratio used by atan2_lookup().

◆ TRIG_PI

#define TRIG_PI   0x8000

Angle value that corresponds to 180 degrees or PI radians.

See also
sin_lookup
cos_lookup

Function Documentation

◆ normalize_angle()

uint32_t normalize_angle ( int32_t  angle)

Normalize an angle to the range [0, TRIG_MAX_ANGLE].

Parameters
angleAngle, scaled so that TRIG_MAX_ANGLE is a full turn; may be negative.
Returns
Equivalent angle; TRIG_MAX_ANGLE only for negative multiples of a full turn.