Class: Math

Math

new Math()

Math class for specific game related functions.
Author:
  • Simon Chauvin
Source:

Methods

addVectors(vec1, vec2) → {FM.Vector}

Add two vectors together.
Parameters:
Name Type Description
vec1 FM.Vector The first vector to add.
vec2 FM.Vector The second vector to add.
Source:
Returns:
The vector product of the addition of the two given vectors.
Type
FM.Vector

clamp(val, min, max) → {float}

Clamp a value between a min and a max to the nearest available value.
Parameters:
Name Type Description
val float The value to clamp.
min float The min value possible.
max float The max value possible.
Source:
Returns:
The value clamped.
Type
float

multiplyVectors(vec1, vec2) → {FM.Vector}

Multiply two vectors together.
Parameters:
Name Type Description
vec1 FM.Vector The first vector to multiply.
vec2 FM.Vector The second vector to multiply.
Source:
Returns:
The vector product of the multiplication of the two given vector.
Type
FM.Vector

substractVectors(vec1, vec2) → {FM.Vector}

Substract a vector from another.
Parameters:
Name Type Description
vec1 FM.Vector The vector that gets substracted.
vec2 FM.Vector The vector that subtracts.
Source:
Returns:
The vector resulting of the substraction of vec2 from vec1.
Type
FM.Vector