A* Pathfinding Project  4.2.3
The A* Pathfinding Project for Unity 3D
AstarMath Class Reference

Utility functions for working with numbers and strings. More...

Detailed Description

Utility functions for working with numbers and strings.

See also
Polygon
VectorMath

Static Public Member Functions

static string FormatBytesBinary (int bytes)
 Returns a nicely formatted string for the number of bytes (KiB, MiB, GiB etc). More...
 
static Color HSVToRGB (float h, float s, float v)
 Converts an HSV color to an RGB color. More...
 
static Color IntToColor (int i, float a)
 Returns a nice color from int i with alpha a. More...
 
static float MapTo (float startMin, float startMax, float targetMin, float targetMax, float value)
 Maps a value between startMin and startMax to be between targetMin and targetMax. More...
 

Static Private Member Functions

static int Bit (int a, int b)
 Returns bit number b from int a. More...
 

Member Function Documentation

◆ Bit()

static int Bit ( int  a,
int  b 
)
staticprivate

Returns bit number b from int a.

The bit number is zero based. Relevant b values are from 0 to 31. Equals to (a >> b) & 1

◆ FormatBytesBinary()

static string FormatBytesBinary ( int  bytes)
static

Returns a nicely formatted string for the number of bytes (KiB, MiB, GiB etc).

Uses decimal names (KB, Mb - 1000) but calculates using binary values (KiB, MiB - 1024)

◆ HSVToRGB()

static Color HSVToRGB ( float  h,
float  s,
float  v 
)
static

Converts an HSV color to an RGB color.

According to the algorithm described at http://en.wikipedia.org/wiki/HSL_and_HSV

Author
Wikipedia
Returns
the RGB representation of the color.

◆ IntToColor()

static Color IntToColor ( int  i,
float  a 
)
static

Returns a nice color from int i with alpha a.

Got code from the open-source Recast project, works really well. Seems like there are only 64 possible colors from studying the code

◆ MapTo()

static float MapTo ( float  startMin,
float  startMax,
float  targetMin,
float  targetMax,
float  value 
)
static

Maps a value between startMin and startMax to be between targetMin and targetMax.


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