Class VectorExtensions
- Namespace
- Gamelogic.Extensions
- Assembly
- Gamelogic.Extensions.dll
Contains useful extension methods for vectors.
[Version(1, 0, 0)]
public static class VectorExtensions
- Inheritance
-
VectorExtensions
- Inherited Members
Methods
- ClampMagnitude(Vector4, float)
Clamps the vector to the given magnitude.
- Dot(Vector2, Vector2)
Equivalent to Vector2.Dot(v1, v2).
- Dot(Vector3, Vector3)
Equivalent to Vector3.Dot(v1, v2).
- Dot(Vector4, Vector4)
Equivalent to Vector4.Dot(v1, v2).
- HadamardDiv(Vector2, Vector2)
Divides one vector component by another.
- HadamardDiv(Vector3, Vector3)
Divides one vector component by another.
- HadamardDiv(Vector4, Vector4)
Divides one vector component by another.
- HadamardMod(Vector2, Vector2)
Multiplies component by component.
- HadamardMod(Vector3, Vector3)
Multiplies component by component.
- HadamardMod(Vector4, Vector4)
Multiplies component by component.
- HadamardMul(Vector2, Vector2)
Multiplies one vector componentwise by another.
- HadamardMul(Vector3, Vector3)
Multiplies one vector component by another.
- HadamardMul(Vector4, Vector4)
Multiplies one vector component by another.
- Perp(Vector2)
Returns the vector rotated 90 degrees counter-clockwise.
- PerpDot(Vector2, Vector2)
Equivalent to Vector2.Dot(v1.Perp(), v2).
- PerpXY(Vector3)
Turns the vector 90 degrees anticlockwise as viewed from the front (keeping the z coordinate intact). Equivalent to
v.To2DXY().Perp().To3DXY(v.z);
- PerpXZ(Vector3)
Turns the vector 90 degrees anticlockwise as viewed from the top (keeping the y coordinate intact). Equivalent to
v.To2DXZ().Perp().To3DXZ(v.y);
- Proj(Vector2, Vector2)
Returns the projection of this vector onto the given base.
- Proj(Vector3, Vector3)
Returns the projection of this vector onto the given base.
- Proj(Vector4, Vector4)
Returns the projection of this vector onto the given base.
- ReflectAboutX(Vector2)
Reflects the vector about x-axis.
- ReflectAboutY(Vector2)
Reflects the vector about y-axis.
- Rej(Vector2, Vector2)
Returns the rejection of this vector onto the given base.
- Rej(Vector3, Vector3)
Returns the rejection of this vector onto the given base.
- Rej(Vector4, Vector4)
Returns the rejection of this vector onto the given base. The sum of a vector's projection and rejection on a base is equal to the original vector.
- Rotate(Vector2, float)
Rotates a vector by a given angle.
- Rotate180(Vector2)
Rotates a vector by 180 degrees.
- Rotate270(Vector2)
Rotates a vector by 270 degrees.
- Rotate90(Vector2)
Rotates a vector by 90 degrees.
- RotateAround(Vector2, float, Vector2)
Rotates a vector by a given angle around a given point.
- To2DXY(Vector3)
Converts a 3D vector to a 2D vector taking the x and y coordinates.
- To2DXZ(Vector3)
Converts a 3D vector to a 2D vector taking the x and z coordinates.
- To2DYZ(Vector3)
Converts a 3D vector to a 2D vector taking the y and z coordinates.
- To3DXY(Vector2)
Converts a 2D vector to a 3D vector using the vector for the x and y coordinates, and 0 for the z coordinate.
- To3DXY(Vector2, float)
Converts a 2D vector to a 3D vector using the vector for the x and y coordinates, and the given value for the z coordinate.
- To3DXZ(Vector2)
Converts a 2D vector to a 3D vector using the vector for the x and z coordinates, and 0 for the y coordinate.
- To3DXZ(Vector2, float)
Converts a 2D vector to a 3D vector using the vector for the x and z coordinates, and the given value for the y coordinate.
- To3DYZ(Vector2)
Converts a 2D vector to a 3D vector using the vector for the y and z coordinates, and 0 for the x coordinate.
- To3DYZ(Vector2, float)
Converts a 2D vector to a 3D vector using the vector for the y and z coordinates, and the given value for the x coordinate.
- WithIncX(Vector2, float)
Returns a copy of the vector with the x-coordinate incremented with the given value.
- WithIncX(Vector3, float)
Returns a copy of the vector with the x-coordinate incremented with the given value.
- WithIncY(Vector2, float)
Returns a copy of the vector with the y-coordinate incremented with the given value.
- WithIncY(Vector3, float)
Returns a copy of the vector with the y-coordinate incremented with the given value.
- WithIncZ(Vector3, float)
Returns a copy of the vector with the z-coordinate incremented with the given value.
- WithX(Vector2, float)
Returns a copy of this vector with the given x-coordinate.
- WithX(Vector3, float)
Returns a copy of this vector with the given x-coordinate.
- WithY(Vector2, float)
Returns a copy of this vector with the given y-coordinate.
- WithY(Vector3, float)
Returns a copy of this vector with the given y-coordinate.
- WithZ(Vector3, float)
Returns a copy of this vector with the given z-coordinate.
- XZY(Vector3)
Creates a new vector by permuting the given vector's coordinates in the order XZY.
- YX(Vector2)
Swaps the x and y coordinates of the vector.
- YXZ(Vector3)
Creates a new vector by permuting the given vector's coordinates in the order YXZ.
- YZX(Vector3)
Creates a new vector by permuting the given vector's coordinates in the order YZX.
- ZXY(Vector3)
Creates a new vector by permuting the given vector's coordinates in the order ZXY.
- ZYX(Vector3)
Creates a new vector by permuting the given vector's coordinates in the order ZYX.