Common Functions

Common Functions — Some common mathematical functions

Functions

Types and Values

#define LW_PI
#define LW_2PI
#define LW_PI2

Description

The LiveWallpaper Core Library provides faster implementations of some common mathematical functions.

Functions

lw_sin ()

gfloat
lw_sin (gfloat angle);

Calculates the sine value of an angle by using a lookup table. Using this function is usually faster than computing the sine value with the sin() function of the standard library.

Make sure to use this function only with angles in the allowed range. This function does not check if the angle is out of range and so the application will crash.

Parameters

angle

The angle in the range -LW_2PI <= angle <= 0

 

Returns

The sine value of the angle

Since: 0.5


lw_cos ()

gfloat
lw_cos (gfloat angle);

Calculates the cosine value of an angle by using a lookup table. Using this function is usually faster than computing the cosine value with the cos() function of the standard library.

Make sure to use this function only with angles in the allowed range. This function does not check if the angle is out of range and so the application will crash.

Parameters

angle

The angle in the range -LW_2PI <= angle <= 0

 

Returns

The cosine value of the angle

Since: 0.5

Types and Values

LW_PI

#define LW_PI  (gfloat) 3.141593

Value of pi as used by LiveWallpaper.

Since: 0.5


LW_2PI

#define LW_2PI (gfloat) 6.283185

Value of 2 * pi as used by LiveWallpaper.

Since: 0.5


LW_PI2

#define LW_PI2 (gfloat) 1.570796

Value of pi / 2 as used by LiveWallpaper.

Since: 0.5