VectorExtensions Class
Additional methods for Mono.Simd.Vector4f.
Syntax
public static class VectorExtensions
Remarks
Requirements
Namespace: Sansar
Assembly: Sansar.Script (in Sansar.Script.dll)
Assembly Versions: 1.0.0.0
Assembly: Sansar.Script (in Sansar.Script.dll)
Assembly Versions: 1.0.0.0
Members
See Also: Inherited members from object.
Public Methods
static
|
Cos (this Mono.Simd.Vector4f) : Mono.Simd.Vector4f
Returns the approximate cosine of the four floats in the vector. |
|
static
|
CosSlow (this Mono.Simd.Vector4f) : Mono.Simd.Vector4f
Returns the cosine each element of the vector. |
|
static
|
SelectWithMask (this Mono.Simd.Vector4i, Mono.Simd.Vector4f, Mono.Simd.Vector4f) : Mono.Simd.Vector4f
Creates a new vector4f from the given vectors, selecting a component from sourceIfTrue if the corresponding component in the mask is -1 and from sourceIfFalse if 0. |
|
static
|
Sin (this Mono.Simd.Vector4f) : Mono.Simd.Vector4f
Returns the approximate sine of the four floats in the vector. |
|
static
|
SinSlow (this Mono.Simd.Vector4f) : Mono.Simd.Vector4f
Returns the sine each element of the vector. |
|
static
|
SinZeroPiOverTwo (this Mono.Simd.Vector4f) : Mono.Simd.Vector4f
Returns the approximate sine of each element in the vector. |
Member Details
Cos Method
Returns the approximate cosine of the four floats in the vector.Syntax
public static Mono.Simd.Vector4f Cos (this Mono.Simd.Vector4f x)Parameters
- x
- A vector of 4 floats.
Returns
The approximate cosine of each element.Remarks
Requirements
Namespace: Sansar
Assembly: Sansar.Script (in Sansar.Script.dll)
Assembly Versions: 1.0.0.0
CosSlow Method
Returns the cosine each element of the vector.Syntax
public static Mono.Simd.Vector4f CosSlow (this Mono.Simd.Vector4f v1)Parameters
- v1
- A vector of 4 floats.
Returns
The cosine of each element.Remarks
Uses Math.Cos(double). The results are more accurate than VectorExtensions.Cos(Mono.Simd.Vector4f) but take approximately 3x the time to calculate.Requirements
Namespace: Sansar
Assembly: Sansar.Script (in Sansar.Script.dll)
Assembly Versions: 1.0.0.0
SelectWithMask Method
Creates a new vector4f from the given vectors, selecting a component from sourceIfTrue if the corresponding component in the mask is -1 and from sourceIfFalse if 0.Syntax
public static Mono.Simd.Vector4f SelectWithMask (this Mono.Simd.Vector4i mask, Mono.Simd.Vector4f sourceIfTrue, Mono.Simd.Vector4f sourceIfFalse)Parameters
- mask
- The mask vector.
- sourceIfTrue
- The vector containing the elements that are selected if the mask is true.
- sourceIfFalse
- The vector containing the elements that are selected if the maks is false.
Returns
A new vector with elements selected from the source vectors based on the mask.Remarks
Each element in the mask must be 0 or -1 or the results are undefined. Courtesy of Mark++, http://markplusplus.wordpress.com/2007/03/14/fast-sse-select-operation/
C# Example Vector4f left = new Vector4f(1, 2, 3, 4); Vector4f right = new Vector4f(5, 6, 7, 8); // Select X and Z from right and Y and W from left Vector4i mask = new Vector4i(0, -1, 0, -1); var result = mask.SelectWithMask(left, right); Assertions.AlmostEqual((Vector)new Vector4f(5, 2, 7, 4), result);Requirements
Namespace: Sansar
Assembly: Sansar.Script (in Sansar.Script.dll)
Assembly Versions: 1.0.0.0
Sin Method
Returns the approximate sine of the four floats in the vector.Syntax
public static Mono.Simd.Vector4f Sin (this Mono.Simd.Vector4f a)Parameters
- a
- A vector of 4 floats
Returns
A fast approximation of the sine of each of the 4 floats.Remarks
Requirements
Namespace: Sansar
Assembly: Sansar.Script (in Sansar.Script.dll)
Assembly Versions: 1.0.0.0
SinSlow Method
Returns the sine each element of the vector.Syntax
public static Mono.Simd.Vector4f SinSlow (this Mono.Simd.Vector4f v1)Parameters
- v1
- A vector of 4 floats.
Returns
The sine of each element.Remarks
Uses Math.Sin(double). The results are more accurate than VectorExtensions.Sin(Mono.Simd.Vector4f) but take approximately 3x the time to calculate.Requirements
Namespace: Sansar
Assembly: Sansar.Script (in Sansar.Script.dll)
Assembly Versions: 1.0.0.0
SinZeroPiOverTwo Method
Returns the approximate sine of each element in the vector.Syntax
public static Mono.Simd.Vector4f SinZeroPiOverTwo (this Mono.Simd.Vector4f x)Parameters
- x
- A vector of 4 floats.
Returns
The approximate sine of each element.Remarks
Results only valid if each element is in [0 and Pi/2]. For unconstrained input use VectorExtensions.Sin(Mono.Simd.Vector4f). Calculated using the Maclaurin series as sin(x) = x - (x^3)/3! + (x^5)/5! - (x^7)/7! + (x^9)/9!Requirements
Namespace: Sansar
Assembly: Sansar.Script (in Sansar.Script.dll)
Assembly Versions: 1.0.0.0
0 Comments