OxMathExtensions Module
This module provides some more "exotic" vector and scalar extensions that may not be required in every day use, but are nonetheless handy to have available.
OxMVector2 Extensions
Expand All | Collapse All
-
Ceil ( decimalplaces As Uint32 = 0 )
Performs a Ceil operation on the vector's components. Specify decimalplaces to Ceil to an arbitrary decimal precision (decimalplaces = 1 is tenths, 2 is hundredths, etc.) -
DirectionFromSelfToPoint ( point As OxMVector2, scale As Double = 1.0 ) As OxMVector2
Returns a normalized direction vector that points from this vector to point. Use the optional scale parameter to create denormalized velocity vectors. -
Floor ( decimalplaces As Uint32 = 0 )
Performs a Floor operation on the vector's components. Specify decimalplaces to Floor to an arbitrary decimal precision (decimalplaces = 1 is tenths, 2 is hundredths, etc.) -
Round ( decimalplaces As Uint32 = 0 )
Performs a Round operation on the vector's components. Specify decimalplaces to Round to an arbitrary decimal precision (decimalplaces = 1 is tenths, 2 is hundredths, etc.) -
SetToDirectionFromPointToPoint ( p1 As OxMVector2, p2 As OxMVector2, scale As Double = 1.0 )
Sets this vector to a normalized direction that points from p1 to p2. Use the optional scale parameter to create denormalized velocity vectors.
OxMVector3 Extensions
Expand All | Collapse All
-
Ceil ( decimalplaces As Uint32 = 0 )
Performs a Ceil operation on the vector's components. Specify decimalplaces to Ceil to an arbitrary decimal precision (decimalplaces = 1 is tenths, 2 is hundredths, etc.) -
DirectionFromSelfToPoint ( point As OxMVector3, scale As Double = 1.0 ) As OxMVector3
Returns a normalized direction vector that points from this vector to point. Use the optional scale parameter to create denormalized velocity vectors. -
Floor ( decimalplaces As Uint32 = 0 )
Performs a Floor operation on the vector's components. Specify decimalplaces to Floor to an arbitrary decimal precision (decimalplaces = 1 is tenths, 2 is hundredths, etc.) -
Round ( decimalplaces As Uint32 = 0 )
Performs a Round operation on the vector's components. Specify decimalplaces to Round to an arbitrary decimal precision (decimalplaces = 1 is tenths, 2 is hundredths, etc.) -
SetOrbitCylindricalX ( origin As OxMVector3, radius As Double, angle As Double, distance As Double )
Set this vector's position so it falls on an imaginary cylinder oriented along the X axis with the specified radius, and centered around origin. The final position is defined by the rotation angle (in radians) around the cylinder, and the distance relative to origin along the length or the cylinder. -
SetOrbitCylindricalY ( origin As OxMVector3, radius As Double, angle As Double, distance As Double )
Set this vector's position so it falls on an imaginary cylinder oriented along the Y axis with the specified radius, and centered around origin. The final position is defined by the rotation angle (in radians) around the cylinder, and the distance relative to origin along the length or the cylinder. -
SetOrbitCylindricalZ ( origin As OxMVector3, radius As Double, angle As Double, distance As Double )
Set this vector's position so it falls on an imaginary cylinder oriented along the Z axis with the specified radius, and centered around origin. The final position is defined by the rotation angle (in radians) around the cylinder, and the distance relative to origin along the length or the cylinder. -
SetToDirectionFromPointToPoint ( p1 As OxMVector3, p2 As OxMVector3, scale As Double = 1.0 )
Sets this vector to a normalized direction that points from p1 to p2. Use the optional scale parameter to create denormalized velocity vectors.
Scalar Extensions
Expand All | Collapse All
-
BitTestAnd ( test As Integer ) As Boolean
Performs a bitwise AND between this Integer and test and returns True if the result is greater than zero. Example:
if someint.BitTestAnd(2) then' Do something...
-
BitTestOr ( test As Integer ) As Boolean
Performs a bitwise OR between this Integer and test and returns True if the result is greater than zero. Example:
if someint.BitTestOr(2) then' Do something...
-
CloseEnough ( n As Double, within As Double = 0.01 ) As Boolean
Compares this Double with the passed Double and returns True if they fall within the requested tolerance (default 0.01). Example:
if somenumber.CloseEnough(6.5) then' Do something...
-
Equals ( n As Double, decimalplaces As UInt32 ) As Boolean
Rounds this Double and the passed Double to the requested decimal places (decimalplaces = 1 is tenths, 2 is hundredths, etc.) and returns True if the rounded values have the exact same value. Example:
if somenumber.Equals(someothernumber, 2) then' Do something...
Global Methods
Expand All | Collapse All
-
Ceil ( n As Double, decimalplaces As Uint32 ) As Double
Overloads the built-in Ceil function with an additional decimalplaces parameter to Ceil to an arbitrary decimal precision (decimalplaces = 1 is tenths, 2 is hundredths, etc.) -
Floor ( n As Double, decimalplaces As Uint32 ) As Double
Overloads the built-in Floor function with an additional decimalplaces parameter to Floor to an arbitrary decimal precision (decimalplaces = 1 is tenths, 2 is hundredths, etc.) -
Round ( n As Double, decimalplaces As Uint32 ) As Double
Overloads the built-in Round function with an additional decimalplaces parameter to Round to an arbitrary decimal precision (decimalplaces = 1 is tenths, 2 is hundredths, etc.)