編集

次の方法で共有


MathUtilities Class

Definition

Math Utilities class.

public ref class MathUtilities abstract sealed
public static class MathUtilities
type MathUtilities = class
Public Class MathUtilities
Inheritance
MathUtilities

Methods

Add(Matrix4x4, Matrix4x4)

Element-wise addition of two Matrix4x4s - extension method

AngularScaleFromDistance(Single, Single)
CLampLerp(Single, Single, Single, Single)

Clamps via a lerp for a "soft" clamp effect

ClosestPointOnLineSegmentToPoint(Vector3, Vector3, Vector3)
ClosestPointOnLineToPoint(Vector3, Vector3, Vector3)
DegreesToRadians(Double)

Convert degrees to radians.

DistanceOfPointToLine(Ray, Vector3)

find unsigned distance of 3D point to an infinite line

DistanceOfPointToLine(Vector3, Vector3, Vector3)

Returns the distance between a point and an infinite line defined by two points; linePointA and linePointB

DistanceOfPointToLineSegment(Vector3, Vector3, Vector3)
GetAngleBetween(Vector2, Vector2)

Calculates the angle (at pointA) between two, two-dimensional points.

GetDirection(Quaternion)

Calculates the direction vector from a rotation.

InRange(Vector2, Vector2, Vector2)

Tests component-wise if a Vector2 is in a given range

InRange(Vector3, Vector3, Vector3)

Tests component-wise if a Vector3 is in a given range

IsInFOV(Vector3, Transform, Single, Single, Single, Single)

Returns if a point lies within a frame of reference view as defined by arguments

IsInFOVCone(Transform, Vector3, Single, Single, Single)

Returns true if a point lies inside the cone described with given parameters, false otherwise. The cone is inscribed to a radius equal to the vertical height of the provided FOV. The test also ensures the distance from the point to the cone lies within the given range.

NearestPointToLines(Ray, Ray)

Find 3D point that minimizes distance to 2 lines, midpoint of the shortest perpendicular line segment between them

NearestPointToLinesLeastSquares(IEnumerable<Ray>)

Find 3D point that minimizes distance to a set of 2 or more lines

NearestPointToLinesRANSAC(List<Ray>, Int32, Single, Int32)

Find 3D point that minimizes distance to a set of 2 or more lines, ignoring outliers

QuaternionFromMatrix(Matrix4x4)

Creates a quaternion containing the rotation from the input matrix.

RadiansToDegrees(Single)

Convert radians to degrees.

ScaleFromAngularSizeAndDistance(Single, Single)

Retrieve angular measurement describing how large a sphere or circle appears from a given point of view. Takes an angle (at given point of view) and a distance and returns the actual diameter of the object.

Subtract(Matrix4x4, Matrix4x4)

Element-wise subtraction of two Matrix4x4s - extension method

TestPlanesAABB(Plane[], Int32, Bounds, Boolean)
ToTranslationRotation(Matrix4x4, Vector3, Quaternion)

Extract the translation and rotation components of a Unity matrix

TransformDirectionFromTo(Transform, Transform, Vector3)

Takes a direction in the coordinate space specified by the "from" transform and transforms it to be the correct direction in the coordinate space specified by the "to" transform applies rotation only, no translation or scale

TransformPointFromTo(Transform, Transform, Vector3)

Takes a point in the coordinate space specified by the "from" transform and transforms it to be the correct point in the coordinate space specified by the "to" transform applies rotation, scale and translation.

TransformRayFromTo(Transform, Transform, Ray)

Takes a ray in the coordinate space specified by the "from" transform and transforms it to be the correct ray in the coordinate space specified by the "to" transform

TransformVectorFromTo(Transform, Transform, Vector3)

Takes a vector in the coordinate space specified by the "from" transform and transforms it to be the correct direction in the coordinate space specified by the "to" transform applies rotation and scale, no translation

XYProject(Vector3)

Project vector onto XY plane

XZProject(Vector3)

Project vector onto XZ plane

YZProject(Vector3)

Project vector onto YZ plane

Applies to