Util Methods |
The Util type exposes the following members.
| Name | Description | |
|---|---|---|
| Acosh | Returns the angle (in radians) whose hyperbolic cosine is the specified number. | |
| AngleBetweenLineAndPlane | Returns the angle (in radians) between a unit Vector3 direction, and a plane (specified by the unit normal Vector3 to the plane). | |
| AngleBetweenMatrices | Determines the shortest (unsigned) rotation angle between the upper 3x3 rotation parts of the specified matrices. | |
| AngleBetweenUnitVectors(Vector2, Vector2) | Returns the angle (in radians) between two unit Vector2 directions. | |
| AngleBetweenUnitVectors(Vector3, Vector3) | Returns the angle (in radians) between two unit Vector3 directions. | |
| AngleBetweenVectors(Vector2, Vector2) | Returns the angle (in radians) between two Vector2 directions. | |
| AngleBetweenVectors(Vector3, Vector3) | Returns the angle (in radians) between two Vector3 directions. | |
| Asinh | Returns the angle (in radians) whose hyperbolic sine is the specified number. | |
| Atanh | Returns the angle (in radians) whose hyperbolic tangent is the specified number. | |
| BinomialCoefficient | The binomial coefficient (n choose k) is the number of ways of picking k unordered outcomes from n possibilities. | |
| BoundedDistanceTo(Vector2, Vector2, Vector2) | Find the distance of a point from a line segment. | |
| BoundedDistanceTo(Vector3, Vector3, Vector3) | Find the distance of a point from a line segment. | |
| BoundedSnapTo(Vector2, Vector2, Vector2) | Return the point in the line segment [v1,v2] that is closest to the point 'p' | |
| BoundedSnapTo(Vector3, Vector3, Vector3) | Return the point in the line segment [v1,v2] that is closest to the point 'p' | |
| CalculateLineLineIntersection(Vector3, Vector3, Vector3, Vector3) | Calculates the intersection line segment between 2 lines (not segments). | |
| CalculateLineLineIntersection(Vector3, Vector3, Vector3, Vector3, Vector3, Vector3) | Calculates the intersection line segment between 2 lines (not segments). | |
| CalculateSurfaceNormal | Determine the normal to the plane defined by 3 points (origin, left and right). | |
| ChangeCoordinateSystem | Converts a matrix from one coordinate system to another. | |
| ClampT | Clamps the supplied value to the specified inclusive range. | |
| ComposeAngles | Create a rotation Matrix from the Yaw (Y rotation), Pitch (X rotation) and Roll (Z rotation) contained in the given Vector3. | |
| ComposeAnglesDegrees | Create a rotation Matrix from the Yaw (Y rotation), Pitch (X rotation) and Roll (Z rotation) contained in the given Vector3. | |
| CosDegrees(Double) | Returns the cosine of the specified (in degrees) angle. | |
| CosDegrees(Int32) | Returns the cosine of the specified (in degrees) angle. | |
| CosRadians | Returns the cosine of the specified (in radians) angle. | |
| Decompose | Extract the translation and rotation matrices from the given matrix. Matrix is assumed to contain no scaling or shear components. | |
| DecomposeAngles(Matrix) | Return the Yaw (Y rotation), Pitch (X rotation), and Roll (Z rotation) Euler angles for the supplied Matrix. | |
| DecomposeAngles(Matrix, Vector3) | Return the Yaw (Y rotation), Pitch (X rotation), and Roll (Z rotation) Euler angles for the supplied Matrix. | |
| DecomposeRotation | Return a Matrix that only contains the Rotation component of the supplied matrix. | |
| DecomposeRotationByRef | Change a Matrix so that only contains the Rotation component. | |
| Degrees(Double) | Convert an angle in Radians to an angle in Degrees. | |
| Degrees(Vector3) | Convert a Vector3 of angles in Radians to angles in Degrees. | |
| Degrees(Vector3) | Convert (by reference) a Vector3 of angles in Radians to angles in Degrees. | |
| Distance(Vector2, Vector2) | The distance between the two supplied points. | |
| Distance(Vector3, Vector3) | The distance between the two supplied points. | |
| Distance(Double, Double, Double) | Calculate the distance traveled when starting at a speed and accelerating, over a given time. | |
| DistanceAlong |
Return the signed distance of point from origin, with vector defining
the direction for positive distance.
[point,origin] should be parallel to [vector]. | |
| DistanceSq | The square of the distance between the two supplied points. | |
| DistanceTo(Vector2, Vector2, Vector2) |
Find the distance of a point from a line.
See this page. | |
| DistanceTo(Vector3, Vector3, Vector3) |
Find the distance of a point from a line.
See this page. | |
| DistanceToPlane | Calculate the distance of a Vector3 from a plane. | |
| Duration | Calculate the time taken to change speeds with a given acceleration. | |
| EnumerateT | Helper function to let you enumerate over two IEnumerableT sequences. | |
| EQ(Double, Double) | Test if a is equal to b (within 1e-6 tolerance) | |
| EQ(Matrix, Matrix) | Test if a is equal to b (within 1e-6 tolerance) | |
| EQ(Plane, Plane) | Test if a is equal to b (within 1e-6 tolerance) | |
| EQ(Quaternion, Quaternion) | Test if a is equal to b (within 1e-6 tolerance) | |
| EQ(Vector2, Vector2) | Test if a is equal to b (within 1e-6 tolerance) | |
| EQ(Vector3, Vector3) | Test if a is equal to b (within 1e-6 tolerance) | |
| EQ(Vector4, Vector4) | Test if a is equal to b (within 1e-6 tolerance) | |
| EQ(Double, Double, Double) | Test if a is equal to b (within e tolerance) | |
| EQ(Matrix, Matrix, Double) | Test if a is equal to b (within e tolerance) | |
| EQ(Plane, Plane, Double) | Test if a is equal to b (within e tolerance) | |
| EQ(Quaternion, Quaternion, Double) | Test if a is equal to b (within e tolerance) | |
| EQ(Vector2, Vector2, Double) | Test if a is equal to b (within e tolerance) | |
| EQ(Vector3, Vector3, Double) | Test if a is equal to b (within e tolerance) | |
| EQ(Vector4, Vector4, Double) | Test if a is equal to b (within e tolerance) | |
| EscapePath | Join an array of path parts with a '.' escaping the following: @"\" is replaced with @"\\" @"." is replaced with @"\." | |
| Format | Convert a Vector3 value to a string with the given separator character. | |
| GE(Double, Double) | Test if a is greater than or equal to b (within 1e-6 tolerance) | |
| GE(Double, Double, Double) | Test if a is greater than or equal to b (within e tolerance) | |
| GetAlignMatrix(Vector3, Vector3) | Get the rotation matrix needed to align the initial vector with the target vector. | |
| GetAlignMatrix(Vector3, Vector3, Vector3) | Get the rotation matrix needed to align the initial vector with the target vector. | |
| GT(Double, Double) | Test if a is greater than b (within 1e-6 tolerance) | |
| GT(Double, Double, Double) | Test if a is greater than b (within e tolerance) | |
| IgnoreNaN | If any of the elements of a Vector3 are NaN, then return Zero. | |
| IncreaseMagnitude | Returns the value with its magnitude increased by the specified magnitude. | |
| IntersectCircleCircle | Calculate the intersection points of two circles. | |
| IntersectCirclePlane | Calculate the intersection points of a circle (in a given plane) and a plane (using 10^-6 as a tolerance in equality). | |
| IntersectCircleSphere(Vector3, Vector3, Double, Vector3, Double) | Calculate the intersection points of a circle (in a given plane) and a sphere surface (using 10^-6 as a tolerance in equality). | |
| IntersectCircleSphere(Vector3, Vector3, Double, Vector3, Double, Double) | Calculate the intersection points of a circle (in a given plane) and a sphere surface (using supplied epsilon as a tolerance in equality). | |
| IntersectCircleYSphere(Double, Vector3, Double) | Calculate the intersection points of a circle (centered at Origin and in the XZ plane) and a sphere surface (using 10^-6 as a tolerance in equality). | |
| IntersectCircleYSphere(Double, Vector3, Double, Double) | Calculate the intersection points of a circle (centered at Origin and in the XZ plane) and a sphere surface (using 10^-6 as a tolerance in equality). | |
| IntersectLineLine(Vector2, Vector2, Vector2, Vector2) | Calculate the intersection point of two line segments. | |
| IntersectLineLine(Vector2, Vector2, Vector2, Vector2, Boolean) |
Calculate the intersection point of two lines or two line segments.
If bounded is true, this acts like IntersectLineLine(Vector2, Vector2, Vector2, Vector2), otherwise, it considers both lines to extend indefinitely. | |
| IntersectLinePlane | Return intersection of line [L1,L2] with plane defined by normal N, and P being a point on the plane. | |
| IntersectLineSphere(Vector3, Vector3, Vector3, Double) | Intersect a line with a sphere (using 10^-6 as a tolerance in equality). | |
| IntersectLineSphere(Vector3, Vector3, Vector3, Double, Double) | Intersect a line with a sphere (using supplied epsilon as a tolerance in equality). | |
| IntersectPlaneSphere | Calculate the intersection circle of a plane and a sphere surface. | |
| IntersectRayPlane | Return intersection of the ray with plane defined by normal N, and P being a point on the plane. | |
| IntersectRaySphere | Intersects a ray with a sphere. | |
| IntersectRayTriangle(Ray, Vector3, Vector3, Vector3, Double) | Performs an intersection test between a ray and a triangle. | |
| IntersectRayTriangle(Ray, Vector3, Vector3, Vector3, Double) | Performs an intersection test between a ray and a triangle. | |
| IsEmailAddressSyntaxValid | Checks whether the syntax of an email address is valid (not whether the actual address exists). | |
| IsInfinity(Quaternion) | Are any of the elements of a Quaternion a NegativeInfinity or PositiveInfinity? | |
| IsInfinity(Vector3) | Are any of the elements of a Vector3 a NegativeInfinity or PositiveInfinity? | |
| IsNaN(Double) | Whether any of the element of the provided array is NaN. | |
| IsNaN(Quaternion) | Are any of the elements of a Quaternion a NaN? | |
| IsNaN(Vector3) | Are any of the elements of a Vector3 a NaN? | |
| IsUnitVector | Whether the vector has length approximately equal to 1. | |
| LE(Double, Double) | Test if a is less than or equal to b (within 1e-6 tolerance) | |
| LE(Double, Double, Double) | Test if a is less than or equal to b (within e tolerance) | |
| LineLineNearestPoints | Finds a point on each line that determines the shortest line segment between the two lines. | |
| LT(Double, Double) | Test if a is less than b (within 1e-6 tolerance) | |
| LT(Double, Double, Double) | Test if a is less than b (within e tolerance) | |
| MaxT | Return the largest element of values. | |
| MaxIndexT | Return the index for the largest element of values. | |
| MidPoint | Return a Vector3 that is midPoint units along the line from a to b. Eg, midPoint=0.5 returns the point half way between a and b | |
| MinT | Return the smallest element of values. | |
| MinIndexT(ListT) | Return the index for the smallest element of values. | |
| MinIndexT(T) | Return the index for the smallest element of values. | |
| MinNonNegative | Return the minimum non negative value of the two given values, or null if neither of them are non negative. | |
| Multiply | Scale elements of a Vector3 by the corresponding elements of another Vector3. | |
| NE(Double, Double) | Test if a is not equal to b (within 1e-6 tolerance) | |
| NE(Matrix, Matrix) | Test if a is not equal to b (within 1e-6 tolerance) | |
| NE(Plane, Plane) | Test if a is not equal to b (within 1e-6 tolerance) | |
| NE(Quaternion, Quaternion) | Test if a is not equal to b (within 1e-6 tolerance) | |
| NE(Vector2, Vector2) | Test if a is not equal to b (within 1e-6 tolerance) | |
| NE(Vector3, Vector3) | Test if a is not equal to b (within 1e-6 tolerance) | |
| NE(Vector4, Vector4) | Test if a is not equal to b (within 1e-6 tolerance) | |
| NE(Double, Double, Double) | Test if a is not equal to b (within e tolerance) | |
| NE(Matrix, Matrix, Double) | Test if a is not equal to b (within e tolerance) | |
| NE(Plane, Plane, Double) | Test if a is not equal to b (within e tolerance) | |
| NE(Quaternion, Quaternion, Double) | Test if a is not equal to b (within e tolerance) | |
| NE(Vector2, Vector2, Double) | Test if a is not equal to b (within e tolerance) | |
| NE(Vector3, Vector3, Double) | Test if a is not equal to b (within e tolerance) | |
| NE(Vector4, Vector4, Double) | Test if a is not equal to b (within e tolerance) | |
| NearestPowerOf2 | Round the value up to the nearest power of two. | |
| NormaliseWrapAroundRange | Normalizes the provided value to the wrap-around range defined by the provided start and end values. | |
| Normalize(Vector2) | Vector2 normalization - make its length be 1 | |
| Normalize(Vector3) | Vector3 normalization - make its length be 1 | |
| Normalize02PI | Change angle (in radians) to be equivalent angle in the range [0, 2 * PI]. | |
| NormalizeMinusPiToPlusPi | Change angle (in radians) to be equivalent angle in the range [-PI, PI]. | |
| Orthonormalize(Vector3, Vector3) | Makes the vector v2 orthogonal to the vector v1 and normalizes both vectors. | |
| Orthonormalize(Vector3, Vector3, Vector3) | Makes the vector v2 orthogonal to the vector v1 and the vector v3 orthogonal to both. | |
| ParallelComponent | Finds P, the component of V that is parallel to W. | |
| ParseVector3 | Convert a string to a Vector3 with a given separator. | |
| PerpendicularComponent | Finds P, the component of V that is perpendicular to W. | |
| PointBetween(Vector3, Vector3, Vector3) | P is expected to be on the projection of [U1,U2] but this function will return whether it is between U1 and U2 (using 10^-6 as the tolerance for comparisons). | |
| PointBetween(Vector3, Vector3, Vector3, Double) | P is expected to be on the projection of [U1,U2] but this function will return whether it is between U1 and U2 (using the supplied epsilon as the tolerance for comparisons). | |
| Project | Projects the vector v in the direction of the unit normal unitNormal. | |
| ProjectedLength | Calculates the length of the vector v when projected in the direction of the unit normal unitNormal. | |
| ProjectPointToLine | Projects the specified point onto the infinite line passing through the two points p1 and p2. | |
| ProjectPointToPlane | Project a point onto a plane. | |
| QuaternionToPitchYawRoll | Convert a Quaternion rotation into Yaw (Y rotation), Pitch (X rotation) and Roll (Z rotation) values. | |
| Radians(Double) | Convert an angle in Degrees to an angle in Radians. | |
| Radians(Vector3) | Convert a Vector3 of angles in Degrees to angles in Radians. | |
| Radians(Vector3) | Convert (by reference) a Vector3 of angles in Degrees to angles in Radians. | |
| ResizeImageWithCrop | Resize an image (and crop difference to maintain aspect ratio favouring the middle) | |
| RotationAngle | Determines the (unsigned) rotation angle for the upper 3x3 rotation part of the specified matrix. | |
| RotationToAlign | Returns a matrix that when applied to myMatrix aligns the object with the forward (X) and up (Y) axes | |
| SideOfPlane | Return 1 for positive side (pointed at by normal), -1 for negative side, 0 if V is on plane | |
| SignedAngleBetweenUnitVectors | Calculates the signed angle between two vectors in radians (must be unit vectors). | |
| SinDegrees(Double) | Returns the sine of the specified (in degrees) angle. | |
| SinDegrees(Int32) | Returns the sine of the specified (in degrees) angle. | |
| SinRadians | Returns the sine of the specified (in radians) angle. | |
| SnapLowerTo(Double, Double) | If given number is EQ(Double, Double) to t but less than t, make it t | |
| SnapLowerTo(Double, Double, Double) | If given number is EQ(Double, Double, Double) to t but less than t, make it t | |
| SnapLowerToZero(Double) | If given number is EQ(Double, Double) to 0 but less than 0, make it 0 | |
| SnapLowerToZero(Double, Double) | If given number is EQ(Double, Double, Double) to 0 but less than 0, make it 0 | |
| SnapTo(Double, Double, Double) | Return the value between [v1,v2] that is closest to 'p' | |
| SnapTo(Int32, Int32, Int32) | Return the value between [v1,v2] that is closest to 'p' | |
| SnapTo(Single, Single, Single) | Return the value between [v1,v2] that is closest to 'p' | |
| SnapTo(Vector2, Vector2, Vector2) | Return the point on the line going through [v1,v2] that is closest to the point 'p' | |
| SnapTo(Vector3, Vector3, Vector3) | Return the point on the line going through [v1,v2] that is closest to the point 'p' | |
| SnapToZero(Double) | If given number is EQ(Double, Double) to 0, make it zero | |
| SnapToZero(Single) | If given number is EQ(Double, Double) to 0, make it zero | |
| SnapToZero(Double, Double) | If given number is EQ(Double, Double, Double) to 0, make it zero | |
| SnapToZero(Single, Single) | If given number is EQ(Double, Double, Double) to 0, make it zero | |
| SnapUpperTo(Double, Double) | If given number is EQ(Double, Double) to t but greater than t, make it t | |
| SnapUpperTo(Double, Double, Double) | If given number is EQ(Double, Double, Double) to t but greater than t, make it t | |
| SnapUpperToZero(Double) | If given number is EQ(Double, Double) to 0 but greater than 0, make it 0 | |
| SnapUpperToZero(Double, Double) | If given number is EQ(Double, Double, Double) to 0 but greater than 0, make it 0 | |
| SphereIntersectsFrustum(Plane, BSphere) |
Check to see if the supplied frustum defined by a set of planes intersects
with the supplied sphere/>.
The frustum planes are usually Near, Far, Left, Right, Top, Bottom but Far can be ommitted in certain cases (selection to infinity). | |
| SphereIntersectsFrustum(Plane, Vector3, Double) |
Check to see if the supplied frustum defined by a set of planes intersects
with the supplied sphere centered at sphereCenter with a given sphereRadius.
The frustum planes are usually Near, Far, Left, Right, Top, Bottom but Far can be ommitted in certain cases (selection to infinity). | |
| SphereIntersectSphere | Test if Sphere a intersects with Sphere b. | |
| SwapT | Swap two contents of two variables. | |
| TanDegrees(Double) | Returns the tangent of the specified (in degrees) angle. | |
| TanDegrees(Int32) | Returns the tangent of the specified (in degrees) angle. | |
| TanRadians | Returns the tangent of the specified (in radians) angle. | |
| TimeOfIntersection | Load and Blocker separated by distance, how long until they touch? | |
| TimeOfSeparation | Load and blocker are touching, how long till they separate given new speeds and accelerations? | |
| TimeToTravel | Time to travel distance given starting speed and acceleration, or null if travel not possible | |
| TriangleIntersectsPlane | Does the supplied triangle intersect the plane. | |
| TriangleIntersectsTriangle | Do two triangles intersect? | |
| TrianglePlaneIntersection | Return the intersection line of a triangle and a plane. | |
| UnescapePath | Split a '.' separated path into path parts while unescaping the following: @"\\" is replaced with @"\" @"\." is replaced with @"." | |
| VectorToInverseRotation | Creates a rotation matrix to convert from a coordinate frame defined by a set of vectors to world coordinates. | |
| VectorToInverseRotationLeft | Creates a rotation matrix to point opposite to a direction defined by two vectors. | |
| VectorToInverseRotationRight | Creates a rotation matrix to point opposite to a direction defined by two vectors. | |
| VectorToInverseRotationUp | Creates a rotation matrix to point opposite to a direction defined by two vectors. | |
| VectorToRotation | Creates a rotation matrix to convert from world coordinates to a coordinate frame defined by a set of vectors. | |
| VectorToRotationLeft | Creates a rotation matrix to point in a certain direction defined by two vectors. | |
| VectorToRotationRight | Creates a rotation matrix to point in a certain direction defined by two vectors. | |
| VectorToRotationUp | Creates a rotation matrix to point in a certain direction defined by two vectors. | |
| ZeroNaN | Return a Vector3 replacing all instances of PositiveInfinity, NegativeInfinity and NaN with 0. |