Ritchie's Abstractions 0.2
Platform abstractions that make Toolbox work
Loading...
Searching...
No Matches
MathHelper Class Reference

Static class containing various mathematical constants and functions. More...

Static Public Member Functions

static Vector2 ToVector2 (this Point point)
 Convert a Point value to a Vector2 value.
 
static Point ToPoint (this Vector2 vector)
 Convert a Vector2 to a Point.
 
static float Lerp (float a, float b, float value)
 Linear interpolation between two floating-point values.
 
static double Lerp (double a, double b, float value)
 Linear interpolation between two double-precision floating-point values.
 
static byte Lerp (byte a, byte b, float value)
 Linear interpolation between two bytes.
 
static short Lerp (short a, short b, float value)
 Linear interpolation between two signed 16-bit integers.
 
static int Lerp (int a, int b, float value)
 Linear interpolation between two signed 32-bit integers.
 
static long Lerp (long a, long b, float value)
 Linear interpolation between two signed 64-bit integers.
 
static sbyte Lerp (sbyte a, sbyte b, float value)
 Linear interpolation between two signed bytes.
 
static ushort Lerp (ushort a, ushort b, float value)
 Linear interpolation between two unsigned 16-bit integers.
 
static uint Lerp (uint a, uint b, float value)
 Linear interpolation between two unsigned 32-bit integers.
 
static ulong Lerp (ulong a, ulong b, float value)
 Linear interpolation between two unsigned 64-bit integers.
 

Static Public Attributes

const float DegreesToRadians = MathF.PI / 180f
 Multiply a value in degrees by this constant to convert it to radians.
 
const float RadiansToDegrees = 180f / MathF.PI
 Multiply a value in radians by this constant to convert it to degrees.
 
const float PiOver2 = MathF.PI / 2f
 Constant representing an approximation of Pi divided by 2.
 
const float PiOver4 = MathF.PI / 4
 Constant representing an approximation of Pi divided by 4.
 

Detailed Description

Static class containing various mathematical constants and functions.

Member Function Documentation

◆ Lerp() [1/10]

static byte Lerp ( byte a,
byte b,
float value )
inlinestatic

Linear interpolation between two bytes.

Parameters
aThe value to start from
bThe value to end at
valueA value between 0 and 1 representing the progress between the start and end values.
Returns
An interpolated value between the start and end values.

◆ Lerp() [2/10]

static double Lerp ( double a,
double b,
float value )
inlinestatic

Linear interpolation between two double-precision floating-point values.

Parameters
aThe value to start from
bThe value to end at
valueA value between 0 and 1 representing the progress between the start and end values.
Returns
An interpolated value between the start and end values.

◆ Lerp() [3/10]

static float Lerp ( float a,
float b,
float value )
inlinestatic

Linear interpolation between two floating-point values.

Parameters
aThe value to start from
bThe value to end at
valueA value between 0 and 1 representing the progress between the start and end values.
Returns
An interpolated value between the start and end values.

◆ Lerp() [4/10]

static int Lerp ( int a,
int b,
float value )
inlinestatic

Linear interpolation between two signed 32-bit integers.

Parameters
aThe value to start from
bThe value to end at
valueA value between 0 and 1 representing the progress between the start and end values.
Returns
An interpolated value between the start and end values.

◆ Lerp() [5/10]

static long Lerp ( long a,
long b,
float value )
inlinestatic

Linear interpolation between two signed 64-bit integers.

Parameters
aThe value to start from
bThe value to end at
valueA value between 0 and 1 representing the progress between the start and end values.
Returns
An interpolated value between the start and end values.

◆ Lerp() [6/10]

static sbyte Lerp ( sbyte a,
sbyte b,
float value )
inlinestatic

Linear interpolation between two signed bytes.

Parameters
aThe value to start from
bThe value to end at
valueA value between 0 and 1 representing the progress between the start and end values.
Returns
An interpolated value between the start and end values.

◆ Lerp() [7/10]

static short Lerp ( short a,
short b,
float value )
inlinestatic

Linear interpolation between two signed 16-bit integers.

Parameters
aThe value to start from
bThe value to end at
valueA value between 0 and 1 representing the progress between the start and end values.
Returns
An interpolated value between the start and end values.

◆ Lerp() [8/10]

static uint Lerp ( uint a,
uint b,
float value )
inlinestatic

Linear interpolation between two unsigned 32-bit integers.

Parameters
aThe value to start from
bThe value to end at
valueA value between 0 and 1 representing the progress between the start and end values.
Returns
An interpolated value between the start and end values.

◆ Lerp() [9/10]

static ulong Lerp ( ulong a,
ulong b,
float value )
inlinestatic

Linear interpolation between two unsigned 64-bit integers.

Parameters
aThe value to start from
bThe value to end at
valueA value between 0 and 1 representing the progress between the start and end values.
Returns
An interpolated value between the start and end values.

◆ Lerp() [10/10]

static ushort Lerp ( ushort a,
ushort b,
float value )
inlinestatic

Linear interpolation between two unsigned 16-bit integers.

Parameters
aThe value to start from
bThe value to end at
valueA value between 0 and 1 representing the progress between the start and end values.
Returns
An interpolated value between the start and end values.

◆ ToPoint()

static Point ToPoint ( this Vector2 vector)
inlinestatic

Convert a Vector2 to a Point.

Parameters
vectorThe vector to convert. Fractional values are truncated.
Returns
A Point value representing the truncated coordinates.

◆ ToVector2()

static Vector2 ToVector2 ( this Point point)
inlinestatic

Convert a Point value to a Vector2 value.

Parameters
pointThe point to convert.
Returns
A Vector2 value representing the same point.

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