[][src]Module cichlid::math

Collection of math Traits and functions for manipulating integers.

Some including functions:

  • Scaling Functions (from one integer to another)
  • In place and batch scaling (nscale16x3 for example).
  • Dimming and Brightening Functions
  • Fast u8 and u16 trigonometric functions
  • Other useful operations, such as blending integers.

This module offers a couple different ways to access the m These are the raw functions for both u8 and u16. Most of these methods are implemented through the Scaling trait interface, see that for better documentation of these functions.

If const functions are desired, use the re-exported functions rather than the trait impls.

Traits

ScalingInt

Scaling, Dimming, Brightening, and other misc functions functions for integers representing scalar components.

Trig

Basic trigonometric functions for integers.

Functions

blend_u8

Blends a u8another integer by the fraction amount_of_b.

blend_u16

Blends a u16another integer by the fraction amount_of_b.

brighten_u8_lin

Brightens a u8, but linearly below a threshold.

brighten_u8_raw

Brightens a u8.

brighten_u8_video

Brightens a u8 but in video mode.

brighten_u16_lin

Brightens a u16, but linearly below a threshold.

brighten_u16_raw

Brightens a u16.

brighten_u16_video

Brightens a u16 but in video mode.

cos_u8

Returns the cosine of a single byte integer.

cos_u16

Returns the cosine of a two byte integer.

dim_u8_lin

Dims a u8 similar to dim_raw, but linearly below a threshold.

dim_u8_raw

Dims a u8.

dim_u8_video

Dims a u8 in video mode.

dim_u16_lin

Dims a u16 similar to dim_raw, but linearly below a threshold.

dim_u16_raw

Dims a u16.

dim_u16_video

Dims a u16 in video mode.

nscale_u8

Scales a single u8 in place.

nscale_u16

Scales a single u16 in place.

nscale_u16x2

Inplace scaling for two u16's by the same value.

nscale_u16x3

Inplace scaling for three u16's by the same value.

nscale_u16x4

Inplace scaling for four u16's by the same value.

nscale_u8x2

Inplace scaling for two u8's by the same value.

nscale_u8x3

Inplace scaling for three u8's by the same value.

nscale_u8x4

Inplace scaling for four u8's by the same value.

scale_u8

Scale a u8 by another.

scale_u8_video

Scale a u8 by another, but in video mode.

scale_u16

Scale a u16 by another.

scale_u16_video

Scale a u16 by another, but in video mode.

sin_u8

Returns the sine of a single byte integer.

sin_u16

Returns the sine of a two byte integer.