Class XMVector4
The 4D vector functions provided by DirectXMath.
Inherited Members
Namespace: JeremyAnsel.DirectX.DXMath
Assembly: JeremyAnsel.DirectX.DXMath.dll
Syntax
public static class XMVector4
Methods
| Edit this page View SourceAngleBetweenNormals(XMVector, XMVector)
Compute the radian angle between two normalized 4D vectors.
Declaration
public static XMVector AngleBetweenNormals(XMVector n1, XMVector n2)
Parameters
Type | Name | Description |
---|---|---|
XMVector | n1 | The first normalized vector. |
XMVector | n2 | The second normalized vector. |
Returns
Type | Description |
---|---|
XMVector | Returns a vector. The radian angle between N1 and N2 is replicated to each of the components. |
AngleBetweenNormalsEst(XMVector, XMVector)
Estimates the radian angle between two normalized 4D vectors.
Declaration
public static XMVector AngleBetweenNormalsEst(XMVector n1, XMVector n2)
Parameters
Type | Name | Description |
---|---|---|
XMVector | n1 | The first normalized vector. |
XMVector | n2 | The second normalized vector. |
Returns
Type | Description |
---|---|
XMVector | Returns a vector. The estimate of the radian angle (between N1 and N2) is replicated to each of the components. |
AngleBetweenVectors(XMVector, XMVector)
Compute the radian angle between two 4D vectors.
Declaration
public static XMVector AngleBetweenVectors(XMVector v1, XMVector v2)
Parameters
Type | Name | Description |
---|---|---|
XMVector | v1 | The first vector. |
XMVector | v2 | The second vector. |
Returns
Type | Description |
---|---|
XMVector | Returns a vector. The radian angle between V1 and V2 is replicated to each of the components. |
ClampLength(XMVector, float, float)
Clamps the length of a 4D vector to a given range.
Declaration
public static XMVector ClampLength(XMVector v, float lengthMin, float lengthMax)
Parameters
Type | Name | Description |
---|---|---|
XMVector | v | The vector. |
float | lengthMin | The minimum clamp length. |
float | lengthMax | The maximum clamp length. |
Returns
Type | Description |
---|---|
XMVector | Returns a 4D vector whose length is clamped to the specified minimum and maximum. |
ClampLengthV(XMVector, XMVector, XMVector)
Clamps the length of a 4D vector to a given range.
Declaration
public static XMVector ClampLengthV(XMVector v, XMVector lengthMin, XMVector lengthMax)
Parameters
Type | Name | Description |
---|---|---|
XMVector | v | The vector. |
XMVector | lengthMin | A 4D vector, all of whose components are equal to the minimum clamp length. The components must be greater-than-or-equal to zero. |
XMVector | lengthMax | A 4D vector, all of whose components are equal to the maximum clamp length. The components must be greater-than-or-equal to zero. |
Returns
Type | Description |
---|---|
XMVector | Returns a 4D vector whose length is clamped to the specified minimum and maximum. |
Cross(XMVector, XMVector, XMVector)
Computes the 4D cross product.
Declaration
public static XMVector Cross(XMVector v1, XMVector v2, XMVector v3)
Parameters
Type | Name | Description |
---|---|---|
XMVector | v1 | The first vector. |
XMVector | v2 | The second vector. |
XMVector | v3 | The third vector. |
Returns
Type | Description |
---|---|
XMVector | Returns the 4D cross product of V1, V2, and V3. |
Dot(XMVector, XMVector)
Computes the dot product between 4D vectors.
Declaration
public static XMVector Dot(XMVector v1, XMVector v2)
Parameters
Type | Name | Description |
---|---|---|
XMVector | v1 | The first vector. |
XMVector | v2 | The second vector. |
Returns
Type | Description |
---|---|
XMVector | Returns a vector. The dot product between V1 and V2 is replicated into each component. |
Equal(XMVector, XMVector)
Tests whether two 4D vectors are equal.
Declaration
public static bool Equal(XMVector v1, XMVector v2)
Parameters
Type | Name | Description |
---|---|---|
XMVector | v1 | The first vector. |
XMVector | v2 | The second vector. |
Returns
Type | Description |
---|---|
bool | Returns true if the 4D vectors are equal and false otherwise. |
EqualInt(XMVector, XMVector)
Tests whether two 4D vectors are equal, treating each component as an unsigned integer.
Declaration
public static bool EqualInt(XMVector v1, XMVector v2)
Parameters
Type | Name | Description |
---|---|---|
XMVector | v1 | The first vector. |
XMVector | v2 | The second vector. |
Returns
Type | Description |
---|---|
bool | Returns true if the 4D vectors are equal and false otherwise. |
EqualIntR(XMVector, XMVector)
Tests whether two 4D vectors are equal, treating each component as an unsigned integer. In addition, this function returns a comparison value.
Declaration
public static XMComparisonRecord EqualIntR(XMVector v1, XMVector v2)
Parameters
Type | Name | Description |
---|---|---|
XMVector | v1 | The first vector. |
XMVector | v2 | The second vector. |
Returns
Type | Description |
---|---|
XMComparisonRecord | Returns a comparison value. |
EqualR(XMVector, XMVector)
Tests whether two 4D vectors are equal. In addition, this function returns a comparison value.
Declaration
public static XMComparisonRecord EqualR(XMVector v1, XMVector v2)
Parameters
Type | Name | Description |
---|---|---|
XMVector | v1 | The first vector. |
XMVector | v2 | The second vector. |
Returns
Type | Description |
---|---|
XMComparisonRecord | Returns a comparison value. |
Greater(XMVector, XMVector)
Tests whether one 4D vector is greater than another 4D vector.
Declaration
public static bool Greater(XMVector v1, XMVector v2)
Parameters
Type | Name | Description |
---|---|---|
XMVector | v1 | The first vector. |
XMVector | v2 | The second vector. |
Returns
Type | Description |
---|---|
bool | Returns true if V1 is greater than V2 and false otherwise. |
GreaterOrEqual(XMVector, XMVector)
Tests whether one 4D vector is greater-than-or-equal-to another 4D vector.
Declaration
public static bool GreaterOrEqual(XMVector v1, XMVector v2)
Parameters
Type | Name | Description |
---|---|---|
XMVector | v1 | The first vector. |
XMVector | v2 | The second vector. |
Returns
Type | Description |
---|---|
bool | Returns true if V1 is greater-than-or-equal-to V2 and false otherwise. |
GreaterOrEqualR(XMVector, XMVector)
Tests whether one 4D vector is greater-than-or-equal-to another 4D vector and returns a comparison value.
Declaration
public static XMComparisonRecord GreaterOrEqualR(XMVector v1, XMVector v2)
Parameters
Type | Name | Description |
---|---|---|
XMVector | v1 | The first vector. |
XMVector | v2 | The second vector. |
Returns
Type | Description |
---|---|
XMComparisonRecord | Returns a comparison value. |
GreaterR(XMVector, XMVector)
Tests whether one 4D vector is greater than another 4D vector and returns a comparison value.
Declaration
public static XMComparisonRecord GreaterR(XMVector v1, XMVector v2)
Parameters
Type | Name | Description |
---|---|---|
XMVector | v1 | The first vector. |
XMVector | v2 | The second vector. |
Returns
Type | Description |
---|---|
XMComparisonRecord | Returns a comparison value. |
InBounds(XMVector, XMVector)
Tests whether the components of a 4D vector are within set bounds.
Declaration
public static bool InBounds(XMVector v, XMVector bounds)
Parameters
Type | Name | Description |
---|---|---|
XMVector | v | The vector to test. |
XMVector | bounds | The vector that determines the bounds. |
Returns
Type | Description |
---|---|
bool | Returns true if all of the components of V are within the set bounds, and false otherwise. |
IsInfinite(XMVector)
Tests whether any component of a 4D vector is positive or negative infinity.
Declaration
public static bool IsInfinite(XMVector v)
Parameters
Type | Name | Description |
---|---|---|
XMVector | v | The vector. |
Returns
Type | Description |
---|---|
bool | Returns true if any component of V is positive or negative infinity, and false otherwise. |
IsNaN(XMVector)
Tests whether any component of a 4D vector is a NaN.
Declaration
public static bool IsNaN(XMVector v)
Parameters
Type | Name | Description |
---|---|---|
XMVector | v | The vector. |
Returns
Type | Description |
---|---|
bool | Returns true if any component of V is a NaN, and false otherwise. |
Length(XMVector)
Computes the length of a 4D vector.
Declaration
public static XMVector Length(XMVector v)
Parameters
Type | Name | Description |
---|---|---|
XMVector | v | The vector. |
Returns
Type | Description |
---|---|
XMVector | Returns a vector. The length of V is replicated into each component. |
LengthEst(XMVector)
Estimates the length of a 4D vector.
Declaration
public static XMVector LengthEst(XMVector v)
Parameters
Type | Name | Description |
---|---|---|
XMVector | v | The vector. |
Returns
Type | Description |
---|---|
XMVector | Returns a vector, each of whose components are estimates of the length of V. |
LengthSquare(XMVector)
Computes the square of the length of a 4D vector.
Declaration
public static XMVector LengthSquare(XMVector v)
Parameters
Type | Name | Description |
---|---|---|
XMVector | v | The vector. |
Returns
Type | Description |
---|---|
XMVector | Returns a vector. The square of the length of V is replicated into each component. |
Less(XMVector, XMVector)
Tests whether one 4D vector is less than another 4D vector.
Declaration
public static bool Less(XMVector v1, XMVector v2)
Parameters
Type | Name | Description |
---|---|---|
XMVector | v1 | The first vector. |
XMVector | v2 | The second vector. |
Returns
Type | Description |
---|---|
bool | Returns true if V1 is less than V2 and false otherwise. |
LessOrEqual(XMVector, XMVector)
Tests whether one 4D vector is less-than-or-equal-to another 4D vector.
Declaration
public static bool LessOrEqual(XMVector v1, XMVector v2)
Parameters
Type | Name | Description |
---|---|---|
XMVector | v1 | The first vector. |
XMVector | v2 | The second vector. |
Returns
Type | Description |
---|---|
bool | Returns true if V1 is less-than-or-equal-to V2, and false otherwise. |
NearEqual(XMVector, XMVector, XMVector)
Tests whether one 4D vector is near another 4D vector.
Declaration
public static bool NearEqual(XMVector v1, XMVector v2, XMVector epsilon)
Parameters
Type | Name | Description |
---|---|---|
XMVector | v1 | The first vector. |
XMVector | v2 | The second vector. |
XMVector | epsilon | The tolerance value used for judging equality. |
Returns
Type | Description |
---|---|
bool | Returns true if V1 is near V2 and false otherwise. |
Normalize(XMVector)
Returns the normalized version of a 4D vector.
Declaration
public static XMVector Normalize(XMVector v)
Parameters
Type | Name | Description |
---|---|---|
XMVector | v | The vector. |
Returns
Type | Description |
---|---|
XMVector | Returns the normalized version of V. |
NormalizeEst(XMVector)
Estimates the normalized version of a 4D vector.
Declaration
public static XMVector NormalizeEst(XMVector v)
Parameters
Type | Name | Description |
---|---|---|
XMVector | v | The vector. |
Returns
Type | Description |
---|---|
XMVector | Returns an estimate of the normalized version of V. |
NotEqual(XMVector, XMVector)
Tests whether two 4D vectors are not equal.
Declaration
public static bool NotEqual(XMVector v1, XMVector v2)
Parameters
Type | Name | Description |
---|---|---|
XMVector | v1 | The first vector. |
XMVector | v2 | The second vector. |
Returns
Type | Description |
---|---|
bool | Returns true if the 4D vectors are not equal and false otherwise. |
NotEqualInt(XMVector, XMVector)
Test whether two 4D vectors are not equal, treating each component as an unsigned integer.
Declaration
public static bool NotEqualInt(XMVector v1, XMVector v2)
Parameters
Type | Name | Description |
---|---|---|
XMVector | v1 | The first vector. |
XMVector | v2 | The second vector. |
Returns
Type | Description |
---|---|
bool | Returns true if the 4D vectors are not equal and false otherwise. |
Orthogonal(XMVector)
Computes a vector perpendicular to a 4D vector.
Declaration
public static XMVector Orthogonal(XMVector v)
Parameters
Type | Name | Description |
---|---|---|
XMVector | v | The vector. |
Returns
Type | Description |
---|---|
XMVector | Returns the 4D vector orthogonal to V. |
ReciprocalLength(XMVector)
Computes the reciprocal of the length of a 4D vector.
Declaration
public static XMVector ReciprocalLength(XMVector v)
Parameters
Type | Name | Description |
---|---|---|
XMVector | v | he vector. |
Returns
Type | Description |
---|---|
XMVector | Returns the reciprocal of the length of V. |
ReciprocalLengthEst(XMVector)
Estimates the reciprocal of the length of a 4D vector.
Declaration
public static XMVector ReciprocalLengthEst(XMVector v)
Parameters
Type | Name | Description |
---|---|---|
XMVector | v | The vector. |
Returns
Type | Description |
---|---|
XMVector | Returns a vector, each of whose components are estimates of the reciprocal of the length of V. |
Reflect(XMVector, XMVector)
Reflects an incident 4D vector across a 4D normal vector.
Declaration
public static XMVector Reflect(XMVector incident, XMVector normal)
Parameters
Type | Name | Description |
---|---|---|
XMVector | incident | The incident vector to reflect. |
XMVector | normal | The normal vector to reflect the incident vector across. |
Returns
Type | Description |
---|---|
XMVector | Returns the reflected incident angle. |
Refract(XMVector, XMVector, float)
Refracts an incident 4D vector across a 4D normal vector.
Declaration
public static XMVector Refract(XMVector incident, XMVector normal, float refractionIndex)
Parameters
Type | Name | Description |
---|---|---|
XMVector | incident | The incident vector to refract. |
XMVector | normal | The normal vector to refract the incident vector through. |
float | refractionIndex | The index of refraction. |
Returns
Type | Description |
---|---|
XMVector | Returns the refracted incident vector. |
RefractV(XMVector, XMVector, XMVector)
Refracts an incident 4D vector across a 4D normal vector.
Declaration
public static XMVector RefractV(XMVector incident, XMVector normal, XMVector refractionIndex)
Parameters
Type | Name | Description |
---|---|---|
XMVector | incident | The incident vector to refract. |
XMVector | normal | The normal vector to refract the incident vector through. |
XMVector | refractionIndex | A 4D vector, all of whose components are equal to the index of refraction. |
Returns
Type | Description |
---|---|
XMVector | Returns the refracted incident vector. |
Transform(XMVector, XMMatrix)
Transforms a 4D vector by a matrix.
Declaration
public static XMVector Transform(XMVector v, XMMatrix m)
Parameters
Type | Name | Description |
---|---|---|
XMVector | v | The vector. |
XMMatrix | m | The transformation matrix. |
Returns
Type | Description |
---|---|
XMVector | Returns the transformed vector. |