Class Float3
Represents a three dimensional mathematical vector.
Inheritance
Implements
Namespace: FlaxEngine
Assembly: FlaxEngine.CSharp.dll
Syntax
[Unmanaged]
public sealed class Float3 : ValueType, IEquatable<Float3>, IFormattable
Constructors
Float3(Double3)
Initializes a new instance of the Float3 struct.
Declaration
public Float3(Double3 value)
Parameters
Double3
value
A vector containing the values with which to initialize the X, Y and Z components. |
Float3(Float2, Single)
Initializes a new instance of the Float3 struct.
Declaration
public Float3(Float2 value, float z)
Parameters
Float2
value
A vector containing the values with which to initialize the X and Y components. |
System.Single
z
Initial value for the Z component of the vector. |
Float3(Float4)
Initializes a new instance of the Float3 struct.
Declaration
public Float3(Float4 value)
Parameters
Float4
value
A vector containing the values with which to initialize the X, Y and Z components. |
Float3(Vector3)
Initializes a new instance of the Float3 struct.
Declaration
public Float3(Vector3 value)
Parameters
Vector3
value
A vector containing the values with which to initialize the X, Y and Z components. |
Float3(Single)
Initializes a new instance of the Float3 struct.
Declaration
public Float3(float value)
Parameters
System.Single
value
The value that will be assigned to all components. |
Float3(Single, Single, Single)
Initializes a new instance of the Float3 struct.
Declaration
public Float3(float x, float y, float z)
Parameters
System.Single
x
Initial value for the X component of the vector. |
System.Single
y
Initial value for the Y component of the vector. |
System.Single
z
Initial value for the Z component of the vector. |
Float3(Single[])
Initializes a new instance of the Float3 struct.
Declaration
public Float3(float[] values)
Parameters
System.Single[]
values
The values to assign to the X, Y, and Z components of the vector. This must be an array with three elements. |
Exceptions
System.ArgumentNullException
Thrown when |
System.ArgumentOutOfRangeException
Thrown when |
Fields
Backward
A unit Float3 designating backward in a left-handed coordinate system (0, 0, -1).
Declaration
public static readonly Float3 Backward
Field Value
Float3
|
Down
A unit Float3 designating down (0, -1, 0).
Declaration
public static readonly Float3 Down
Field Value
Float3
|
Forward
A unit Float3 designating forward in a left-handed coordinate system (0, 0, 1).
Declaration
public static readonly Float3 Forward
Field Value
Float3
|
Half
A Float3 with all of its components set to half.
Declaration
public static readonly Float3 Half
Field Value
Float3
|
Left
A unit Float3 designating left (-1, 0, 0).
Declaration
public static readonly Float3 Left
Field Value
Float3
|
Maximum
A Float3 with all components equal to System.Single.MaxValue.
Declaration
public static readonly Float3 Maximum
Field Value
Float3
|
Minimum
A Float3 with all components equal to System.Single.MinValue.
Declaration
public static readonly Float3 Minimum
Field Value
Float3
|
One
A Float3 with all of its components set to one.
Declaration
public static readonly Float3 One
Field Value
Float3
|
Right
A unit Float3 designating right (1, 0, 0).
Declaration
public static readonly Float3 Right
Field Value
Float3
|
SizeInBytes
The size of the Float3 type, in bytes.
Declaration
public static readonly int SizeInBytes
Field Value
System.Int32
|
UnitX
UnitY
UnitZ
Up
A unit Float3 designating up (0, 1, 0).
Declaration
public static readonly Float3 Up
Field Value
Float3
|
X
The X component.
Declaration
public float X
Field Value
System.Single
|
Y
The Y component.
Declaration
public float Y
Field Value
System.Single
|
Z
The Z component.
Declaration
public float Z
Field Value
System.Single
|
Zero
A Float3 with all of its components set to zero.
Declaration
public static readonly Float3 Zero
Field Value
Float3
|
Properties
Absolute
Gets a vector with values being absolute values of that vector.
Declaration
public Float3 Absolute { get; }
Property Value
Float3
|
AvgValue
Gets an arithmetic average value of all vector components.
Declaration
public float AvgValue { get; }
Property Value
System.Single
|
Default
IsNormalized
Gets a value indicting whether this instance is normalized.
Declaration
public bool IsNormalized { get; }
Property Value
System.Boolean
|
IsOne
Gets a value indicting whether this vector is one
Declaration
public bool IsOne { get; }
Property Value
System.Boolean
|
IsZero
Gets a value indicting whether this vector is zero
Declaration
public bool IsZero { get; }
Property Value
System.Boolean
|
Item[Int32]
Gets or sets the component at the specified index.
Declaration
public float this[int index] { get; set; }
Parameters
System.Int32
index
The index of the component to access. Use 0 for the X component, 1 for the Y component, and 2 for the Z component. |
Property Value
System.Single
The value of the X, Y, or Z component, depending on the index. |
Exceptions
System.ArgumentOutOfRangeException
Thrown when the |
Length
Calculates the length of the vector.
Declaration
public float Length { get; }
Property Value
System.Single
The length of the vector. |
Remarks
LengthSquared may be preferred when only the relative length is needed and speed is of the essence.
LengthSquared
Calculates the squared length of the vector.
Declaration
public float LengthSquared { get; }
Property Value
System.Single
The squared length of the vector. |
Remarks
This method may be preferred to Length when only a relative length is needed and speed is of the essence.
MaxValue
Gets a maximum component value
Declaration
public float MaxValue { get; }
Property Value
System.Single
|
MinValue
Gets a minimum component value
Declaration
public float MinValue { get; }
Property Value
System.Single
|
Negative
Gets a vector with values being opposite to values of that vector.
Declaration
public Float3 Negative { get; }
Property Value
Float3
|
Normalized
Gets the normalized vector. Returned vector has length equal 1.
Declaration
public Float3 Normalized { get; }
Property Value
Float3
|
ValuesSum
Gets a sum of the component values.
Declaration
public float ValuesSum { get; }
Property Value
System.Single
|
Methods
Abs(Float3)
Returns the absolute value of a vector.
Declaration
public static Float3 Abs(Float3 v)
Parameters
Float3
v
The value. |
Returns
Float3
A vector which components are less or equal to 0. |
Add(Float3, Float3)
Adds two vectors.
Declaration
public static Float3 Add(Float3 left, Float3 right)
Parameters
Float3
left
The first vector to add. |
Float3
right
The second vector to add. |
Returns
Float3
The sum of the two vectors. |
Add(Float3, Single)
Performs a component-wise addition.
Declaration
public static Float3 Add(Float3 left, float right)
Parameters
Float3
left
The input vector |
System.Single
right
The scalar value to be added to elements |
Returns
Float3
The vector with added scalar for each element. |
Add(ref Float3, ref Float3, out Float3)
Adds two vectors.
Declaration
public static void Add(ref Float3 left, ref Float3 right, out Float3 result)
Parameters
Float3
left
The first vector to add. |
Float3
right
The second vector to add. |
Float3
result
When the method completes, contains the sum of the two vectors. |
Add(ref Float3, ref Single, out Float3)
Performs a component-wise addition.
Declaration
public static void Add(ref Float3 left, ref float right, out Float3 result)
Parameters
Float3
left
The input vector |
System.Single
right
The scalar value to be added to elements |
Float3
result
The vector with added scalar for each element. |
Angle(Float3, Float3)
Calculates the angle (in degrees) between from
and to
. This is always the smallest value.
Declaration
public static float Angle(Float3 from, Float3 to)
Parameters
Float3
from
The first vector. |
Float3
to
The second vector. |
Returns
System.Single
The angle (in degrees). |
Barycentric(Float3, Float3, Float3, Single, Single)
Returns a Float3 containing the 3D Cartesian coordinates of a point specified in Barycentric coordinates relative to a 3D triangle.
Declaration
public static Float3 Barycentric(Float3 value1, Float3 value2, Float3 value3, float amount1, float amount2)
Parameters
Float3
value1
A Float3 containing the 3D Cartesian coordinates of vertex 1 of the triangle. |
Float3
value2
A Float3 containing the 3D Cartesian coordinates of vertex 2 of the triangle. |
Float3
value3
A Float3 containing the 3D Cartesian coordinates of vertex 3 of the triangle. |
System.Single
amount1
Barycentric coordinate b2, which expresses the weighting factor toward vertex 2 (specified in |
System.Single
amount2
Barycentric coordinate b3, which expresses the weighting factor toward vertex 3 (specified in |
Returns
Float3
A new Float3 containing the 3D Cartesian coordinates of the specified point. |
Barycentric(ref Float3, ref Float3, ref Float3, Single, Single, out Float3)
Returns a Float3 containing the 3D Cartesian coordinates of a point specified in Barycentric coordinates relative to a 3D triangle.
Declaration
public static void Barycentric(ref Float3 value1, ref Float3 value2, ref Float3 value3, float amount1, float amount2, out Float3 result)
Parameters
Float3
value1
A Float3 containing the 3D Cartesian coordinates of vertex 1 of the triangle. |
Float3
value2
A Float3 containing the 3D Cartesian coordinates of vertex 2 of the triangle. |
Float3
value3
A Float3 containing the 3D Cartesian coordinates of vertex 3 of the triangle. |
System.Single
amount1
Barycentric coordinate b2, which expresses the weighting factor toward vertex 2 (specified in |
System.Single
amount2
Barycentric coordinate b3, which expresses the weighting factor toward vertex 3 (specified in |
Float3
result
When the method completes, contains the 3D Cartesian coordinates of the specified point. |
CatmullRom(Float3, Float3, Float3, Float3, Single)
Performs a Catmull-Rom interpolation using the specified positions.
Declaration
public static Float3 CatmullRom(Float3 value1, Float3 value2, Float3 value3, Float3 value4, float amount)
Parameters
Float3
value1
The first position in the interpolation. |
Float3
value2
The second position in the interpolation. |
Float3
value3
The third position in the interpolation. |
Float3
value4
The fourth position in the interpolation. |
System.Single
amount
Weighting factor. |
Returns
Float3
A vector that is the result of the Catmull-Rom interpolation. |
CatmullRom(ref Float3, ref Float3, ref Float3, ref Float3, Single, out Float3)
Performs a Catmull-Rom interpolation using the specified positions.
Declaration
public static void CatmullRom(ref Float3 value1, ref Float3 value2, ref Float3 value3, ref Float3 value4, float amount, out Float3 result)
Parameters
Float3
value1
The first position in the interpolation. |
Float3
value2
The second position in the interpolation. |
Float3
value3
The third position in the interpolation. |
Float3
value4
The fourth position in the interpolation. |
System.Single
amount
Weighting factor. |
Float3
result
When the method completes, contains the result of the Catmull-Rom interpolation. |
Clamp(Float3, Float3, Float3)
Restricts a value to be within a specified range.
Declaration
public static Float3 Clamp(Float3 value, Float3 min, Float3 max)
Parameters
Float3
value
The value to clamp. |
Float3
min
The minimum value. |
Float3
max
The maximum value. |
Returns
Float3
The clamped value. |
Clamp(ref Float3, ref Float3, ref Float3, out Float3)
Restricts a value to be within a specified range.
Declaration
public static void Clamp(ref Float3 value, ref Float3 min, ref Float3 max, out Float3 result)
Parameters
Float3
value
The value to clamp. |
Float3
min
The minimum value. |
Float3
max
The maximum value. |
Float3
result
When the method completes, contains the clamped value. |
ClampLength(Float3, Single)
Makes sure that Length of the output vector is always below max and above 0.
Declaration
public static Float3 ClampLength(Float3 vector, float max)
Parameters
Float3
vector
Input vector. |
System.Single
max
Max Length |
Returns
Float3
|
ClampLength(Float3, Single, Single)
Makes sure that Length of the output vector is always below max and above min.
Declaration
public static Float3 ClampLength(Float3 vector, float min, float max)
Parameters
Float3
vector
Input vector. |
System.Single
min
Min Length |
System.Single
max
Max Length |
Returns
Float3
|
ClampLength(Float3, Single, Single, out Float3)
Makes sure that Length of the output vector is always below max and above min.
Declaration
public static void ClampLength(Float3 vector, float min, float max, out Float3 result)
Parameters
Float3
vector
Input vector. |
System.Single
min
Min Length |
System.Single
max
Max Length |
Float3
result
The result vector. |
Cross(Float3, Float3)
Calculates the cross product of two vectors.
Declaration
public static Float3 Cross(Float3 left, Float3 right)
Parameters
Float3
left
First source vector. |
Float3
right
Second source vector. |
Returns
Float3
The cross product of the two vectors. |
Cross(ref Float3, ref Float3, out Float3)
Calculates the cross product of two vectors.
Declaration
public static void Cross(ref Float3 left, ref Float3 right, out Float3 result)
Parameters
Float3
left
First source vector. |
Float3
right
Second source vector. |
Float3
result
When the method completes, contains he cross product of the two vectors. |
Distance(Float3, Float3)
Calculates the distance between two vectors.
Declaration
public static float Distance(Float3 value1, Float3 value2)
Parameters
Float3
value1
The first vector. |
Float3
value2
The second vector. |
Returns
System.Single
The distance between the two vectors. |
Remarks
DistanceSquared(Float3, Float3) may be preferred when only the relative distance is needed and speed is of the essence.
Distance(ref Float3, ref Float3)
Calculates the distance between two vectors.
Declaration
public static float Distance(ref Float3 value1, ref Float3 value2)
Parameters
Float3
value1
The first vector. |
Float3
value2
The second vector. |
Returns
System.Single
The distance between the two vectors. |
Remarks
DistanceSquared(ref Float3, ref Float3, out Single) may be preferred when only the relative distance is needed and speed is of the essence.
Distance(ref Float3, ref Float3, out Single)
Calculates the distance between two vectors.
Declaration
public static void Distance(ref Float3 value1, ref Float3 value2, out float result)
Parameters
Float3
value1
The first vector. |
Float3
value2
The second vector. |
System.Single
result
When the method completes, contains the distance between the two vectors. |
Remarks
DistanceSquared(ref Float3, ref Float3, out Single) may be preferred when only the relative distance is needed and speed is of the essence.
DistanceSquared(Float3, Float3)
Calculates the squared distance between two vectors.
Declaration
public static float DistanceSquared(Float3 value1, Float3 value2)
Parameters
Float3
value1
The first vector. |
Float3
value2
The second vector. |
Returns
System.Single
The squared distance between the two vectors. |
DistanceSquared(ref Float3, ref Float3)
Calculates the squared distance between two vectors.
Declaration
public static float DistanceSquared(ref Float3 value1, ref Float3 value2)
Parameters
Float3
value1
The first vector. |
Float3
value2
The second vector. |
Returns
System.Single
The squared distance between the two vectors. |
DistanceSquared(ref Float3, ref Float3, out Single)
Calculates the squared distance between two vectors.
Declaration
public static void DistanceSquared(ref Float3 value1, ref Float3 value2, out float result)
Parameters
Float3
value1
The first vector. |
Float3
value2
The second vector. |
System.Single
result
When the method completes, contains the squared distance between the two vectors. |
DistanceXY(ref Float3, ref Float3, out Single)
Calculates the distance between two vectors on the XY plane (ignoring Z).
Declaration
public static void DistanceXY(ref Float3 value1, ref Float3 value2, out float result)
Parameters
Float3
value1
The first vector. |
Float3
value2
The second vector. |
System.Single
result
When the method completes, contains the distance between the two vectors in the XY plane. |
DistanceXYSquared(ref Float3, ref Float3, out Single)
Calculates the squared distance between two vectors on the XY plane (ignoring Z).
Declaration
public static void DistanceXYSquared(ref Float3 value1, ref Float3 value2, out float result)
Parameters
Float3
value1
The first vector. |
Float3
value2
The second vector |
System.Single
result
When the method completes, contains the squared distance between the two vectors in the XY plane. |
DistanceXZ(ref Float3, ref Float3, out Single)
Calculates the distance between two vectors on the XZ plane (ignoring Y).
Declaration
public static void DistanceXZ(ref Float3 value1, ref Float3 value2, out float result)
Parameters
Float3
value1
The first vector. |
Float3
value2
The second vector. |
System.Single
result
When the method completes, contains the distance between the two vectors in the XY plane. |
DistanceXZSquared(ref Float3, ref Float3, out Single)
Calculates the squared distance between two vectors on the XZ plane (ignoring Y).
Declaration
public static void DistanceXZSquared(ref Float3 value1, ref Float3 value2, out float result)
Parameters
Float3
value1
The first vector. |
Float3
value2
The second vector |
System.Single
result
When the method completes, contains the squared distance between the two vectors in the XY plane. |
DistanceYZ(ref Float3, ref Float3, out Single)
Calculates the distance between two vectors on the YZ plane (ignoring X).
Declaration
public static void DistanceYZ(ref Float3 value1, ref Float3 value2, out float result)
Parameters
Float3
value1
The first vector. |
Float3
value2
The second vector. |
System.Single
result
When the method completes, contains the distance between the two vectors in the YZ plane. |
DistanceYZSquared(ref Float3, ref Float3, out Single)
Calculates the squared distance between two vectors on the YZ plane (ignoring X).
Declaration
public static void DistanceYZSquared(ref Float3 value1, ref Float3 value2, out float result)
Parameters
Float3
value1
The first vector. |
Float3
value2
The second vector |
System.Single
result
When the method completes, contains the squared distance between the two vectors in the YZ plane. |
Divide(Float3, Float3)
Divides a vector by the given value.
Declaration
public static Float3 Divide(Float3 value, Float3 scale)
Parameters
Float3
value
The vector to scale. |
Float3
scale
The amount by which to scale the vector (per component). |
Returns
Float3
The divided vector. |
Divide(Float3, Single)
Scales a vector by the given value.
Declaration
public static Float3 Divide(Float3 value, float scale)
Parameters
Float3
value
The vector to scale. |
System.Single
scale
The amount by which to scale the vector. |
Returns
Float3
The scaled vector. |
Divide(ref Float3, ref Float3, out Float3)
Divides a vector by the given value.
Declaration
public static void Divide(ref Float3 value, ref Float3 scale, out Float3 result)
Parameters
Float3
value
The vector to scale. |
Float3
scale
The amount by which to scale the vector (per component). |
Float3
result
When the method completes, contains the divided vector. |
Divide(ref Float3, Single, out Float3)
Scales a vector by the given value.
Declaration
public static void Divide(ref Float3 value, float scale, out Float3 result)
Parameters
Float3
value
The vector to scale. |
System.Single
scale
The amount by which to scale the vector. |
Float3
result
When the method completes, contains the scaled vector. |
Divide(Single, Float3)
Scales a vector by the given value.
Declaration
public static Float3 Divide(float scale, Float3 value)
Parameters
System.Single
scale
The amount by which to scale the vector. |
Float3
value
The vector to scale. |
Returns
Float3
The scaled vector. |
Divide(Single, ref Float3, out Float3)
Scales a vector by the given value.
Declaration
public static void Divide(float scale, ref Float3 value, out Float3 result)
Parameters
System.Single
scale
The amount by which to scale the vector. |
Float3
value
The vector to scale. |
Float3
result
When the method completes, contains the scaled vector. |
Dot(Float3, Float3)
Calculates the dot product of two vectors.
Declaration
public static float Dot(Float3 left, Float3 right)
Parameters
Float3
left
First source vector. |
Float3
right
Second source vector. |
Returns
System.Single
The dot product of the two vectors. |
Dot(ref Float3, ref Float3)
Calculates the dot product of two vectors.
Declaration
public static float Dot(ref Float3 left, ref Float3 right)
Parameters
Float3
left
First source vector. |
Float3
right
Second source vector. |
Returns
System.Single
The dot product of the two vectors. |
Dot(ref Float3, ref Float3, out Single)
Calculates the dot product of two vectors.
Declaration
public static void Dot(ref Float3 left, ref Float3 right, out float result)
Parameters
Float3
left
First source vector. |
Float3
right
Second source vector. |
System.Single
result
When the method completes, contains the dot product of the two vectors. |
Equals(Float3)
Determines whether the specified Float3 is equal to this instance.
Declaration
public bool Equals(Float3 other)
Parameters
Float3
other
The Float3 to compare with this instance. |
Returns
System.Boolean
|
Equals(ref Float3)
Determines whether the specified Float3 is equal to this instance.
Declaration
public bool Equals(ref Float3 other)
Parameters
Float3
other
The Float3 to compare with this instance. |
Returns
System.Boolean
|
Equals(Object)
Determines whether the specified System.Object is equal to this instance.
Declaration
public override bool Equals(object value)
Parameters
System.Object
value
The System.Object to compare with this instance. |
Returns
System.Boolean
|
GetHashCode()
Returns a hash code for this instance.
Declaration
public override int GetHashCode()
Returns
System.Int32
|
Hermite(Float3, Float3, Float3, Float3, Single)
Performs a Hermite spline interpolation.
Declaration
public static Float3 Hermite(Float3 value1, Float3 tangent1, Float3 value2, Float3 tangent2, float amount)
Parameters
Float3
value1
First source position vector. |
Float3
tangent1
First source tangent vector. |
Float3
value2
Second source position vector. |
Float3
tangent2
Second source tangent vector. |
System.Single
amount
Weighting factor. |
Returns
Float3
The result of the Hermite spline interpolation. |
Hermite(ref Float3, ref Float3, ref Float3, ref Float3, Single, out Float3)
Performs a Hermite spline interpolation.
Declaration
public static void Hermite(ref Float3 value1, ref Float3 tangent1, ref Float3 value2, ref Float3 tangent2, float amount, out Float3 result)
Parameters
Float3
value1
First source position vector. |
Float3
tangent1
First source tangent vector. |
Float3
value2
Second source position vector. |
Float3
tangent2
Second source tangent vector. |
System.Single
amount
Weighting factor. |
Float3
result
When the method completes, contains the result of the Hermite spline interpolation. |
Lerp(Float3, Float3, Single)
Performs a linear interpolation between two vectors.
Declaration
public static Float3 Lerp(Float3 start, Float3 end, float amount)
Parameters
Float3
start
Start vector. |
Float3
end
End vector. |
System.Single
amount
Value between 0 and 1 indicating the weight of |
Returns
Float3
The linear interpolation of the two vectors. |
Remarks
Passing amount
a value of 0 will cause start
to be returned; a value of 1 will cause end
to be returned.
Lerp(ref Float3, ref Float3, Single, out Float3)
Performs a linear interpolation between two vectors.
Declaration
public static void Lerp(ref Float3 start, ref Float3 end, float amount, out Float3 result)
Parameters
Float3
start
Start vector. |
Float3
end
End vector. |
System.Single
amount
Value between 0 and 1 indicating the weight of |
Float3
result
When the method completes, contains the linear interpolation of the two vectors. |
Remarks
Passing amount
a value of 0 will cause start
to be returned; a value of 1 will cause end
to be returned.
Max(Float3, Float3)
Returns a vector containing the largest components of the specified vectors.
Declaration
public static Float3 Max(Float3 left, Float3 right)
Parameters
Float3
left
The first source vector. |
Float3
right
The second source vector. |
Returns
Float3
A vector containing the largest components of the source vectors. |
Max(ref Float3, ref Float3, out Float3)
Returns a vector containing the largest components of the specified vectors.
Declaration
public static void Max(ref Float3 left, ref Float3 right, out Float3 result)
Parameters
Float3
left
The first source vector. |
Float3
right
The second source vector. |
Float3
result
When the method completes, contains an new vector composed of the largest components of the source vectors. |
Min(Float3, Float3)
Returns a vector containing the smallest components of the specified vectors.
Declaration
public static Float3 Min(Float3 left, Float3 right)
Parameters
Float3
left
The first source vector. |
Float3
right
The second source vector. |
Returns
Float3
A vector containing the smallest components of the source vectors. |
Min(ref Float3, ref Float3, out Float3)
Returns a vector containing the smallest components of the specified vectors.
Declaration
public static void Min(ref Float3 left, ref Float3 right, out Float3 result)
Parameters
Float3
left
The first source vector. |
Float3
right
The second source vector. |
Float3
result
When the method completes, contains an new vector composed of the smallest components of the source vectors. |
MoveTowards(Float3, Float3, Single)
Moves a value current towards target.
Declaration
public static Float3 MoveTowards(Float3 current, Float3 target, float maxDistanceDelta)
Parameters
Float3
current
The position to move from. |
Float3
target
The position to move towards. |
System.Single
maxDistanceDelta
The maximum distance that can be applied to the value. |
Returns
Float3
The new position. |
Multiply(Float3, Float3)
Multiply a vector with another by performing component-wise multiplication.
Declaration
public static Float3 Multiply(Float3 left, Float3 right)
Parameters
Float3
left
The first vector to Multiply. |
Float3
right
The second vector to multiply. |
Returns
Float3
The multiplied vector. |
Multiply(Float3, Single)
Scales a vector by the given value.
Declaration
public static Float3 Multiply(Float3 value, float scale)
Parameters
Float3
value
The vector to scale. |
System.Single
scale
The amount by which to scale the vector. |
Returns
Float3
The scaled vector. |
Multiply(ref Float3, ref Float3, out Float3)
Multiply a vector with another by performing component-wise multiplication.
Declaration
public static void Multiply(ref Float3 left, ref Float3 right, out Float3 result)
Parameters
Float3
left
The first vector to multiply. |
Float3
right
The second vector to multiply. |
Float3
result
When the method completes, contains the multiplied vector. |
Multiply(ref Float3, Single, out Float3)
Scales a vector by the given value.
Declaration
public static void Multiply(ref Float3 value, float scale, out Float3 result)
Parameters
Float3
value
The vector to scale. |
System.Single
scale
The amount by which to scale the vector. |
Float3
result
When the method completes, contains the scaled vector. |
NearEqual(Float3, Float3, Single)
Tests whether one vector is near another vector.
Declaration
public static bool NearEqual(Float3 left, Float3 right, float epsilon = 1E-06F)
Parameters
Float3
left
The left vector. |
Float3
right
The right vector. |
System.Single
epsilon
The epsilon. |
Returns
System.Boolean
|
NearEqual(ref Float3, ref Float3, Single)
Tests whether one vector is near another vector.
Declaration
public static bool NearEqual(ref Float3 left, ref Float3 right, float epsilon = 1E-06F)
Parameters
Float3
left
The left vector. |
Float3
right
The right vector. |
System.Single
epsilon
The epsilon. |
Returns
System.Boolean
|
Negate(Float3)
Reverses the direction of a given vector.
Declaration
public static Float3 Negate(Float3 value)
Parameters
Float3
value
The vector to negate. |
Returns
Float3
A vector facing in the opposite direction. |
Negate(ref Float3, out Float3)
Reverses the direction of a given vector.
Declaration
public static void Negate(ref Float3 value, out Float3 result)
Parameters
Float3
value
The vector to negate. |
Float3
result
When the method completes, contains a vector facing in the opposite direction. |
Normalize()
Converts the vector into a unit vector.
Declaration
public void Normalize()
Normalize(Float3)
Converts the vector into a unit vector.
Declaration
public static Float3 Normalize(Float3 value)
Parameters
Float3
value
The vector to normalize. |
Returns
Float3
The normalized vector. |
Normalize(ref Float3, out Float3)
Converts the vector into a unit vector.
Declaration
public static void Normalize(ref Float3 value, out Float3 result)
Parameters
Float3
value
The vector to normalize. |
Float3
result
When the method completes, contains the normalized vector. |
Project(Float3, Float3)
Projects a vector onto another vector.
Declaration
public static Float3 Project(Float3 vector, Float3 onNormal)
Parameters
Float3
vector
The vector to project. |
Float3
onNormal
The projection normal vector. |
Returns
Float3
The projected vector. |
Project(Float3, Single, Single, Single, Single, Single, Single, Matrix)
Projects a 3D vector from object space into screen space.
Declaration
public static Float3 Project(Float3 vector, float x, float y, float width, float height, float minZ, float maxZ, Matrix worldViewProjection)
Parameters
Float3
vector
The vector to project. |
System.Single
x
The X position of the viewport. |
System.Single
y
The Y position of the viewport. |
System.Single
width
The width of the viewport. |
System.Single
height
The height of the viewport. |
System.Single
minZ
The minimum depth of the viewport. |
System.Single
maxZ
The maximum depth of the viewport. |
Matrix
worldViewProjection
The combined world-view-projection matrix. |
Returns
Float3
The vector in screen space. |
Project(ref Float3, Single, Single, Single, Single, Single, Single, ref Matrix, out Float3)
Projects a 3D vector from object space into screen space.
Declaration
public static void Project(ref Float3 vector, float x, float y, float width, float height, float minZ, float maxZ, ref Matrix worldViewProjection, out Float3 result)
Parameters
Float3
vector
The vector to project. |
System.Single
x
The X position of the viewport. |
System.Single
y
The Y position of the viewport. |
System.Single
width
The width of the viewport. |
System.Single
height
The height of the viewport. |
System.Single
minZ
The minimum depth of the viewport. |
System.Single
maxZ
The maximum depth of the viewport. |
Matrix
worldViewProjection
The combined world-view-projection matrix. |
Float3
result
When the method completes, contains the vector in screen space. |
ProjectOnPlane(Float3, Float3)
Projects a vector onto a plane defined by a normal orthogonal to the plane.
Declaration
public static Float3 ProjectOnPlane(Float3 vector, Float3 planeNormal)
Parameters
Float3
vector
The vector to project. |
Float3
planeNormal
The plane normal vector. |
Returns
Float3
The projected vector. |
Reflect(Float3, Float3)
Returns the reflection of a vector off a surface that has the specified normal.
Declaration
public static Float3 Reflect(Float3 vector, Float3 normal)
Parameters
Float3
vector
The source vector. |
Float3
normal
Normal of the surface. |
Returns
Float3
The reflected vector. |
Remarks
Reflect only gives the direction of a reflection off a surface, it does not determine whether the original vector was close enough to the surface to hit it.
Reflect(ref Float3, ref Float3, out Float3)
Returns the reflection of a vector off a surface that has the specified normal.
Declaration
public static void Reflect(ref Float3 vector, ref Float3 normal, out Float3 result)
Parameters
Float3
vector
The source vector. |
Float3
normal
Normal of the surface. |
Float3
result
When the method completes, contains the reflected vector. |
Remarks
Reflect only gives the direction of a reflection off a surface, it does not determine whether the original vector was close enough to the surface to hit it.
SmoothStep(Float3, Float3, Single)
Performs a cubic interpolation between two vectors.
Declaration
public static Float3 SmoothStep(Float3 start, Float3 end, float amount)
Parameters
Float3
start
Start vector. |
Float3
end
End vector. |
System.Single
amount
Value between 0 and 1 indicating the weight of |
Returns
Float3
The cubic interpolation of the two vectors. |
SmoothStep(ref Float3, ref Float3, Single, out Float3)
Performs a cubic interpolation between two vectors.
Declaration
public static void SmoothStep(ref Float3 start, ref Float3 end, float amount, out Float3 result)
Parameters
Float3
start
Start vector. |
Float3
end
End vector. |
System.Single
amount
Value between 0 and 1 indicating the weight of |
Float3
result
When the method completes, contains the cubic interpolation of the two vectors. |
SnapToGrid(Float3, Float3)
Snaps the input position into the grid.
Declaration
public static Float3 SnapToGrid(Float3 pos, Float3 gridSize)
Parameters
Float3
pos
The position to snap. |
Float3
gridSize
The size of the grid. |
Returns
Float3
The position snapped to the grid. |
Subtract(Float3, Float3)
Subtracts two vectors.
Declaration
public static Float3 Subtract(Float3 left, Float3 right)
Parameters
Float3
left
The first vector to subtract. |
Float3
right
The second vector to subtract. |
Returns
Float3
The difference of the two vectors. |
Subtract(Float3, Single)
Performs a component-wise subtraction.
Declaration
public static Float3 Subtract(Float3 left, float right)
Parameters
Float3
left
The input vector |
System.Single
right
The scalar value to be subtracted from elements |
Returns
Float3
The vector with subtracted scalar for each element. |
Subtract(ref Float3, ref Float3, out Float3)
Subtracts two vectors.
Declaration
public static void Subtract(ref Float3 left, ref Float3 right, out Float3 result)
Parameters
Float3
left
The first vector to subtract. |
Float3
right
The second vector to subtract. |
Float3
result
When the method completes, contains the difference of the two vectors. |
Subtract(ref Float3, ref Single, out Float3)
Performs a component-wise subtraction.
Declaration
public static void Subtract(ref Float3 left, ref float right, out Float3 result)
Parameters
Float3
left
The input vector |
System.Single
right
The scalar value to be subtracted from elements |
Float3
result
The vector with subtracted scalar for each element. |
Subtract(Single, Float3)
Performs a component-wise subtraction.
Declaration
public static Float3 Subtract(float left, Float3 right)
Parameters
System.Single
left
The scalar value to be subtracted from elements |
Float3
right
The input vector. |
Returns
Float3
The vector with subtracted scalar for each element. |
Subtract(ref Single, ref Float3, out Float3)
Performs a component-wise subtraction.
Declaration
public static void Subtract(ref float left, ref Float3 right, out Float3 result)
Parameters
System.Single
left
The scalar value to be subtracted from elements |
Float3
right
The input vector. |
Float3
result
The vector with subtracted scalar for each element. |
ToArray()
Creates an array containing the elements of the vector.
Declaration
public float[] ToArray()
Returns
System.Single[]
A three-element array containing the components of the vector. |
ToString()
Returns a System.String that represents this instance.
Declaration
public override string ToString()
Returns
System.String
A System.String that represents this instance. |
ToString(IFormatProvider)
Returns a System.String that represents this instance.
Declaration
public string ToString(IFormatProvider formatProvider)
Parameters
System.IFormatProvider
formatProvider
The format provider. |
Returns
System.String
A System.String that represents this instance. |
ToString(String)
Returns a System.String that represents this instance.
Declaration
public string ToString(string format)
Parameters
System.String
format
The format. |
Returns
System.String
A System.String that represents this instance. |
ToString(String, IFormatProvider)
Returns a System.String that represents this instance.
Declaration
public string ToString(string format, IFormatProvider formatProvider)
Parameters
System.String
format
The format. |
System.IFormatProvider
formatProvider
The format provider. |
Returns
System.String
A System.String that represents this instance. |
Transform(Float3, Matrix)
Transforms a 3D vector by the given Matrix.
Declaration
public static Float3 Transform(Float3 vector, Matrix transform)
Parameters
Float3
vector
The source vector. |
Matrix
transform
The transformation Matrix. |
Returns
Float3
The transformed Float3. |
Transform(Float3, Matrix3x3)
Transforms a 3D vector by the given Matrix3x3.
Declaration
public static Float3 Transform(Float3 vector, Matrix3x3 transform)
Parameters
Float3
vector
The source vector. |
Matrix3x3
transform
The transformation Matrix3x3. |
Returns
Float3
The transformed Float3. |
Transform(Float3, Quaternion)
Transforms a 3D vector by the given Quaternion rotation.
Declaration
public static Float3 Transform(Float3 vector, Quaternion rotation)
Parameters
Float3
vector
The vector to rotate. |
Quaternion
rotation
The Quaternion rotation to apply. |
Returns
Float3
The transformed Float3. |
Transform(ref Float3, ref Matrix, out Float3)
Transforms a 3D vector by the given Matrix.
Declaration
public static void Transform(ref Float3 vector, ref Matrix transform, out Float3 result)
Parameters
Float3
vector
The source vector. |
Matrix
transform
The transformation Matrix. |
Float3
result
When the method completes, contains the transformed Float3. |
Transform(ref Float3, ref Matrix, out Float4)
Transforms a 3D vector by the given Matrix.
Declaration
public static void Transform(ref Float3 vector, ref Matrix transform, out Float4 result)
Parameters
Float3
vector
The source vector. |
Matrix
transform
The transformation Matrix. |
Float4
result
When the method completes, contains the transformed Float4. |
Transform(ref Float3, ref Matrix3x3, out Float3)
Transforms a 3D vector by the given Matrix3x3.
Declaration
public static void Transform(ref Float3 vector, ref Matrix3x3 transform, out Float3 result)
Parameters
Float3
vector
The source vector. |
Matrix3x3
transform
The transformation Matrix3x3. |
Float3
result
When the method completes, contains the transformed Float3. |
Transform(ref Float3, ref Quaternion, out Float3)
Transforms a 3D vector by the given Quaternion rotation.
Declaration
public static void Transform(ref Float3 vector, ref Quaternion rotation, out Float3 result)
Parameters
Float3
vector
The vector to rotate. |
Quaternion
rotation
The Quaternion rotation to apply. |
Float3
result
When the method completes, contains the transformed Float3. |
TransformCoordinate(Float3, Matrix)
Performs a coordinate transformation using the given Matrix.
Declaration
public static Float3 TransformCoordinate(Float3 coordinate, Matrix transform)
Parameters
Float3
coordinate
The coordinate vector to transform. |
Matrix
transform
The transformation Matrix. |
Returns
Float3
The transformed coordinates. |
Remarks
A coordinate transform performs the transformation with the assumption that the w component is one. The four dimensional vector obtained from the transformation operation has each component in the vector divided by the w component. This forces the w component to be one and therefore makes the vector homogeneous. The homogeneous vector is often preferred when working with coordinates as the w component can safely be ignored.
TransformCoordinate(ref Float3, ref Matrix, out Float3)
Performs a coordinate transformation using the given Matrix.
Declaration
public static void TransformCoordinate(ref Float3 coordinate, ref Matrix transform, out Float3 result)
Parameters
Float3
coordinate
The coordinate vector to transform. |
Matrix
transform
The transformation Matrix. |
Float3
result
When the method completes, contains the transformed coordinates. |
Remarks
A coordinate transform performs the transformation with the assumption that the w component is one. The four dimensional vector obtained from the transformation operation has each component in the vector divided by the w component. This forces the w component to be one and therefore makes the vector homogeneous. The homogeneous vector is often preferred when working with coordinates as the w component can safely be ignored.
TransformNormal(Float3, Matrix)
Performs a normal transformation using the given Matrix.
Declaration
public static Float3 TransformNormal(Float3 normal, Matrix transform)
Parameters
Float3
normal
The normal vector to transform. |
Matrix
transform
The transformation Matrix. |
Returns
Float3
The transformed normal. |
Remarks
A normal transform performs the transformation with the assumption that the w component is zero. This causes the fourth row and fourth column of the matrix to be unused. The end result is a vector that is not translated, but all other transformation properties apply. This is often preferred for normal vectors as normals purely represent direction rather than location because normal vectors should not be translated.
TransformNormal(ref Float3, ref Matrix, out Float3)
Performs a normal transformation using the given Matrix.
Declaration
public static void TransformNormal(ref Float3 normal, ref Matrix transform, out Float3 result)
Parameters
Float3
normal
The normal vector to transform. |
Matrix
transform
The transformation Matrix. |
Float3
result
When the method completes, contains the transformed normal. |
Remarks
A normal transform performs the transformation with the assumption that the w component is zero. This causes the fourth row and fourth column of the matrix to be unused. The end result is a vector that is not translated, but all other transformation properties apply. This is often preferred for normal vectors as normals purely represent direction rather than location because normal vectors should not be translated.
Unproject(Float3, Single, Single, Single, Single, Single, Single, Matrix)
Projects a 3D vector from screen space into object space.
Declaration
public static Float3 Unproject(Float3 vector, float x, float y, float width, float height, float minZ, float maxZ, Matrix worldViewProjection)
Parameters
Float3
vector
The vector to project. |
System.Single
x
The X position of the viewport. |
System.Single
y
The Y position of the viewport. |
System.Single
width
The width of the viewport. |
System.Single
height
The height of the viewport. |
System.Single
minZ
The minimum depth of the viewport. |
System.Single
maxZ
The maximum depth of the viewport. |
Matrix
worldViewProjection
The combined world-view-projection matrix. |
Returns
Float3
The vector in object space. |
Unproject(ref Float3, Single, Single, Single, Single, Single, Single, ref Matrix, out Float3)
Projects a 3D vector from screen space into object space.
Declaration
public static void Unproject(ref Float3 vector, float x, float y, float width, float height, float minZ, float maxZ, ref Matrix worldViewProjection, out Float3 result)
Parameters
Float3
vector
The vector to project. |
System.Single
x
The X position of the viewport. |
System.Single
y
The Y position of the viewport. |
System.Single
width
The width of the viewport. |
System.Single
height
The height of the viewport. |
System.Single
minZ
The minimum depth of the viewport. |
System.Single
maxZ
The maximum depth of the viewport. |
Matrix
worldViewProjection
The combined world-view-projection matrix. |
Float3
result
When the method completes, contains the vector in object space. |
Operators
Addition(Float3, Float3)
Adds two vectors.
Declaration
public static Float3 operator +(Float3 left, Float3 right)
Parameters
Float3
left
The first vector to add. |
Float3
right
The second vector to add. |
Returns
Float3
The sum of the two vectors. |
Addition(Float3, Single)
Performs a component-wise addition.
Declaration
public static Float3 operator +(Float3 value, float scalar)
Parameters
Float3
value
The input vector. |
System.Single
scalar
The scalar value to be added on elements |
Returns
Float3
The vector with added scalar for each element. |
Addition(Single, Float3)
Performs a component-wise addition.
Declaration
public static Float3 operator +(float scalar, Float3 value)
Parameters
System.Single
scalar
The scalar value to be added on elements |
Float3
value
The input vector. |
Returns
Float3
The vector with added scalar for each element. |
Division(Float3, Float3)
Scales a vector by the given value.
Declaration
public static Float3 operator /(Float3 value, Float3 scale)
Parameters
Float3
value
The vector to scale. |
Float3
scale
The amount by which to scale the vector. |
Returns
Float3
The scaled vector. |
Division(Float3, Double)
Scales a vector by the given value.
Declaration
public static Float3 operator /(Float3 value, double scale)
Parameters
Float3
value
The vector to scale. |
System.Double
scale
The amount by which to scale the vector. |
Returns
Float3
The scaled vector. |
Division(Float3, Single)
Scales a vector by the given value.
Declaration
public static Float3 operator /(Float3 value, float scale)
Parameters
Float3
value
The vector to scale. |
System.Single
scale
The amount by which to scale the vector. |
Returns
Float3
The scaled vector. |
Division(Double, Float3)
Scales a vector by the given value.
Declaration
public static Float3 operator /(double scale, Float3 value)
Parameters
System.Double
scale
The amount by which to scale the vector. |
Float3
value
The vector to scale. |
Returns
Float3
The scaled vector. |
Division(Single, Float3)
Scales a vector by the given value.
Declaration
public static Float3 operator /(float scale, Float3 value)
Parameters
System.Single
scale
The amount by which to scale the vector. |
Float3
value
The vector to scale. |
Returns
Float3
The scaled vector. |
Equality(Float3, Float3)
Tests for equality between two objects.
Declaration
public static bool operator ==(Float3 left, Float3 right)
Parameters
Float3
left
The first value to compare. |
Float3
right
The second value to compare. |
Returns
System.Boolean
|
Explicit(Float3 to Float2)
Declaration
public static explicit operator Float2(Float3 value)
Parameters
Float3
value
The value. |
Returns
Float2
The result of the conversion. |
Explicit(Float3 to Float4)
Declaration
public static explicit operator Float4(Float3 value)
Parameters
Float3
value
The value. |
Returns
Float4
The result of the conversion. |
Implicit(Float3 to Double3)
Declaration
public static implicit operator Double3(Float3 value)
Parameters
Float3
value
The value. |
Returns
Double3
The result of the conversion. |
Implicit(Float3 to Vector3)
Declaration
public static implicit operator Vector3(Float3 value)
Parameters
Float3
value
The value. |
Returns
Vector3
The result of the conversion. |
Inequality(Float3, Float3)
Tests for inequality between two objects.
Declaration
public static bool operator !=(Float3 left, Float3 right)
Parameters
Float3
left
The first value to compare. |
Float3
right
The second value to compare. |
Returns
System.Boolean
|
Modulus(Float3, Float3)
Remainder of value divided by scale.
Declaration
public static Float3 operator %(Float3 value, Float3 scale)
Parameters
Float3
value
The vector to scale. |
Float3
scale
The amount by which to scale the vector. |
Returns
Float3
The remained vector. |
Modulus(Float3, Single)
Remainder of value divided by scale.
Declaration
public static Float3 operator %(Float3 value, float scale)
Parameters
Float3
value
The vector to scale. |
System.Single
scale
The amount by which to scale the vector. |
Returns
Float3
The remained vector. |
Modulus(Single, Float3)
Remainder of value divided by scale.
Declaration
public static Float3 operator %(float value, Float3 scale)
Parameters
System.Single
value
The amount by which to scale the vector. |
Float3
scale
The vector to scale. |
Returns
Float3
The remained vector. |
Multiply(Float3, Float3)
Multiplies a vector with another by performing component-wise multiplication equivalent to Multiply(ref Float3, ref Float3, out Float3).
Declaration
public static Float3 operator *(Float3 left, Float3 right)
Parameters
Float3
left
The first vector to multiply. |
Float3
right
The second vector to multiply. |
Returns
Float3
The multiplication of the two vectors. |
Multiply(Float3, Quaternion)
Transforms a vector by the given rotation.
Declaration
public static Float3 operator *(Float3 vector, Quaternion rotation)
Parameters
Float3
vector
The vector to transform. |
Quaternion
rotation
The quaternion. |
Returns
Float3
The scaled vector. |
Multiply(Float3, Double)
Scales a vector by the given value.
Declaration
public static Float3 operator *(Float3 value, double scale)
Parameters
Float3
value
The vector to scale. |
System.Double
scale
The amount by which to scale the vector. |
Returns
Float3
The scaled vector. |
Multiply(Float3, Single)
Scales a vector by the given value.
Declaration
public static Float3 operator *(Float3 value, float scale)
Parameters
Float3
value
The vector to scale. |
System.Single
scale
The amount by which to scale the vector. |
Returns
Float3
The scaled vector. |
Multiply(Double, Float3)
Scales a vector by the given value.
Declaration
public static Float3 operator *(double scale, Float3 value)
Parameters
System.Double
scale
The amount by which to scale the vector. |
Float3
value
The vector to scale. |
Returns
Float3
The scaled vector. |
Multiply(Single, Float3)
Scales a vector by the given value.
Declaration
public static Float3 operator *(float scale, Float3 value)
Parameters
System.Single
scale
The amount by which to scale the vector. |
Float3
value
The vector to scale. |
Returns
Float3
The scaled vector. |
Subtraction(Float3, Float3)
Subtracts two vectors.
Declaration
public static Float3 operator -(Float3 left, Float3 right)
Parameters
Float3
left
The first vector to subtract. |
Float3
right
The second vector to subtract. |
Returns
Float3
The difference of the two vectors. |
Subtraction(Float3, Single)
Performs a component-wise subtraction.
Declaration
public static Float3 operator -(Float3 value, float scalar)
Parameters
Float3
value
The input vector. |
System.Single
scalar
The scalar value to be subtracted from elements |
Returns
Float3
The vector with added scalar from each element. |
Subtraction(Single, Float3)
Performs a component-wise subtraction.
Declaration
public static Float3 operator -(float scalar, Float3 value)
Parameters
System.Single
scalar
The scalar value to be subtracted from elements |
Float3
value
The input vector. |
Returns
Float3
The vector with subtracted scalar from each element. |
UnaryNegation(Float3)
Reverses the direction of a given vector.
Declaration
public static Float3 operator -(Float3 value)
Parameters
Float3
value
The vector to negate. |
Returns
Float3
A vector facing in the opposite direction. |
UnaryPlus(Float3)
Assert a vector (return it unchanged).
Declaration
public static Float3 operator +(Float3 value)
Parameters
Float3
value
The vector to assert (unchanged). |
Returns
Float3
The asserted (unchanged) vector. |