Additional methods for Mono.Simd.Vector4f.
public static class VectorExtensionsMembers at a glance
| Kind | Members |
|---|---|
| Methods | Cos · CosSlow · SelectWithMask · Sin · SinSlow · SinZeroPiOverTwo |
Methods
Cos
public static Mono.Simd.Vector4f Cos(this Mono.Simd.Vector4f x)Returns the approximate cosine of the four floats in the vector.
| Parameter | Type | Description |
|---|---|---|
x | Mono.Simd.Vector4f | A vector of 4 floats. |
Returns: Mono.Simd.Vector4f — The approximate cosine of each element.
Remarks
Uses VectorExtensions.Sin
CosSlow
public static Mono.Simd.Vector4f CosSlow(this Mono.Simd.Vector4f v1)Returns the cosine each element of the vector.
| Parameter | Type | Description |
|---|---|---|
v1 | Mono.Simd.Vector4f | A vector of 4 floats. |
Returns: Mono.Simd.Vector4f — The cosine of each element.
Remarks
Uses Math.Cos. The results are more accurate than VectorExtensions.Cos but take approximately 3x the time to calculate.
SelectWithMask
public static Mono.Simd.Vector4f SelectWithMask(
this Mono.Simd.Vector4i mask,
Mono.Simd.Vector4f sourceIfTrue,
Mono.Simd.Vector4f sourceIfFalse
)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.
| Parameter | Type | Description |
|---|---|---|
mask | Mono.Simd.Vector4i | The mask vector. |
sourceIfTrue | Mono.Simd.Vector4f | The vector containing the elements that are selected if the mask is true. |
sourceIfFalse | Mono.Simd.Vector4f | The vector containing the elements that are selected if the maks is false. |
Returns: Mono.Simd.Vector4f — 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/
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 leftVector4i mask = new Vector4i(0, -1, 0, -1);var result = mask.SelectWithMask(left, right);Assertions.AlmostEqual((Vector)new Vector4f(5, 2, 7, 4), result);Sin
public static Mono.Simd.Vector4f Sin(this Mono.Simd.Vector4f a)Returns the approximate sine of the four floats in the vector.
| Parameter | Type | Description |
|---|---|---|
a | Mono.Simd.Vector4f | A vector of 4 floats |
Returns: Mono.Simd.Vector4f — A fast approximation of the sine of each of the 4 floats.
Remarks
SinSlow
public static Mono.Simd.Vector4f SinSlow(this Mono.Simd.Vector4f v1)Returns the sine each element of the vector.
| Parameter | Type | Description |
|---|---|---|
v1 | Mono.Simd.Vector4f | A vector of 4 floats. |
Returns: Mono.Simd.Vector4f — The sine of each element.
Remarks
Uses Math.Sin. The results are more accurate than VectorExtensions.Sin but take approximately 3x the time to calculate.
SinZeroPiOverTwo
public static Mono.Simd.Vector4f SinZeroPiOverTwo(
this Mono.Simd.Vector4f x
)Returns the approximate sine of each element in the vector.
| Parameter | Type | Description |
|---|---|---|
x | Mono.Simd.Vector4f | A vector of 4 floats. |
Returns: Mono.Simd.Vector4f — 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. Calculated using the Maclaurin series as sin(x) = x - (x^3)/3! + (x^5)/5! - (x^7)/7! + (x^9)/9!
Generated from the Sansar 47.10.0 client ScriptApi snapshot.