Collection of frequently used math algorithms and coversions of Math methods which operate on and return float values.
More...
|
static int | CountSetBits (int value) |
| Count the number of bits set in an int More...
|
|
static int | MaxSetBit (int value) |
| Get the highest bit set from 1 to 32. More...
|
|
static int | ClosestPowerOfTwo (int value) |
| Returns the closest power of two value. More...
|
|
static bool | IsPowerOfTwo (int value) |
| Returns true if the value is power of two. More...
|
|
static int | NextPowerOfTwo (int value) |
| Returns the next power of two that is equal to, or greater than, the argument. More...
|
|
static float | PerlinNoise (float x, float y=0.0f, float z=0.0f, float range=1.0f) |
| Generate Perlin noise. More...
|
|
static float | Sin (float f) |
| Returns the sine of angle f. More...
|
|
static float | Cos (float f) |
| Returns the cosine of angle f. More...
|
|
static float | Tan (float f) |
| Returns the tangent of angle f in radians. More...
|
|
static float | Asin (float f) |
| Returns the absolute value of f. More...
|
|
static float | Acos (float f) |
| Returns the arc-cosine of f - the angle in radians whose cosine is f. More...
|
|
static float | Atan (float f) |
| Returns the arc-tangent of f - the angle in radians whose tangent is f. More...
|
|
static float | Atan2 (float y, float x) |
| Returns the angle in radians whose Tan is y/x. More...
|
|
static float | Sqrt (float f) |
| Returns square root of f. More...
|
|
static float | Abs (float f) |
| Returns the absolute value of f. More...
|
|
static int | Abs (int value) |
| Returns the absolute value of f. More...
|
|
static float | Min (float a, float b) |
| Returns the smallest of two or more values. More...
|
|
static float | Min (params float[] values) |
| Returns the smallest of two or more values. More...
|
|
static int | Min (int a, int b) |
| Returns the smallest of two or more values. More...
|
|
static int | Min (params int[] values) |
| Returns the smallest of two or more values. More...
|
|
static float | Max (float a, float b) |
| Returns largest of two or more values. More...
|
|
static float | Max (params float[] values) |
| Returns largest of two or more values. More...
|
|
static int | Max (int a, int b) |
| Returns largest of two or more values. More...
|
|
static int | Max (params int[] values) |
| Returns largest of two or more values. More...
|
|
static float | Pow (float f, float p) |
| Returns f raised to power p. More...
|
|
static float | Exp (float power) |
| Returns e raised to the specified power. More...
|
|
static float | Log (float f, float p) |
| Returns the logarithm of a specified number in a specified base. More...
|
|
static float | Log (float f) |
| Returns the logarithm of a specified number in a specified base. More...
|
|
static float | Log10 (float f) |
| Returns the base 10 logarithm of a specified number. More...
|
|
static float | Ceil (float f) |
| Returns the smallest integer greater to or equal to f. More...
|
|
static float | Floor (float f) |
| Returns the largest integer smaller than or equal to f. More...
|
|
static float | Round (float f) |
| Returns f rounded to the nearest integer. More...
|
|
static int | CeilToInt (float f) |
| Returns the smallest integer greater to or equal to f. More...
|
|
static int | FloorToInt (float f) |
| Returns the largest integer smaller to or equal to f. More...
|
|
static int | RoundToInt (float f) |
| Returns f rounded to the nearest integer. More...
|
|
static float | Sign (float f) |
| Returns the sign of f. More...
|
|
static float | Clamp (float value, float min, float max) |
| Clamps the given value between the given minimum float and maximum float values. More...
|
|
static int | Clamp (int value, int min, int max) |
| Clamps the given value between the given minimum int and maximum int values. More...
|
|
static float | Clamp01 (float value) |
| Clamps value between 0 and 1 and returns value. More...
|
|
static float | Lerp (float a, float b, float t) |
| Linearly interpolates between a and b by t. More...
|
|
static float | LerpUnclamped (float a, float b, float t) |
| Linearly interpolates between a and b by t with no limit to t. More...
|
|
static float | LerpAngle (float a, float b, float t) |
| Same as Lerp but makes sure the values interpolate correctly when they wrap around 360 degrees. More...
|
|
static float | MoveTowards (float current, float target, float maxDelta) |
| Moves a value current towards target. More...
|
|
static float | MoveTowardsAngle (float current, float target, float maxDelta) |
| Same as MoveTowards but makes sure the values interpolate correctly when they wrap around 360 degrees. More...
|
|
static float | SmoothStep (float from, float to, float t) |
| Interpolates between min and max with smoothing at the limits. More...
|
|
static float | Gamma (float value, float absmax, float power) |
| Normalize a value between negative absmax and positive absmax to -1...1 then raise the result to a power before remapping it into negative absmax to absmax . More...
|
|
static bool | Approximately (float a, float b, float tolerance=1E-06f) |
| Compares two floating point values and returns true if they are similar. More...
|
|
static float | SmoothDamp (float current, float target, ref float currentVelocity, float smoothTime, float deltaTime, float maxSpeed=float.PositiveInfinity) |
| Gradually changes a value towards a desired goal over time. More...
|
|
static float | SmoothDampAngle (float current, float target, ref float currentVelocity, float smoothTime, float deltaTime, float maxSpeed=float.PositiveInfinity) |
| Gradually changes an angle given in degrees towards a desired goal angle over time. More...
|
|
static float | Repeat (float t, float length) |
| Loops the value t, so that it is never larger than length and never smaller than 0. More...
|
|
static float | PingPong (float t, float length) |
| PingPong returns a value that will increment and decrement between the value 0 and length. More...
|
|
static float | InverseLerp (float a, float b, float value) |
| Calculates the linear parameter t that produces the interpolant value within the range [a, b]. More...
|
|
static float | DeltaAngle (float current, float target) |
| Calculates the shortest difference between two given angles given in degrees. More...
|
|
static bool | LineIntersection (ksVector2 p1, ksVector2 p2, ksVector2 p3, ksVector2 p4, ref ksVector2 result) |
| Check if the line (p1,p2) intersects with line (p3, p4) More...
|
|
static bool | LineSegmentIntersection (ksVector2 p1, ksVector2 p2, ksVector2 p3, ksVector2 p4, ref ksVector2 result) |
| Check if the line segment (p1,p2) intersects with the line segment (p3, p4) More...
|
|
static float | Interpolate (float a, float b, float t, Interpolation equation) |
| Interpolate between the value a and b according to an interpolation method. More...
|
|
Collection of frequently used math algorithms and coversions of Math methods which operate on and return float values.