Pebble Foundation Classes  0.2.0
C++ for Pebble
Collaboration diagram for Math:

Macros

#define TRIG_MAX_RATIO   0xffff
 
#define TRIG_MAX_ANGLE   0x10000
 
#define TRIGANGLE_TO_DEG(trig_angle)   (((trig_angle) * 360) / TRIG_MAX_ANGLE)
 
#define DEG_TO_TRIGANGLE(angle)   (((angle) * TRIG_MAX_ANGLE) / 360)
 
#define TRIG_MAX_RATIO   0xffff
 
#define TRIG_MAX_ANGLE   0x10000
 
#define TRIGANGLE_TO_DEG(trig_angle)   (((trig_angle) * 360) / TRIG_MAX_ANGLE)
 
#define DEG_TO_TRIGANGLE(angle)   (((angle) * TRIG_MAX_ANGLE) / 360)
 

Functions

int32_t sin_lookup (int32_t angle)
 
int32_t cos_lookup (int32_t angle)
 
int32_t atan2_lookup (int16_t y, int16_t x)
 

Detailed Description

Macro Definition Documentation

◆ DEG_TO_TRIGANGLE [1/2]

#define DEG_TO_TRIGANGLE (   angle)    (((angle) * TRIG_MAX_ANGLE) / 360)

Converts from an angle in degrees to the equivalent fixed point value representation

See also
TRIGANGLE_TO_DEG
TRIG_MAX_ANGLE

◆ DEG_TO_TRIGANGLE [2/2]

#define DEG_TO_TRIGANGLE (   angle)    (((angle) * TRIG_MAX_ANGLE) / 360)

Converts from an angle in degrees to the equivalent fixed point value representation

See also
TRIGANGLE_TO_DEG
TRIG_MAX_ANGLE

◆ TRIG_MAX_ANGLE [1/2]

#define TRIG_MAX_ANGLE   0x10000

Angle value that corresponds to 360 degrees or 2 PI radians

See also
sin_lookup
cos_lookup

◆ TRIG_MAX_ANGLE [2/2]

#define TRIG_MAX_ANGLE   0x10000

Angle value that corresponds to 360 degrees or 2 PI radians

See also
sin_lookup
cos_lookup

◆ TRIG_MAX_RATIO [1/2]

#define TRIG_MAX_RATIO   0xffff

The largest value that can result from a call to sin_lookup or cos_lookup. For a code example, see the detailed description at the top of this chapter: Math

◆ TRIG_MAX_RATIO [2/2]

#define TRIG_MAX_RATIO   0xffff

The largest value that can result from a call to sin_lookup or cos_lookup. For a code example, see the detailed description at the top of this chapter: Math

◆ TRIGANGLE_TO_DEG [1/2]

#define TRIGANGLE_TO_DEG (   trig_angle)    (((trig_angle) * 360) / TRIG_MAX_ANGLE)

Converts from a fixed point value representation to the equivalent value in degrees

See also
DEG_TO_TRIGANGLE
TRIG_MAX_ANGLE

◆ TRIGANGLE_TO_DEG [2/2]

#define TRIGANGLE_TO_DEG (   trig_angle)    (((trig_angle) * 360) / TRIG_MAX_ANGLE)

Converts from a fixed point value representation to the equivalent value in degrees

See also
DEG_TO_TRIGANGLE
TRIG_MAX_ANGLE

Function Documentation

◆ atan2_lookup()

int32_t atan2_lookup ( int16_t  y,
int16_t  x 
)

Look-up the arctangent of a given x, y pair The angle value is scaled linearly, such that a value of 0x10000 corresponds to 360 degrees or 2 PI radians.

◆ cos_lookup()

int32_t cos_lookup ( int32_t  angle)

Look-up the cosine of the given angle from a pre-computed table. This is equivalent to calling sin_lookup(angle + TRIG_MAX_ANGLE / 4).

Parameters
angleThe angle for which to compute the cosine. The angle value is scaled linearly, such that a value of 0x10000 corresponds to 360 degrees or 2 PI radians.

◆ sin_lookup()

int32_t sin_lookup ( int32_t  angle)

Look-up the sine of the given angle from a pre-computed table.

Parameters
angleThe angle for which to compute the cosine. The angle value is scaled linearly, such that a value of 0x10000 corresponds to 360 degrees or 2 PI radians.