C# Class HoloToolkit.Sharing.Utilities.MathUtils

Afficher le fichier Open project: OpenHID/InteractivePaint

Méthodes publiques

Méthode Description
Add ( Matrix4x4 a, Matrix4x4 b ) : Matrix4x4

Element-wise addition of two Matrix4x4s - extension method

ClosestPointOnLineSegmentToPoint ( Vector3 point, Vector3 lineStart, Vector3 lineEnd ) : Vector3
ClosestPointOnLineToPoint ( Vector3 point, Vector3 linePointA, Vector3 linePointB ) : Vector3
DistanceOfPointToLine ( Ray ray, Vector3 point ) : float

find unsigned distance of 3D point to an infinite line

DistanceOfPointToLine ( Vector3 point, Vector3 linePointA, Vector3 linePointB ) : float

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

DistanceOfPointToLineSegment ( Vector3 point, Vector3 lineStart, Vector3 lineEnd ) : float
GetHorizontalFieldOfViewRadians ( ) : float

Get the horizontal FOV from the stereo camera

InRange ( Vector2 vec, Vector2 lower, Vector2 upper ) : bool

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

InRange ( Vector3 vec, Vector3 lower, Vector3 upper ) : bool

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

IsInFOV ( Vector3 position ) : bool

Returns if a point will be rendered on the screen in either eye

NearestPointToLines ( Ray p, Ray q ) : Vector3

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

NearestPointToLinesLeastSquares ( IEnumerable rays ) : Vector3

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

NearestPointToLinesRANSAC ( List rays, int ransac_iterations, float ransac_threshold, int &numActualInliers ) : Vector3

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

QuaternionFromMatrix ( Matrix4x4 m ) : Quaternion

Creates a quaternion containing the rotation from the input matrix.

Subtract ( Matrix4x4 a, Matrix4x4 b ) : Matrix4x4

Element-wise subtraction of two Matrix4x4s - extension method

TestPlanesAABB ( Plane planes, int planeMask, Bounds bounds, bool &entirelyInside ) : bool
ToTranslationRotation ( Matrix4x4 unityMtx, Vector3 &translation, Quaternion &rotation ) : void

Extract the translation and rotation components of a Unity matrix

TransformDirectionFromTo ( Transform from, Transform to, Vector3 dirInFrom ) : 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 from, Transform to, Vector3 ptInFrom ) : 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 from, Transform to, Ray rayToConvert ) : 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 from, Transform to, Vector3 vecInFrom ) : Vector3

Takes a vectpr 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 v ) : Vector3

Project vector onto XY plane

XZProject ( Vector3 v ) : Vector3

Project vector onto XZ plane

YZProject ( Vector3 v ) : Vector3

Project vector onto YZ plane

Method Details

Add() public static méthode

Element-wise addition of two Matrix4x4s - extension method
public static Add ( Matrix4x4 a, Matrix4x4 b ) : Matrix4x4
a UnityEngine.Matrix4x4 matrix
b UnityEngine.Matrix4x4 matrix
Résultat UnityEngine.Matrix4x4

ClosestPointOnLineSegmentToPoint() public static méthode

public static ClosestPointOnLineSegmentToPoint ( Vector3 point, Vector3 lineStart, Vector3 lineEnd ) : Vector3
point UnityEngine.Vector3
lineStart UnityEngine.Vector3
lineEnd UnityEngine.Vector3
Résultat UnityEngine.Vector3

ClosestPointOnLineToPoint() public static méthode

public static ClosestPointOnLineToPoint ( Vector3 point, Vector3 linePointA, Vector3 linePointB ) : Vector3
point UnityEngine.Vector3
linePointA UnityEngine.Vector3
linePointB UnityEngine.Vector3
Résultat UnityEngine.Vector3

DistanceOfPointToLine() public static méthode

find unsigned distance of 3D point to an infinite line
public static DistanceOfPointToLine ( Ray ray, Vector3 point ) : float
ray UnityEngine.Ray ray that specifies an infinite line
point UnityEngine.Vector3 3D point
Résultat float

DistanceOfPointToLine() public static méthode

Returns the distance between a point and an infinite line defined by two points; linePointA and linePointB
public static DistanceOfPointToLine ( Vector3 point, Vector3 linePointA, Vector3 linePointB ) : float
point UnityEngine.Vector3
linePointA UnityEngine.Vector3
linePointB UnityEngine.Vector3
Résultat float

DistanceOfPointToLineSegment() public static méthode

public static DistanceOfPointToLineSegment ( Vector3 point, Vector3 lineStart, Vector3 lineEnd ) : float
point UnityEngine.Vector3
lineStart UnityEngine.Vector3
lineEnd UnityEngine.Vector3
Résultat float

GetHorizontalFieldOfViewRadians() public static méthode

Get the horizontal FOV from the stereo camera
public static GetHorizontalFieldOfViewRadians ( ) : float
Résultat float

InRange() public static méthode

Tests component-wise if a Vector2 is in a given range
public static InRange ( Vector2 vec, Vector2 lower, Vector2 upper ) : bool
vec UnityEngine.Vector2 The vector to test
lower UnityEngine.Vector2 The lower bounds
upper UnityEngine.Vector2 The upper bounds
Résultat bool

InRange() public static méthode

Tests component-wise if a Vector3 is in a given range
public static InRange ( Vector3 vec, Vector3 lower, Vector3 upper ) : bool
vec UnityEngine.Vector3 The vector to test
lower UnityEngine.Vector3 The lower bounds
upper UnityEngine.Vector3 The upper bounds
Résultat bool

IsInFOV() public static méthode

Returns if a point will be rendered on the screen in either eye
public static IsInFOV ( Vector3 position ) : bool
position UnityEngine.Vector3
Résultat bool

NearestPointToLines() public static méthode

Find 3D point that minimizes distance to 2 lines, midpoint of the shortest perpendicular line segment between them
public static NearestPointToLines ( Ray p, Ray q ) : Vector3
p UnityEngine.Ray ray that specifies a line
q UnityEngine.Ray ray that specifies a line
Résultat UnityEngine.Vector3

NearestPointToLinesLeastSquares() public static méthode

Find 3D point that minimizes distance to a set of 2 or more lines
public static NearestPointToLinesLeastSquares ( IEnumerable rays ) : Vector3
rays IEnumerable each ray specifies an infinite line
Résultat UnityEngine.Vector3

NearestPointToLinesRANSAC() public static méthode

Find 3D point that minimizes distance to a set of 2 or more lines, ignoring outliers
public static NearestPointToLinesRANSAC ( List rays, int ransac_iterations, float ransac_threshold, int &numActualInliers ) : Vector3
rays List list of rays, each specifying a line, must have at least 1
ransac_iterations int number of iterations: log(1-p)/log(1-(1-E)^s) /// where p is probability of at least one sample containing s points is all inliers /// E is proportion of outliers (1-ransac_ratio) /// e.g. p=0.999, ransac_ratio=0.54, s=2 ==> log(0.001)/(log(1-0.54^2) = 20 ///
ransac_threshold float minimum distance from point to line for a line to be considered an inlier
numActualInliers int return number of inliers: lines that are within ransac_threshold of nearest point
Résultat UnityEngine.Vector3

QuaternionFromMatrix() public static méthode

Creates a quaternion containing the rotation from the input matrix.
public static QuaternionFromMatrix ( Matrix4x4 m ) : Quaternion
m UnityEngine.Matrix4x4 Input matrix to convert to quaternion
Résultat UnityEngine.Quaternion

Subtract() public static méthode

Element-wise subtraction of two Matrix4x4s - extension method
public static Subtract ( Matrix4x4 a, Matrix4x4 b ) : Matrix4x4
a UnityEngine.Matrix4x4 matrix
b UnityEngine.Matrix4x4 matrix
Résultat UnityEngine.Matrix4x4

TestPlanesAABB() public static méthode

public static TestPlanesAABB ( Plane planes, int planeMask, Bounds bounds, bool &entirelyInside ) : bool
planes UnityEngine.Plane
planeMask int
bounds UnityEngine.Bounds
entirelyInside bool
Résultat bool

ToTranslationRotation() public static méthode

Extract the translation and rotation components of a Unity matrix
public static ToTranslationRotation ( Matrix4x4 unityMtx, Vector3 &translation, Quaternion &rotation ) : void
unityMtx UnityEngine.Matrix4x4
translation UnityEngine.Vector3
rotation UnityEngine.Quaternion
Résultat void

TransformDirectionFromTo() public static méthode

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
public static TransformDirectionFromTo ( Transform from, Transform to, Vector3 dirInFrom ) : Vector3
from UnityEngine.Transform
to UnityEngine.Transform
dirInFrom UnityEngine.Vector3
Résultat UnityEngine.Vector3

TransformPointFromTo() public static méthode

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
public static TransformPointFromTo ( Transform from, Transform to, Vector3 ptInFrom ) : Vector3
from UnityEngine.Transform
to UnityEngine.Transform
ptInFrom UnityEngine.Vector3
Résultat UnityEngine.Vector3

TransformRayFromTo() public static méthode

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
public static TransformRayFromTo ( Transform from, Transform to, Ray rayToConvert ) : Ray
from UnityEngine.Transform
to UnityEngine.Transform
rayToConvert UnityEngine.Ray
Résultat UnityEngine.Ray

TransformVectorFromTo() public static méthode

Takes a vectpr 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
public static TransformVectorFromTo ( Transform from, Transform to, Vector3 vecInFrom ) : Vector3
from UnityEngine.Transform
to UnityEngine.Transform
vecInFrom UnityEngine.Vector3
Résultat UnityEngine.Vector3

XYProject() public static méthode

Project vector onto XY plane
public static XYProject ( Vector3 v ) : Vector3
v UnityEngine.Vector3
Résultat UnityEngine.Vector3

XZProject() public static méthode

Project vector onto XZ plane
public static XZProject ( Vector3 v ) : Vector3
v UnityEngine.Vector3
Résultat UnityEngine.Vector3

YZProject() public static méthode

Project vector onto YZ plane
public static YZProject ( Vector3 v ) : Vector3
v UnityEngine.Vector3
Résultat UnityEngine.Vector3