C# Класс UEx.Vector3X

Vector3 extensions and helper functions
Показать файл Открыть проект

Открытые методы

Метод Описание
Abs ( this v ) : Vector3

Absolute value of components

AngleAroundAxis ( Vector3 dir1, Vector3 dir2, Vector3 axis ) : float

Approx ( Vector3 val, Vector3 about, float range ) : bool

test if a Vector3 is close to another Vector3 (due to floating point inprecision) compares the square of the distance to the square of the range as this avoids calculating a square root which is much slower than squaring the range

CalculateLineLineIntersection ( Vector3 line1Point1, Vector3 line1Point2, Vector3 line2Point1, Vector3 line2Point2, Vector3 &resultSegmentPoint1, Vector3 &resultSegmentPoint2 ) : bool

Calculates the intersection line segment between 2 lines (not segments). Returns false if no solution can be found.

Center ( Vector3 vec1, Vector3 vec2 ) : Vector3

Gets the center of two points

Center ( this points ) : Vector3

FastNormalized ( this vec1 ) : Vector3

Using the magic of 0x5f3759df

IsNaN ( this vec ) : bool

Lerp ( Vector3 v1, Vector3 v2, float value ) : Vector3

Direct speedup of Vector3.Lerp

MidPoint ( this first, Vector3 second ) : Vector3

NearestPoint ( Vector3 lineStart, Vector3 lineEnd, Vector3 point ) : Vector3

Find a point on the infinite line nearest to point

NearestPointStrict ( Vector3 lineStart, Vector3 lineEnd, Vector3 point ) : Vector3

find a point on the line segment nearest to point

ProjectOntoPlane ( this v, Vector3 planeNormal ) : Vector3

Vector3.Project, onto a plane

RandomDirection ( float spread, Vector3 forward ) : Vector3

Returns a random direction in a cone. a spread of 0 is straight, 0.5 is 180*

Sinerp ( Vector3 from, Vector3 to, float value ) : Vector3
SqrDistance ( this first, Vector3 second ) : float

gets the square distance between two vector3 positions. this is much faster that Vector3.distance.

SqrLineDistance ( this point, Vector3 lineP1, Vector3 lineP2, int &closestPoint ) : float

get the square distance from a point to a line segment.

Vector3Normal ( Vector3 vec1, Vector3 vec2, Vector3 vec3 ) : Vector3

Gets the normal of the triangle formed by the 3 vectors

Описание методов

Abs() публичный статический Метод

Absolute value of components
public static Abs ( this v ) : Vector3
v this
Результат UnityEngine.Vector3

AngleAroundAxis() публичный статический Метод

public static AngleAroundAxis ( Vector3 dir1, Vector3 dir2, Vector3 axis ) : float
dir1 UnityEngine.Vector3
dir2 UnityEngine.Vector3
axis UnityEngine.Vector3
Результат float

Approx() публичный статический Метод

test if a Vector3 is close to another Vector3 (due to floating point inprecision) compares the square of the distance to the square of the range as this avoids calculating a square root which is much slower than squaring the range
public static Approx ( Vector3 val, Vector3 about, float range ) : bool
val UnityEngine.Vector3
about UnityEngine.Vector3
range float
Результат bool

CalculateLineLineIntersection() публичный статический Метод

Calculates the intersection line segment between 2 lines (not segments). Returns false if no solution can be found.
public static CalculateLineLineIntersection ( Vector3 line1Point1, Vector3 line1Point2, Vector3 line2Point1, Vector3 line2Point2, Vector3 &resultSegmentPoint1, Vector3 &resultSegmentPoint2 ) : bool
line1Point1 UnityEngine.Vector3
line1Point2 UnityEngine.Vector3
line2Point1 UnityEngine.Vector3
line2Point2 UnityEngine.Vector3
resultSegmentPoint1 UnityEngine.Vector3
resultSegmentPoint2 UnityEngine.Vector3
Результат bool

Center() публичный статический Метод

Gets the center of two points
public static Center ( Vector3 vec1, Vector3 vec2 ) : Vector3
vec1 UnityEngine.Vector3
vec2 UnityEngine.Vector3
Результат UnityEngine.Vector3

Center() публичный статический Метод

public static Center ( this points ) : Vector3
points this
Результат UnityEngine.Vector3

FastNormalized() публичный статический Метод

Using the magic of 0x5f3759df
public static FastNormalized ( this vec1 ) : Vector3
vec1 this
Результат UnityEngine.Vector3

IsNaN() публичный статический Метод

public static IsNaN ( this vec ) : bool
vec this
Результат bool

Lerp() публичный статический Метод

Direct speedup of Vector3.Lerp
public static Lerp ( Vector3 v1, Vector3 v2, float value ) : Vector3
v1 UnityEngine.Vector3
v2 UnityEngine.Vector3
value float
Результат UnityEngine.Vector3

MidPoint() публичный статический Метод

public static MidPoint ( this first, Vector3 second ) : Vector3
first this
second UnityEngine.Vector3
Результат UnityEngine.Vector3

NearestPoint() публичный статический Метод

Find a point on the infinite line nearest to point
public static NearestPoint ( Vector3 lineStart, Vector3 lineEnd, Vector3 point ) : Vector3
lineStart UnityEngine.Vector3
lineEnd UnityEngine.Vector3
point UnityEngine.Vector3
Результат UnityEngine.Vector3

NearestPointStrict() публичный статический Метод

find a point on the line segment nearest to point
public static NearestPointStrict ( Vector3 lineStart, Vector3 lineEnd, Vector3 point ) : Vector3
lineStart UnityEngine.Vector3
lineEnd UnityEngine.Vector3
point UnityEngine.Vector3
Результат UnityEngine.Vector3

ProjectOntoPlane() публичный статический Метод

Vector3.Project, onto a plane
public static ProjectOntoPlane ( this v, Vector3 planeNormal ) : Vector3
v this
planeNormal UnityEngine.Vector3
Результат UnityEngine.Vector3

RandomDirection() публичный статический Метод

Returns a random direction in a cone. a spread of 0 is straight, 0.5 is 180*
public static RandomDirection ( float spread, Vector3 forward ) : Vector3
spread float
forward UnityEngine.Vector3 must be unit
Результат UnityEngine.Vector3

Sinerp() публичный статический Метод

public static Sinerp ( Vector3 from, Vector3 to, float value ) : Vector3
from UnityEngine.Vector3
to UnityEngine.Vector3
value float
Результат UnityEngine.Vector3

SqrDistance() публичный статический Метод

gets the square distance between two vector3 positions. this is much faster that Vector3.distance.
public static SqrDistance ( this first, Vector3 second ) : float
first this first point
second UnityEngine.Vector3 second point
Результат float

SqrLineDistance() публичный статический Метод

get the square distance from a point to a line segment.
public static SqrLineDistance ( this point, Vector3 lineP1, Vector3 lineP2, int &closestPoint ) : float
point this point to get distance to
lineP1 UnityEngine.Vector3 line segment start point
lineP2 UnityEngine.Vector3 line segment end point
closestPoint int set to either 1, 2, or 4, determining which end the point is closest to (p1, p2, or the middle)
Результат float

Vector3Normal() публичный статический Метод

Gets the normal of the triangle formed by the 3 vectors
public static Vector3Normal ( Vector3 vec1, Vector3 vec2, Vector3 vec3 ) : Vector3
vec1 UnityEngine.Vector3
vec2 UnityEngine.Vector3
vec3 UnityEngine.Vector3
Результат UnityEngine.Vector3