blaze.common.math
- bVec2
bzAbs
(bVec2 a);
- Params:
bVec2 a |
the vector to base the return value off of |
Returns:
a new vector with the x and y components equal to the absolute value
of the corresponding components in a.
- bMat22
bzAbs
(bMat22 A);
- Params:
bMat22 A |
the matrix to set the new matrix from |
Returns:
a new matrix with the columns equal to the absolute value of the
corresponding values in A.
- bVec2
bzMin
(bVec2 a, bVec2 b);
- Creates a vector such that x = min(a.x, b.x) and y = min(a.y, b.y)
Note that this does NOT return the vector with the smallest
magnitude. If a's x is smaller and b's y is smaller, it will return a.x and
b.y
Params:
bVec2 a |
the first of the two vectors |
bVec2 b |
the other vector |
Returns:
the new vector
- bVec2
bzMax
(bVec2 a, bVec2 b);
- See Also:
bzMin
- void
bKill
(T,U)(ref T[] array, U element);
- Recursively removes all instances of element in array
Params:
array |
the array |
element |
the element to remove |
- struct
bVec2
;
- A Two dimensional (2D) vector. Direct modification of the x and y coordinates
is believed to be safe.
- float
x
;
- X axis coordinate
- float
y
;
- Y Axis coordinate
- static const bVec2
zeroVect
;
- A zero vector
- static bVec2
opCall
(float ax, float ay);
- Constructor
Params:
float ax |
the x-component for the new vector |
float ay |
the y-component for the new vector |
Returns:
A new vector
- bVec2
clone
();
- Returns:
a copy of the vector
- void
set
(float px, float py);
- Set the vector
Params:
float px |
the new x-component |
float py |
the new y-component |
- void
zero
();
- Set the vector components to
zero
- float
bDot
(bVec2 v);
- Params:
Returns:
the dot product of this and v
- float
bCross
(bVec2 v);
- Returns:
the cross product
- bVec2
bCross
(float s);
- Scalar cross product
- bVec2
opAdd
(float V);
- Scalar addition
This does not add V to the length, but to the x and y components
Params:
float V |
the degree to which the vector components are increased |
Returns:
A new vector
- bVec2
opSub
(float n);
- Scalar subtraction
See Also:
opAdd
- bVec2
opAddAssign
(float V);
- Scalar addition
This does not add V to the length, but to the x and y components
Params:
float V |
the degree to which the vector components are increased |
Returns:
*this
- bVec2
opSubAssign
(float V);
- Scalar subtraction
See Also:
opAddAssign
- bVec2
opMulAssign
(float s);
- Scalar multiplication
The x and y components are both multiplied by s
Params:
float s |
the number to multiply by |
Returns:
*this
- bVec2
opMul
(float s);
- Scalar multiplication
The x and y components are both multiplied by s
Params:
float s |
the number to multiply by |
Returns:
A new vector
- bVec2
opMul
(bMat22 a);
- 2x2 matrix multiplication
Params:
bMat22 a |
the matrix to multiply by |
Returns:
A new vector that has been multiplied by the matrix
- bVec2
opDivAssign
(float s);
- Scalar division
See Also:
opMulAssign
- bVec2
opDiv
(float s);
- Scalar division
See Also:
opMul
- bVec2
opAddAssign
(bVec2 Other);
- Vector addition
Params other = the other vector
Returns:
*this
- bVec2
opAdd
(bVec2 V);
- Vector addition
Params other = the other vector
Returns:
A new vector holding the result of the addition
- bVec2
opSubAssign
(bVec2 Other);
- Vector subtraction
See Also:
opAddAssign
- bVec2
opSub
(bVec2 V);
- Vector subtraction
See Also:
opAdd
- bVec2
opNeg
();
- Negation
Returns:
a new vector 180 degrees from this one
- float
magnitude
();
- Returns:
the length of the vector
- float
lengthSquared
();
- For performance, use this instead of length() (if possible).
Returns:
the length of the vector squared.
- float
length
();
- Returns:
the
length
of the vector.
Use lengthSquared when possible
- float
normalize
();
- Converts the vector into a unit vector.
Returns:
the old length.
- float
distance
(bVec2 v);
- Calculates the
distance
between two points (stored as vectors)
Params:
Returns:
the
distance
between the two
- bVec2
perp
();
- Returns:
a bVec2 pointed 90 degrees to the left of this one (the
magnitudes of the two will be equal)
Todo:
Remove this. It's the same as rotateLeft90
- bVec2
clampMax
(float max);
- Restricts the magnitude of this vector to a specific length
Params:
float max |
the maximum length that the vector is allowed to have |
Returns:
a copy of this vector after the length restriction is applied
- bVec2
interpEquals
(float blend, bVec2 v);
- I have no idea what this function is for
- bVec2
projectOnto
(bVec2 v);
- Params:
Returns:
a bVec2 that represents the projection of this on to v. The
resulting vector will have a direction equal to v.
- float
angle
(bVec2 v);
- Calculates the
angle
between v and this
Params:
Returns:
the
angle
between v and this
- static bVec2
forAngle
(float a);
- Creates a unit vector pointed in a specific direction
Params:
float a |
the angle that the new vector will point in |
Returns:
a new vector
- bVec2
rotate
(bVec2 v);
- I'm too tired to tell what this does. TODO: fix this docstring
- bVec2
rotate
(float angle);
- Rotates the vector by a given angle
Params:
float angle |
the angle by which to
rotate
the vector |
Returns:
A new vector containing the result of the rotation
- bVec2
rotateAbout
(float angle, bVec2 point);
- Rotates the vector by a given angle about a point
Params:
float angle |
the angle by which to rotate the vector |
bVec2 point |
the point to rotate the vector about |
Returns:
a new vector containing the result of the rotation
- bVec2
rotateEquals
(float angle);
- Rotates the vector by a given angle and applies the result to *this
Params:
float angle |
the angle by which to rotate the vector |
Returns:
A copy of *this
- bVec2 []
createVectorArray
(int len);
- Creates an array of vectors
Params len = the size of the array
Returns:
an array of vectors of the specified length
- bool
equalsZero
();
- Returns:
true if the vector has zero for its x and y components
BUGS:
possibly convert this to use !<>
- bVec2
rotateLeft90
();
- Returns:
A new vector equal to this one but rotated left 90 degrees
See Also:
perp
- bVec2
rotateRight90
();
- Returns:
A new vector equal to this one but rotated right 90 degrees
- struct
bMat22
;
- static bMat22
opCall
(bVec2 c1, bVec2 c2);
- static bMat22
opCall
(float angle);
- For the results of this function to be valid, this must be a 2x2 rotation
matrix.
Params:
float angle |
the angle to set the matrix to |
- static bMat22
opCall
(float a11, float a12, float a21, float a22);
- Construct this matrix using scalars.
Params:
float a11 |
the value for row 1, column 1 |
float a12 |
the value for row 1, column 2 |
float a21 |
the value for row 2, column 1 |
float a22 |
the value for row 2, column 2 |
Returns:
A new matrix
- void
set
(bVec2 c1, bVec2 c2);
- Sets the matrix
Params:
bVec2 c1 |
the values for column 1 |
bVec2 c2 |
the values for column 2 |
- void
set
(float angle);
- For the results of this function to be valid, this must be a 2x2 rotation
matrix.
Params:
float angle |
the angle to
set
the matrix to |
- void
setIdentity
();
- Sets this equal to the identity matrix
- void
zero
();
- Sets all values in the matrix to
zero
- bMat22
invert
();
- Inverts the matrix
- bMat22
inverse
();
- Compute the
inverse
of this matrix, such that inv(A) * A = identity.
- bVec2
solve
(bVec2 b);
- Solve A * x = b, where b is a column vector. This is more efficient
than computing the inverse in one-shot cases.
Params:
bVec2 b |
the column vector |
Returns:
x
- bMat22
opAdd
(bMat22 B);
- Adds each element of the matrix to each corresponding element of the
other matrix
Params:
bMat22 B |
the other matrix |
Returns:
A new matrix containing the result of the addition
- bVec2
col1
;
- The columns
- bVec2
col2
;
- The columns
- struct
bSweep
;
- This describes the motion of a body/shape for TOI computation.
Shapes are defined with respect to the body origin, which may
not coincide with the center of mass. However, to support dynamics
we must interpolate the center of mass position.
- void
xForm
(ref bXForm xf, float t);
- Get the interpolated transform at a specific time.
Params:
bXForm xf |
the transform to interpolate from |
float t |
the normalized time in [0,1]. |
- void
advance
(float t);
- Advance the sweep forward, yielding a new initial state.
Params:
float t |
the new initial time. |
- bVec2
localCenter
;
- local center of mass position
- bVec2
c0
;
- center world positions
- bVec2
c
;
- center world positions
- float
a0
;
- world angles
- float
a
;
- world angles
- float
t0
;
- time interval = [
t0
,1], where
t0
is in [0,1]
- float
bDot
(bVec2 a, bVec2 b);
- Vector dot product
Params:
bVec2 a |
the first vector |
bVec2 b |
the second vector |
Returns:
the dot product of a and b
- float
bCross
(bVec2 a, bVec2 b);
- Vector cross product
Params:
bVec2 a |
the first vector |
bVec2 b |
the second vector |
Returns:
the cross product of a and b
- bVec2
bCross
(bVec2 a, float s);
- TODO
- bVec2
bCross
(float s, bVec2 a);
- TODO
- bVec2
bMul
(bMat22 A, bVec2 v);
- TODO
- bVec2
bMulT
(bMat22 A, bVec2 v);
- TODO
- bVec2
bMulT
(bXForm T, bVec2 v);
- TODO
- bMat22
bMul
(bMat22 A, bMat22 B);
- A * B
- bVec3
bMul
(bMat33 A, bVec3 v);
- Multiply a 3x3 matrix by a 3-component vector.
Params:
bMat33 A |
the matrix |
bVec3 v |
the vector |
Returns:
A new matrix containing the result
- bVec2
bMul
(bXForm T, bVec2 v);
- Multiply a transformation by a vector
Params:
bXForm T |
the transformation |
bVec2 v |
the vector |
Returns:
the resulting vector
- bMat22
bMulT
(bMat22 A, bMat22 B);
- A^T * B
- float
bDot
(bVec3 a, bVec3 b);
- Perform the
bDot
product on two vectors.
- bVec3
bCross
(bVec3 a, bVec3 b);
- Perform the cross product on two vectors.
- float
bClamp
(float a, float low, float high);
- Constrains a value to a range
Params:
float a |
the vaule |
b |
the lowest allowed value |
c |
the highest allowed value |
- bVec2
bClamp
(bVec2 a, bVec2 low, bVec2 high);
- Constrains a vector to a given range of x and y coordinates
See_also bzMax, bzMin
Params:
bVec2 a |
the vector |
b |
the lowest allowed values |
c |
the highest allowed values |
- void
bSwap
(T)(ref T a, ref T b);
- Simple swap
Params:
a |
the first item |
b |
the second item |
- struct
bTri2
;
- 2d Triangle
- static bTri2
opCal
(bVec2 a, bVec2 b, bVec2 c);
- Constructor
Params:
bVec2 a |
the coordinates of the first point |
bVec2 b |
the coordinates of the second point |
bVec2 c |
the coordinates of the third point |
Returns:
A new triangle
- struct
bVec3
;
- A 2D column vector with 3 elements.
- static bVec3
opCall
(float x, float y, float z);
- Construct using coordinates.
Params:
float x |
the x-coordinate |
float y |
the y-coordinate |
float z |
the z-coordinate |
Returns:
a new vector
- void
zero
();
- Sets all components equal to
zero
.
- void
set
(float x_, float y_, float z_);
- Set this vector to the specified coordinates
Params:
x |
the x-coordinate |
y |
the y-coordinate |
z |
the z-coordinate |
- bVec3
opNeg
();
- Negate this vector.
- void
opAddAssign
(bVec3 v);
- Add a vector to this vector.
Params:
- void
opSubAssign
(bVec3 v);
- Subtract a vector from this vector.
Params:
- void
opMulAssign
(float s);
- Multiply all components of the vector by a scalar.
Params:
- bVec3
opMul
(float s);
- Multiply all components of the vector by a scalar.
Params:
Returns:
A new vector containing the result of the multiplication
- bVec3
opAdd
(bVec3 b);
- Add two vectors component-wise.
Params:
Returns:
A new vector containing the result of the addition
- bVec3
opSub
(bVec3 v);
- Subtract two vectors component-wise.
Params:
Returns:
A new vector containing the result of the subtraction
- struct
bMat33
;
- A 3-by-3 matrix. Stored in column-major order.
- static bMat33
opCall
(bVec3 c1, bVec3 c2, bVec3 c3);
- Construct matrix using columns.
Params:
bVec3 c1 |
the first column |
bVec3 c2 |
the second column |
bVec3 c3 |
the third column |
Returns:
The new matrix
- void
zero
();
- Set this matrix to all zeros.
- bVec3
solve33
(bVec3 b);
- Solve A * x = b, where b is a column vector.
This is more efficient than computing the inverse in one-shot cases.
Params:
bVec3 b |
the column in vector form |
Returns:
A new bVec3 containing the result
- bVec2
solve22
(bVec2 b);
- Solve A * x = b, where b is a column vector. This is more efficient
than computing the inverse in one-shot cases. This function ignores the
third row and third column
Params:
bVec2 b |
the column in vector form |
Returns:
A new bVec3 containing the result
- struct
bJacobian
;
- I don't know what this is for
|