Module sk_math
Functions
| vector3 (x, y, z) | creates a new 3d vector |
| isVector3 (obj) | determines if the input is a Vector3 |
| box3 (min, max) | creates a box3 |
| quaternion (x, y, z, w) | creates a new quaternion |
| isQuaternion (obj) | determines if the input is a Quaternion |
Class Vector3
| Vector3:__eq (b) | |
| Vector3:__add (b) | |
| Vector3:__sub (b) | |
| Vector3:__mul (b) | |
| Vector3:__div (b) | |
| Vector3:magnitude () | Get the magnitude of the vector |
| Vector3:magnitudeSqrd () | Get the magnitude squared of the vector |
| Vector3:normalized () | Returns a normalized version of this vector |
| Vector3:min (other) | Get the magnitude of the vector |
| Vector3:max (other) | Get the magnitude of the vector |
| Vector3:dot (b) | Get the dot product between two vectors |
| Vector3:cross (b) | Get the cross product between two vectors |
| Vector3:lerp (b) | Linearly interpolates between two points |
Class Box3
| Box3:nearest_point_in_box (point) | Returns the point inside or on the box that is nearest to the given point |
| Box3:overlaps (box_or_point) | Returns the point inside or on the box that is nearest to the given point |
| Box3:__mul (b) | |
| Box3:distance_to_point (point) | Gets the distance from the box to the point If the box contains the point then the negative distance to the nearest edge is returned |
| Box3:lerp () | Linearly interpolates between the min and max of the box |
| Box3:union (box_or_point) | Linearly interpolates between the min and max of the box |
Class Quaternion
| Quaternion:conjugate () | |
| Quaternion:slerp (b, t) |
Functions
- vector3 (x, y, z)
-
creates a new 3d vector
Parameters:
- x number the x value for the vector
- y number the x value for the vector
- z number the x value for the vector
Returns:
- isVector3 (obj)
-
determines if the input is a Vector3
Parameters:
- obj any
Returns:
-
boolean
- box3 (min, max)
-
creates a box3
Parameters:
Returns:
- quaternion (x, y, z, w)
-
creates a new quaternion
Parameters:
- x number the x value for the quaternion
- y number the x value for the quaternion
- z number the x value for the quaternion
- w number the x value for the quaternion
Returns:
- isQuaternion (obj)
-
determines if the input is a Quaternion
Parameters:
- obj any
Returns:
-
boolean
Class Vector3
- Vector3:__eq (b)
-
Parameters:
- b number or Vector3
Returns:
- Vector3:__add (b)
-
Parameters:
- b number or Vector3
Returns:
- Vector3:__sub (b)
-
Parameters:
- b number or Vector3
Returns:
- Vector3:__mul (b)
-
Parameters:
- b number or Vector3
Returns:
- Vector3:__div (b)
-
Parameters:
- b number or Vector3
Returns:
- Vector3:magnitude ()
-
Get the magnitude of the vector
Returns:
-
number
- Vector3:magnitudeSqrd ()
-
Get the magnitude squared of the vector
Returns:
-
number
- Vector3:normalized ()
-
Returns a normalized version of this vector
Returns:
- Vector3:min (other)
-
Get the magnitude of the vector
Parameters:
- other Vector3 vector
Returns:
- Vector3:max (other)
-
Get the magnitude of the vector
Parameters:
- other Vector3 vector
Returns:
- Vector3:dot (b)
-
Get the dot product between two vectors
Parameters:
- b Vector3
Returns:
-
number
- Vector3:cross (b)
-
Get the cross product between two vectors
Parameters:
- b Vector3
Returns:
- Vector3:lerp (b)
-
Linearly interpolates between two points
Parameters:
- b Vector3
Returns:
Class Box3
- Box3:nearest_point_in_box (point)
-
Returns the point inside or on the box that is nearest to the given point
Parameters:
- point Vector3
Returns:
- Box3:overlaps (box_or_point)
-
Returns the point inside or on the box that is nearest to the given point
Parameters:
Returns:
-
boolean
- Box3:__mul (b)
-
Parameters:
- b number or Box3
Returns:
- Box3:distance_to_point (point)
-
Gets the distance from the box to the point
If the box contains the point then the negative distance to
the nearest edge is returned
Parameters:
- point Vector3
Returns:
-
number
- Box3:lerp ()
-
Linearly interpolates between the min and max of the box
Returns:
- Box3:union (box_or_point)
-
Linearly interpolates between the min and max of the box
Parameters:
Returns:
Class Quaternion
- Quaternion:conjugate ()
-
Returns:
- Quaternion:slerp (b, t)
-
Parameters:
- b Quaternion
- t number
Returns: