Class VectorMath
- Namespace
- OmegaEngine.Foundation.Geometry
- Assembly
- OmegaEngine.Foundation.dll
Math helpers related to vectors.
public static class VectorMath
- Inheritance
-
objectVectorMath
Methods
AdjustReference(DoubleVector3, DoubleVector3, DoubleVector3)
Rotates a vector from an old to a new reference frame.
[Pure]
public static DoubleVector3 AdjustReference(this DoubleVector3 vector, DoubleVector3 from, DoubleVector3 to)
Parameters
vectorDoubleVector3The vector to be adjusted.
fromDoubleVector3A vector describing the old reference frame.
toDoubleVector3A vector describing the new reference frame.
Returns
ByteToAngle(ByteVector4)
Maps a vector of 0-255 byte values to a vector of 0�-180� angles in radians.
[Pure]
public static Vector4 ByteToAngle(this ByteVector4 vector)
Parameters
vectorByteVector4
Returns
- Vector4
ByteToAngle(byte)
Maps a 0-255 byte value to a 0�-180� angle in radians.
[Pure]
public static double ByteToAngle(this byte b)
Parameters
bbyte
Returns
GetRotationTo(DoubleVector3, DoubleVector3)
Gets the minimal rotation required to rotate one direction vector into another.
[Pure]
public static (DoubleVector3 axis, double rotation) GetRotationTo(this DoubleVector3 from, DoubleVector3 to)
Parameters
fromDoubleVector3The starting direction vector.
toDoubleVector3The target direction vector.
Returns
- (DoubleVector3 axis, double rotation)
A tuple containing the unit rotation axis and the rotation angle in radians.
Rotate(Vector2, float)
Rotates a SlimDX.Vector2 by rotation around the origin.
[Pure]
public static Vector2 Rotate(this Vector2 value, float rotation)
Parameters
valueVector2The original vector.
rotationfloatThe angle to rotate by in radians.
Returns
- Vector2
The rotated SlimDX.Vector2.
RotateAroundAxis(DoubleVector3, DoubleVector3, double)
Rotates a DoubleVector3 around an arbitrary axis.
[Pure]
public static DoubleVector3 RotateAroundAxis(this DoubleVector3 value, DoubleVector3 axis, double rotation)
Parameters
valueDoubleVector3The original vector.
axisDoubleVector3The axis to rotate around.
rotationdoubleThe angle to rotate by in radians.
Returns
- DoubleVector3
The rotated DoubleVector3.
UnitVector(double, double)
Calculates a unit vector using spherical coordinates.
[Pure]
public static Vector3 UnitVector(double inclination, double azimuth)
Parameters
inclinationdoubleAngle away from positive Z axis in radians. Values from 0 to Pi.
azimuthdoubleAngle away from positive X axis in radians. Values from 0 to 2*Pi.
Returns
- Vector3