Click or drag to resize

Util Methods

The Util type exposes the following members.

Methods
 NameDescription
Public methodStatic memberAcosh Returns the angle (in radians) whose hyperbolic cosine is the specified number.
Public methodStatic memberAngleBetweenLineAndPlane Returns the angle (in radians) between a unit Vector3 direction, and a plane (specified by the unit normal Vector3 to the plane).
Public methodStatic memberAngleBetweenMatrices Determines the shortest (unsigned) rotation angle between the upper 3x3 rotation parts of the specified matrices.
Public methodStatic memberAngleBetweenUnitVectors(Vector2, Vector2) Returns the angle (in radians) between two unit Vector2 directions.
Public methodStatic memberAngleBetweenUnitVectors(Vector3, Vector3) Returns the angle (in radians) between two unit Vector3 directions.
Public methodStatic memberAngleBetweenVectors(Vector2, Vector2) Returns the angle (in radians) between two Vector2 directions.
Public methodStatic memberAngleBetweenVectors(Vector3, Vector3) Returns the angle (in radians) between two Vector3 directions.
Public methodStatic memberAsinh Returns the angle (in radians) whose hyperbolic sine is the specified number.
Public methodStatic memberAtanh Returns the angle (in radians) whose hyperbolic tangent is the specified number.
Public methodStatic memberBinomialCoefficient The binomial coefficient (n choose k) is the number of ways of picking k unordered outcomes from n possibilities.
Public methodStatic memberBoundedDistanceTo(Vector2, Vector2, Vector2) Find the distance of a point from a line segment.
Public methodStatic memberBoundedDistanceTo(Vector3, Vector3, Vector3) Find the distance of a point from a line segment.
Public methodStatic memberBoundedSnapTo(Vector2, Vector2, Vector2) Return the point in the line segment [v1,v2] that is closest to the point 'p'
Public methodStatic memberBoundedSnapTo(Vector3, Vector3, Vector3) Return the point in the line segment [v1,v2] that is closest to the point 'p'
Public methodStatic memberCalculateLineLineIntersection(Vector3, Vector3, Vector3, Vector3) Calculates the intersection line segment between 2 lines (not segments).
Public methodStatic memberCalculateLineLineIntersection(Vector3, Vector3, Vector3, Vector3, Vector3, Vector3) Calculates the intersection line segment between 2 lines (not segments).
Public methodStatic memberCalculateSurfaceNormal Determine the normal to the plane defined by 3 points (origin, left and right).
Public methodStatic memberChangeCoordinateSystem Converts a matrix from one coordinate system to another.
Public methodStatic memberClampT Clamps the supplied value to the specified inclusive range.
Public methodStatic memberComposeAngles Create a rotation Matrix from the Yaw (Y rotation), Pitch (X rotation) and Roll (Z rotation) contained in the given Vector3.
Public methodStatic memberComposeAnglesDegrees Create a rotation Matrix from the Yaw (Y rotation), Pitch (X rotation) and Roll (Z rotation) contained in the given Vector3.
Public methodStatic memberCosDegrees(Double) Returns the cosine of the specified (in degrees) angle.
Public methodStatic memberCosDegrees(Int32) Returns the cosine of the specified (in degrees) angle.
Public methodStatic memberCosRadians Returns the cosine of the specified (in radians) angle.
Public methodStatic memberDecompose Extract the translation and rotation matrices from the given matrix. Matrix is assumed to contain no scaling or shear components.
Public methodStatic memberDecomposeAngles(Matrix) Return the Yaw (Y rotation), Pitch (X rotation), and Roll (Z rotation) Euler angles for the supplied Matrix.
Public methodStatic memberDecomposeAngles(Matrix, Vector3) Return the Yaw (Y rotation), Pitch (X rotation), and Roll (Z rotation) Euler angles for the supplied Matrix.
Public methodStatic memberDecomposeRotation Return a Matrix that only contains the Rotation component of the supplied matrix.
Public methodStatic memberDecomposeRotationByRef Change a Matrix so that only contains the Rotation component.
Public methodStatic memberDegrees(Double) Convert an angle in Radians to an angle in Degrees.
Public methodStatic memberDegrees(Vector3) Convert a Vector3 of angles in Radians to angles in Degrees.
Public methodStatic memberDegrees(Vector3) Convert (by reference) a Vector3 of angles in Radians to angles in Degrees.
Public methodStatic memberDistance(Vector2, Vector2) The distance between the two supplied points.
Public methodStatic memberDistance(Vector3, Vector3) The distance between the two supplied points.
Public methodStatic memberDistance(Double, Double, Double) Calculate the distance traveled when starting at a speed and accelerating, over a given time.
Public methodStatic memberDistanceAlong Return the signed distance of point from origin, with vector defining the direction for positive distance.

[point,origin] should be parallel to [vector].

Public methodStatic memberDistanceSq The square of the distance between the two supplied points.
Public methodStatic memberDistanceTo(Vector2, Vector2, Vector2) Find the distance of a point from a line.

See this page.

Public methodStatic memberDistanceTo(Vector3, Vector3, Vector3) Find the distance of a point from a line.

See this page.

Public methodStatic memberDistanceToPlane Calculate the distance of a Vector3 from a plane.
Public methodStatic memberDuration Calculate the time taken to change speeds with a given acceleration.
Public methodStatic memberEnumerateT Helper function to let you enumerate over two IEnumerableT sequences.
Public methodStatic memberEQ(Double, Double) Test if a is equal to b (within 1e-6 tolerance)
Public methodStatic memberEQ(Matrix, Matrix) Test if a is equal to b (within 1e-6 tolerance)
Public methodStatic memberEQ(Plane, Plane) Test if a is equal to b (within 1e-6 tolerance)
Public methodStatic memberEQ(Quaternion, Quaternion) Test if a is equal to b (within 1e-6 tolerance)
Public methodStatic memberEQ(Vector2, Vector2) Test if a is equal to b (within 1e-6 tolerance)
Public methodStatic memberEQ(Vector3, Vector3) Test if a is equal to b (within 1e-6 tolerance)
Public methodStatic memberEQ(Vector4, Vector4) Test if a is equal to b (within 1e-6 tolerance)
Public methodStatic memberEQ(Double, Double, Double) Test if a is equal to b (within e tolerance)
Public methodStatic memberEQ(Matrix, Matrix, Double) Test if a is equal to b (within e tolerance)
Public methodStatic memberEQ(Plane, Plane, Double) Test if a is equal to b (within e tolerance)
Public methodStatic memberEQ(Quaternion, Quaternion, Double) Test if a is equal to b (within e tolerance)
Public methodStatic memberEQ(Vector2, Vector2, Double) Test if a is equal to b (within e tolerance)
Public methodStatic memberEQ(Vector3, Vector3, Double) Test if a is equal to b (within e tolerance)
Public methodStatic memberEQ(Vector4, Vector4, Double) Test if a is equal to b (within e tolerance)
Public methodStatic memberEscapePath Join an array of path parts with a '.' escaping the following: @"\" is replaced with @"\\" @"." is replaced with @"\."
Public methodStatic memberFormat Convert a Vector3 value to a string with the given separator character.
Public methodStatic memberGE(Double, Double) Test if a is greater than or equal to b (within 1e-6 tolerance)
Public methodStatic memberGE(Double, Double, Double) Test if a is greater than or equal to b (within e tolerance)
Public methodStatic memberGetAlignMatrix(Vector3, Vector3) Get the rotation matrix needed to align the initial vector with the target vector.
Public methodStatic memberGetAlignMatrix(Vector3, Vector3, Vector3) Get the rotation matrix needed to align the initial vector with the target vector.
Public methodStatic memberGT(Double, Double) Test if a is greater than b (within 1e-6 tolerance)
Public methodStatic memberGT(Double, Double, Double) Test if a is greater than b (within e tolerance)
Public methodStatic memberIgnoreNaN If any of the elements of a Vector3 are NaN, then return Zero.
Public methodStatic memberIncreaseMagnitude Returns the value with its magnitude increased by the specified magnitude.
Public methodStatic memberIntersectCircleCircle Calculate the intersection points of two circles.
Public methodStatic memberIntersectCirclePlane Calculate the intersection points of a circle (in a given plane) and a plane (using 10^-6 as a tolerance in equality).
Public methodStatic memberIntersectCircleSphere(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).
Public methodStatic memberIntersectCircleSphere(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).
Public methodStatic memberIntersectCircleYSphere(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).
Public methodStatic memberIntersectCircleYSphere(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).
Public methodStatic memberIntersectLineLine(Vector2, Vector2, Vector2, Vector2) Calculate the intersection point of two line segments.
Public methodStatic memberIntersectLineLine(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.

Public methodStatic memberIntersectLinePlane Return intersection of line [L1,L2] with plane defined by normal N, and P being a point on the plane.
Public methodStatic memberIntersectLineSphere(Vector3, Vector3, Vector3, Double) Intersect a line with a sphere (using 10^-6 as a tolerance in equality).
Public methodStatic memberIntersectLineSphere(Vector3, Vector3, Vector3, Double, Double) Intersect a line with a sphere (using supplied epsilon as a tolerance in equality).
Public methodStatic memberIntersectPlaneSphere Calculate the intersection circle of a plane and a sphere surface.
Public methodStatic memberIntersectRayPlane Return intersection of the ray with plane defined by normal N, and P being a point on the plane.
Public methodStatic memberIntersectRaySphere Intersects a ray with a sphere.
Public methodStatic memberIntersectRayTriangle(Ray, Vector3, Vector3, Vector3, Double) Performs an intersection test between a ray and a triangle.
Public methodStatic memberIntersectRayTriangle(Ray, Vector3, Vector3, Vector3, Double) Performs an intersection test between a ray and a triangle.
Public methodStatic memberIsEmailAddressSyntaxValid Checks whether the syntax of an email address is valid (not whether the actual address exists).
Public methodStatic memberIsInfinity(Quaternion) Are any of the elements of a Quaternion a NegativeInfinity or PositiveInfinity?
Public methodStatic memberIsInfinity(Vector3) Are any of the elements of a Vector3 a NegativeInfinity or PositiveInfinity?
Public methodStatic memberIsNaN(Double) Whether any of the element of the provided array is NaN.
Public methodStatic memberIsNaN(Quaternion) Are any of the elements of a Quaternion a NaN?
Public methodStatic memberIsNaN(Vector3) Are any of the elements of a Vector3 a NaN?
Public methodStatic memberIsUnitVector Whether the vector has length approximately equal to 1.
Public methodStatic memberLE(Double, Double) Test if a is less than or equal to b (within 1e-6 tolerance)
Public methodStatic memberLE(Double, Double, Double) Test if a is less than or equal to b (within e tolerance)
Public methodStatic memberLineLineNearestPoints Finds a point on each line that determines the shortest line segment between the two lines.
Public methodStatic memberLT(Double, Double) Test if a is less than b (within 1e-6 tolerance)
Public methodStatic memberLT(Double, Double, Double) Test if a is less than b (within e tolerance)
Public methodStatic memberMaxT Return the largest element of values.
Public methodStatic memberMaxIndexT Return the index for the largest element of values.
Public methodStatic memberMidPoint 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
Public methodStatic memberMinT Return the smallest element of values.
Public methodStatic memberMinIndexT(ListT) Return the index for the smallest element of values.
Public methodStatic memberMinIndexT(T) Return the index for the smallest element of values.
Public methodStatic memberMinNonNegative Return the minimum non negative value of the two given values, or null if neither of them are non negative.
Public methodStatic memberMultiply Scale elements of a Vector3 by the corresponding elements of another Vector3.
Public methodStatic memberNE(Double, Double) Test if a is not equal to b (within 1e-6 tolerance)
Public methodStatic memberNE(Matrix, Matrix) Test if a is not equal to b (within 1e-6 tolerance)
Public methodStatic memberNE(Plane, Plane) Test if a is not equal to b (within 1e-6 tolerance)
Public methodStatic memberNE(Quaternion, Quaternion) Test if a is not equal to b (within 1e-6 tolerance)
Public methodStatic memberNE(Vector2, Vector2) Test if a is not equal to b (within 1e-6 tolerance)
Public methodStatic memberNE(Vector3, Vector3) Test if a is not equal to b (within 1e-6 tolerance)
Public methodStatic memberNE(Vector4, Vector4) Test if a is not equal to b (within 1e-6 tolerance)
Public methodStatic memberNE(Double, Double, Double) Test if a is not equal to b (within e tolerance)
Public methodStatic memberNE(Matrix, Matrix, Double) Test if a is not equal to b (within e tolerance)
Public methodStatic memberNE(Plane, Plane, Double) Test if a is not equal to b (within e tolerance)
Public methodStatic memberNE(Quaternion, Quaternion, Double) Test if a is not equal to b (within e tolerance)
Public methodStatic memberNE(Vector2, Vector2, Double) Test if a is not equal to b (within e tolerance)
Public methodStatic memberNE(Vector3, Vector3, Double) Test if a is not equal to b (within e tolerance)
Public methodStatic memberNE(Vector4, Vector4, Double) Test if a is not equal to b (within e tolerance)
Public methodStatic memberNearestPowerOf2 Round the value up to the nearest power of two.
Public methodStatic memberNormaliseWrapAroundRange Normalizes the provided value to the wrap-around range defined by the provided start and end values.
Public methodStatic memberNormalize(Vector2)Vector2 normalization - make its length be 1
Public methodStatic memberNormalize(Vector3)Vector3 normalization - make its length be 1
Public methodStatic memberNormalize02PI Change angle (in radians) to be equivalent angle in the range [0, 2 * PI].
Public methodStatic memberNormalizeMinusPiToPlusPi Change angle (in radians) to be equivalent angle in the range [-PI, PI].
Public methodStatic memberOrthonormalize(Vector3, Vector3) Makes the vector v2 orthogonal to the vector v1 and normalizes both vectors.
Public methodStatic memberOrthonormalize(Vector3, Vector3, Vector3) Makes the vector v2 orthogonal to the vector v1 and the vector v3 orthogonal to both.
Public methodStatic memberParallelComponent Finds P, the component of V that is parallel to W.
Public methodStatic memberParseVector3 Convert a string to a Vector3 with a given separator.
Public methodStatic memberPerpendicularComponent Finds P, the component of V that is perpendicular to W.
Public methodStatic memberPointBetween(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).
Public methodStatic memberPointBetween(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).
Public methodStatic memberProject Projects the vector v in the direction of the unit normal unitNormal.
Public methodStatic memberProjectedLength Calculates the length of the vector v when projected in the direction of the unit normal unitNormal.
Public methodStatic memberProjectPointToLine Projects the specified point onto the infinite line passing through the two points p1 and p2.
Public methodStatic memberProjectPointToPlane Project a point onto a plane.
Public methodStatic memberQuaternionToPitchYawRoll Convert a Quaternion rotation into Yaw (Y rotation), Pitch (X rotation) and Roll (Z rotation) values.
Public methodStatic memberRadians(Double) Convert an angle in Degrees to an angle in Radians.
Public methodStatic memberRadians(Vector3) Convert a Vector3 of angles in Degrees to angles in Radians.
Public methodStatic memberRadians(Vector3) Convert (by reference) a Vector3 of angles in Degrees to angles in Radians.
Public methodStatic memberResizeImageWithCrop Resize an image (and crop difference to maintain aspect ratio favouring the middle)
Public methodStatic memberRotationAngle Determines the (unsigned) rotation angle for the upper 3x3 rotation part of the specified matrix.
Public methodStatic memberRotationToAlign Returns a matrix that when applied to myMatrix aligns the object with the forward (X) and up (Y) axes
Public methodStatic memberSideOfPlane Return 1 for positive side (pointed at by normal), -1 for negative side, 0 if V is on plane
Public methodStatic memberSignedAngleBetweenUnitVectors Calculates the signed angle between two vectors in radians (must be unit vectors).
Public methodStatic memberSinDegrees(Double) Returns the sine of the specified (in degrees) angle.
Public methodStatic memberSinDegrees(Int32) Returns the sine of the specified (in degrees) angle.
Public methodStatic memberSinRadians Returns the sine of the specified (in radians) angle.
Public methodStatic memberSnapLowerTo(Double, Double) If given number is EQ(Double, Double) to t but less than t, make it t
Public methodStatic memberSnapLowerTo(Double, Double, Double) If given number is EQ(Double, Double, Double) to t but less than t, make it t
Public methodStatic memberSnapLowerToZero(Double) If given number is EQ(Double, Double) to 0 but less than 0, make it 0
Public methodStatic memberSnapLowerToZero(Double, Double) If given number is EQ(Double, Double, Double) to 0 but less than 0, make it 0
Public methodStatic memberSnapTo(Double, Double, Double) Return the value between [v1,v2] that is closest to 'p'
Public methodStatic memberSnapTo(Int32, Int32, Int32) Return the value between [v1,v2] that is closest to 'p'
Public methodStatic memberSnapTo(Single, Single, Single) Return the value between [v1,v2] that is closest to 'p'
Public methodStatic memberSnapTo(Vector2, Vector2, Vector2) Return the point on the line going through [v1,v2] that is closest to the point 'p'
Public methodStatic memberSnapTo(Vector3, Vector3, Vector3) Return the point on the line going through [v1,v2] that is closest to the point 'p'
Public methodStatic memberSnapToZero(Double) If given number is EQ(Double, Double) to 0, make it zero
Public methodStatic memberSnapToZero(Single) If given number is EQ(Double, Double) to 0, make it zero
Public methodStatic memberSnapToZero(Double, Double) If given number is EQ(Double, Double, Double) to 0, make it zero
Public methodStatic memberSnapToZero(Single, Single) If given number is EQ(Double, Double, Double) to 0, make it zero
Public methodStatic memberSnapUpperTo(Double, Double) If given number is EQ(Double, Double) to t but greater than t, make it t
Public methodStatic memberSnapUpperTo(Double, Double, Double) If given number is EQ(Double, Double, Double) to t but greater than t, make it t
Public methodStatic memberSnapUpperToZero(Double) If given number is EQ(Double, Double) to 0 but greater than 0, make it 0
Public methodStatic memberSnapUpperToZero(Double, Double) If given number is EQ(Double, Double, Double) to 0 but greater than 0, make it 0
Public methodStatic memberSphereIntersectsFrustum(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).

Public methodStatic memberSphereIntersectsFrustum(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).

Public methodStatic memberSphereIntersectSphere Test if Sphere a intersects with Sphere b.
Public methodStatic memberSwapT Swap two contents of two variables.
Public methodStatic memberTanDegrees(Double) Returns the tangent of the specified (in degrees) angle.
Public methodStatic memberTanDegrees(Int32) Returns the tangent of the specified (in degrees) angle.
Public methodStatic memberTanRadians Returns the tangent of the specified (in radians) angle.
Public methodStatic memberTimeOfIntersection Load and Blocker separated by distance, how long until they touch?
Public methodStatic memberTimeOfSeparation Load and blocker are touching, how long till they separate given new speeds and accelerations?
Public methodStatic memberTimeToTravel Time to travel distance given starting speed and acceleration, or null if travel not possible
Public methodStatic memberTriangleIntersectsPlane Does the supplied triangle intersect the plane.
Public methodStatic memberTriangleIntersectsTriangle Do two triangles intersect?
Public methodStatic memberTrianglePlaneIntersection Return the intersection line of a triangle and a plane.
Public methodStatic memberUnescapePath Split a '.' separated path into path parts while unescaping the following: @"\\" is replaced with @"\" @"\." is replaced with @"."
Public methodStatic memberVectorToInverseRotation Creates a rotation matrix to convert from a coordinate frame defined by a set of vectors to world coordinates.
Public methodStatic memberVectorToInverseRotationLeft Creates a rotation matrix to point opposite to a direction defined by two vectors.
Public methodStatic memberVectorToInverseRotationRight Creates a rotation matrix to point opposite to a direction defined by two vectors.
Public methodStatic memberVectorToInverseRotationUp Creates a rotation matrix to point opposite to a direction defined by two vectors.
Public methodStatic memberVectorToRotation Creates a rotation matrix to convert from world coordinates to a coordinate frame defined by a set of vectors.
Public methodStatic memberVectorToRotationLeft Creates a rotation matrix to point in a certain direction defined by two vectors.
Public methodStatic memberVectorToRotationRight Creates a rotation matrix to point in a certain direction defined by two vectors.
Public methodStatic memberVectorToRotationUp Creates a rotation matrix to point in a certain direction defined by two vectors.
Public methodStatic memberZeroNaN Return a Vector3 replacing all instances of PositiveInfinity, NegativeInfinity and NaN with 0.
Top
See Also