Class Int3
Represents a three dimensional mathematical vector.
Inheritance
Implements
Namespace: FlaxEngine
Assembly: FlaxEngine.CSharp.dll
Syntax
[Unmanaged]
public sealed class Int3 : ValueType, IEquatable<Int3>, IFormattable
Constructors
Int3(Int2, Int32)
Initializes a new instance of the Int3 struct.
Declaration
public Int3(Int2 value, int z)
Parameters
Int2
value
A vector containing the values with which to initialize the X and Y components. |
System.Int32
z
Initial value for the Z component of the vector. |
Int3(Int4)
Initializes a new instance of the Int3 struct.
Declaration
public Int3(Int4 value)
Parameters
Int4
value
A vector containing the values with which to initialize the X, Y and Z components. |
Int3(Int32)
Initializes a new instance of the Int3 struct.
Declaration
public Int3(int value)
Parameters
System.Int32
value
The value that will be assigned to all components. |
Int3(Int32, Int32, Int32)
Initializes a new instance of the Int3 struct.
Declaration
public Int3(int x, int y, int z)
Parameters
System.Int32
x
Initial value for the X component of the vector. |
System.Int32
y
Initial value for the Y component of the vector. |
System.Int32
z
Initial value for the Z component of the vector. |
Int3(Int32[])
Initializes a new instance of the Int3 struct.
Declaration
public Int3(int[] values)
Parameters
System.Int32[]
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
Maximum
A Int3 with all components equal to System.Int32.MaxValue.
Declaration
public static readonly Int3 Maximum
Field Value
Int3
|
Minimum
A Int3 with all components equal to System.Int32.MinValue.
Declaration
public static readonly Int3 Minimum
Field Value
Int3
|
One
A Int3 with all of its components set to one.
Declaration
public static readonly Int3 One
Field Value
Int3
|
SizeInBytes
The size of the Int3 type, in bytes.
Declaration
public static readonly int SizeInBytes
Field Value
System.Int32
|
UnitX
UnitY
UnitZ
X
The X component.
Declaration
public int X
Field Value
System.Int32
|
Y
The Y component.
Declaration
public int Y
Field Value
System.Int32
|
Z
The Z component.
Declaration
public int Z
Field Value
System.Int32
|
Zero
A Int3 with all of its components set to zero.
Declaration
public static readonly Int3 Zero
Field Value
Int3
|
Properties
AvgValue
Gets an arithmetic average value of all vector components.
Declaration
public float AvgValue { get; }
Property Value
System.Single
|
Default
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 int 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.Int32
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 int LengthSquared { get; }
Property Value
System.Int32
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 int MaxValue { get; }
Property Value
System.Int32
|
MinValue
Gets a minimum component value
Declaration
public int MinValue { get; }
Property Value
System.Int32
|
ValuesSum
Gets a sum of the component values.
Declaration
public int ValuesSum { get; }
Property Value
System.Int32
|
Methods
Abs(Int3)
Returns the absolute value of a vector.
Declaration
public static Int3 Abs(Int3 v)
Parameters
Int3
v
The value. |
Returns
Int3
A vector which components are less or equal to 0. |
Add(Int3, Int3)
Adds two vectors.
Declaration
public static Int3 Add(Int3 left, Int3 right)
Parameters
Int3
left
The first vector to add. |
Int3
right
The second vector to add. |
Returns
Int3
The sum of the two vectors. |
Add(Int3, Int32)
Perform a component-wise addition
Declaration
public static Int3 Add(Int3 left, int right)
Parameters
Int3
left
The input vector |
System.Int32
right
The scalar value to be added to elements |
Returns
Int3
The vector with added scalar for each element. |
Add(ref Int3, ref Int3, out Int3)
Adds two vectors.
Declaration
public static void Add(ref Int3 left, ref Int3 right, out Int3 result)
Parameters
Int3
left
The first vector to add. |
Int3
right
The second vector to add. |
Int3
result
When the method completes, contains the sum of the two vectors. |
Add(ref Int3, ref Int32, out Int3)
Perform a component-wise addition
Declaration
public static void Add(ref Int3 left, ref int right, out Int3 result)
Parameters
Int3
left
The input vector |
System.Int32
right
The scalar value to be added to elements |
Int3
result
The vector with added scalar for each element. |
Clamp(Int3, Int3, Int3)
Restricts a value to be within a specified range.
Declaration
public static Int3 Clamp(Int3 value, Int3 min, Int3 max)
Parameters
Int3
value
The value to clamp. |
Int3
min
The minimum value. |
Int3
max
The maximum value. |
Returns
Int3
The clamped value. |
Clamp(ref Int3, ref Int3, ref Int3, out Int3)
Restricts a value to be within a specified range.
Declaration
public static void Clamp(ref Int3 value, ref Int3 min, ref Int3 max, out Int3 result)
Parameters
Int3
value
The value to clamp. |
Int3
min
The minimum value. |
Int3
max
The maximum value. |
Int3
result
When the method completes, contains the clamped value. |
Distance(Int3, Int3)
Calculates the distance between two vectors.
Declaration
public static float Distance(Int3 value1, Int3 value2)
Parameters
Int3
value1
The first vector. |
Int3
value2
The second vector. |
Returns
System.Single
The distance between the two vectors. |
Remarks
DistanceSquared(Int3, Int3) may be preferred when only the relative distance is needed and speed is of the essence.
Distance(ref Int3, ref Int3, out Single)
Calculates the distance between two vectors.
Declaration
public static void Distance(ref Int3 value1, ref Int3 value2, out float result)
Parameters
Int3
value1
The first vector. |
Int3
value2
The second vector. |
System.Single
result
When the method completes, contains the distance between the two vectors. |
Remarks
DistanceSquared(ref Int3, ref Int3, out Int32) may be preferred when only the relative distance is needed and speed is of the essence.
Distance2D(Int2, Int2)
Calculates the distance between two vectors in the XZ plane (ignoring Y).
Declaration
public static float Distance2D(Int2 value1, Int2 value2)
Parameters
Int2
value1
The first vector. |
Int2
value2
The second vector. |
Returns
System.Single
The distance between the two vectors in the XZ plane. |
Distance2D(ref Int2, ref Int2, out Single)
Calculates the distance between two vectors.
Declaration
public static void Distance2D(ref Int2 value1, ref Int2 value2, out float result)
Parameters
Int2
value1
The first vector. |
Int2
value2
The second vector. |
System.Single
result
When the method completes, contains the distance between the two vectors in the XZ plane. |
Distance2DSquared(Int2, Int2)
Calculates the squared distance between two vectors in the XZ plane (ignoring Y).
Declaration
public static int Distance2DSquared(Int2 value1, Int2 value2)
Parameters
Int2
value1
The first vector. |
Int2
value2
The second vector. |
Returns
System.Int32
The squared distance between the two vectors in the XZ plane. |
Distance2DSquared(ref Int2, ref Int2, out Int32)
Calculates the squared distance between two vectors in the XZ plane (ignoring Y).
Declaration
public static void Distance2DSquared(ref Int2 value1, ref Int2 value2, out int result)
Parameters
Int2
value1
The first vector. |
Int2
value2
The second vector |
System.Int32
result
When the method completes, contains the squared distance between the two vectors in the XZ plane. |
DistanceSquared(Int3, Int3)
Calculates the squared distance between two vectors.
Declaration
public static int DistanceSquared(Int3 value1, Int3 value2)
Parameters
Int3
value1
The first vector. |
Int3
value2
The second vector. |
Returns
System.Int32
The squared distance between the two vectors. |
Remarks
Distance squared is the value before taking the square root. Distance squared can often be used in place of distance if relative comparisons are being made. For example, consider three points A, B, and C. To determine whether B or C is further from A, compare the distance between A and B to the distance between A and C. Calculating the two distances involves two square roots, which are computationally expensive. However, using distance squared provides the same information and avoids calculating two square roots.
DistanceSquared(ref Int3, ref Int3, out Int32)
Calculates the squared distance between two vectors.
Declaration
public static void DistanceSquared(ref Int3 value1, ref Int3 value2, out int result)
Parameters
Int3
value1
The first vector. |
Int3
value2
The second vector. |
System.Int32
result
When the method completes, contains the squared distance between the two vectors. |
Remarks
Distance squared is the value before taking the square root. Distance squared can often be used in place of distance if relative comparisons are being made. For example, consider three points A, B, and C. To determine whether B or C is further from A, compare the distance between A and B to the distance between A and C. Calculating the two distances involves two square roots, which are computationally expensive. However, using distance squared provides the same information and avoids calculating two square roots.
Divide(Int3, Int3)
Divides a vector by the given value.
Declaration
public static Int3 Divide(Int3 value, Int3 scale)
Parameters
Int3
value
The vector to scale. |
Int3
scale
The amount by which to scale the vector (per component). |
Returns
Int3
The divided vector. |
Divide(Int3, Int32)
Scales a vector by the given value.
Declaration
public static Int3 Divide(Int3 value, int scale)
Parameters
Int3
value
The vector to scale. |
System.Int32
scale
The amount by which to scale the vector. |
Returns
Int3
The scaled vector. |
Divide(ref Int3, ref Int3, out Int3)
Divides a vector by the given value.
Declaration
public static void Divide(ref Int3 value, ref Int3 scale, out Int3 result)
Parameters
Int3
value
The vector to scale. |
Int3
scale
The amount by which to scale the vector (per component). |
Int3
result
When the method completes, contains the divided vector. |
Divide(ref Int3, Int32, out Int3)
Scales a vector by the given value.
Declaration
public static void Divide(ref Int3 value, int scale, out Int3 result)
Parameters
Int3
value
The vector to scale. |
System.Int32
scale
The amount by which to scale the vector. |
Int3
result
When the method completes, contains the scaled vector. |
Divide(Int32, Int3)
Scales a vector by the given value.
Declaration
public static Int3 Divide(int scale, Int3 value)
Parameters
System.Int32
scale
The amount by which to scale the vector. |
Int3
value
The vector to scale. |
Returns
Int3
The scaled vector. |
Divide(Int32, ref Int3, out Int3)
Scales a vector by the given value.
Declaration
public static void Divide(int scale, ref Int3 value, out Int3 result)
Parameters
System.Int32
scale
The amount by which to scale the vector. |
Int3
value
The vector to scale. |
Int3
result
When the method completes, contains the scaled vector. |
Equals(Int3)
Determines whether the specified Int3 is equal to this instance.
Declaration
public bool Equals(Int3 other)
Parameters
Int3
other
The Int3 to compare with this instance. |
Returns
System.Boolean
|
Equals(ref Int3)
Determines whether the specified Int3 is equal to this instance.
Declaration
public bool Equals(ref Int3 other)
Parameters
Int3
other
The Int3 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
A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. |
Max(Int3, Int3)
Returns a vector containing the largest components of the specified vectors.
Declaration
public static Int3 Max(Int3 left, Int3 right)
Parameters
Int3
left
The first source vector. |
Int3
right
The second source vector. |
Returns
Int3
A vector containing the largest components of the source vectors. |
Max(ref Int3, ref Int3, out Int3)
Returns a vector containing the largest components of the specified vectors.
Declaration
public static void Max(ref Int3 left, ref Int3 right, out Int3 result)
Parameters
Int3
left
The first source vector. |
Int3
right
The second source vector. |
Int3
result
When the method completes, contains an new vector composed of the largest components of the source vectors. |
Min(Int3, Int3)
Returns a vector containing the smallest components of the specified vectors.
Declaration
public static Int3 Min(Int3 left, Int3 right)
Parameters
Int3
left
The first source vector. |
Int3
right
The second source vector. |
Returns
Int3
A vector containing the smallest components of the source vectors. |
Min(ref Int3, ref Int3, out Int3)
Returns a vector containing the smallest components of the specified vectors.
Declaration
public static void Min(ref Int3 left, ref Int3 right, out Int3 result)
Parameters
Int3
left
The first source vector. |
Int3
right
The second source vector. |
Int3
result
When the method completes, contains an new vector composed of the smallest components of the source vectors. |
Multiply(Int3, Int3)
Multiply a vector with another by performing component-wise multiplication.
Declaration
public static Int3 Multiply(Int3 left, Int3 right)
Parameters
Int3
left
The first vector to Multiply. |
Int3
right
The second vector to multiply. |
Returns
Int3
The multiplied vector. |
Multiply(Int3, Int32)
Scales a vector by the given value.
Declaration
public static Int3 Multiply(Int3 value, int scale)
Parameters
Int3
value
The vector to scale. |
System.Int32
scale
The amount by which to scale the vector. |
Returns
Int3
The scaled vector. |
Multiply(ref Int3, ref Int3, out Int3)
Multiply a vector with another by performing component-wise multiplication.
Declaration
public static void Multiply(ref Int3 left, ref Int3 right, out Int3 result)
Parameters
Int3
left
The first vector to multiply. |
Int3
right
The second vector to multiply. |
Int3
result
When the method completes, contains the multiplied vector. |
Multiply(ref Int3, Int32, out Int3)
Scales a vector by the given value.
Declaration
public static void Multiply(ref Int3 value, int scale, out Int3 result)
Parameters
Int3
value
The vector to scale. |
System.Int32
scale
The amount by which to scale the vector. |
Int3
result
When the method completes, contains the scaled vector. |
Negate(Int3)
Reverses the direction of a given vector.
Declaration
public static Int3 Negate(Int3 value)
Parameters
Int3
value
The vector to negate. |
Returns
Int3
A vector facing in the opposite direction. |
Negate(ref Int3, out Int3)
Reverses the direction of a given vector.
Declaration
public static void Negate(ref Int3 value, out Int3 result)
Parameters
Int3
value
The vector to negate. |
Int3
result
When the method completes, contains a vector facing in the opposite direction. |
Subtract(Int3, Int3)
Subtracts two vectors.
Declaration
public static Int3 Subtract(Int3 left, Int3 right)
Parameters
Int3
left
The first vector to subtract. |
Int3
right
The second vector to subtract. |
Returns
Int3
The difference of the two vectors. |
Subtract(Int3, Int32)
Perform a component-wise subtraction
Declaration
public static Int3 Subtract(Int3 left, int right)
Parameters
Int3
left
The input vector |
System.Int32
right
The scalar value to be subtracted from elements |
Returns
Int3
The vector with subtracted scalar for each element. |
Subtract(ref Int3, ref Int3, out Int3)
Subtracts two vectors.
Declaration
public static void Subtract(ref Int3 left, ref Int3 right, out Int3 result)
Parameters
Int3
left
The first vector to subtract. |
Int3
right
The second vector to subtract. |
Int3
result
When the method completes, contains the difference of the two vectors. |
Subtract(ref Int3, ref Int32, out Int3)
Perform a component-wise subtraction
Declaration
public static void Subtract(ref Int3 left, ref int right, out Int3 result)
Parameters
Int3
left
The input vector |
System.Int32
right
The scalar value to be subtracted from elements |
Int3
result
The vector with subtracted scalar for each element. |
Subtract(Int32, Int3)
Perform a component-wise subtraction
Declaration
public static Int3 Subtract(int left, Int3 right)
Parameters
System.Int32
left
The scalar value to be subtracted from elements |
Int3
right
The input vector. |
Returns
Int3
The vector with subtracted scalar for each element. |
Subtract(ref Int32, ref Int3, out Int3)
Perform a component-wise subtraction
Declaration
public static void Subtract(ref int left, ref Int3 right, out Int3 result)
Parameters
System.Int32
left
The scalar value to be subtracted from elements |
Int3
right
The input vector. |
Int3
result
The vector with subtracted scalar for each element. |
ToArray()
Creates an array containing the elements of the vector.
Declaration
public int[] ToArray()
Returns
System.Int32[]
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. |
Operators
Addition(Int3, Int3)
Adds two vectors.
Declaration
public static Int3 operator +(Int3 left, Int3 right)
Parameters
Int3
left
The first vector to add. |
Int3
right
The second vector to add. |
Returns
Int3
The sum of the two vectors. |
Addition(Int3, Int32)
Perform a component-wise addition
Declaration
public static Int3 operator +(Int3 value, int scalar)
Parameters
Int3
value
The input vector. |
System.Int32
scalar
The scalar value to be added on elements |
Returns
Int3
The vector with added scalar for each element. |
Addition(Int32, Int3)
Perform a component-wise addition
Declaration
public static Int3 operator +(int scalar, Int3 value)
Parameters
System.Int32
scalar
The scalar value to be added on elements |
Int3
value
The input vector. |
Returns
Int3
The vector with added scalar for each element. |
Division(Int3, Int3)
Scales a vector by the given value.
Declaration
public static Int3 operator /(Int3 value, Int3 scale)
Parameters
Int3
value
The vector to scale. |
Int3
scale
The amount by which to scale the vector. |
Returns
Int3
The scaled vector. |
Division(Int3, Int32)
Scales a vector by the given value.
Declaration
public static Int3 operator /(Int3 value, int scale)
Parameters
Int3
value
The vector to scale. |
System.Int32
scale
The amount by which to scale the vector. |
Returns
Int3
The scaled vector. |
Division(Int32, Int3)
Scales a vector by the given value.
Declaration
public static Int3 operator /(int scale, Int3 value)
Parameters
System.Int32
scale
The amount by which to scale the vector. |
Int3
value
The vector to scale. |
Returns
Int3
The scaled vector. |
Equality(Int3, Int3)
Tests for equality between two objects.
Declaration
public static bool operator ==(Int3 left, Int3 right)
Parameters
Int3
left
The first value to compare. |
Int3
right
The second value to compare. |
Returns
System.Boolean
|
Explicit(Int3 to Float2)
Declaration
public static explicit operator Float2(Int3 value)
Parameters
Int3
value
The value. |
Returns
Float2
The result of the conversion. |
Explicit(Int3 to Float3)
Declaration
public static explicit operator Float3(Int3 value)
Parameters
Int3
value
The value. |
Returns
Float3
The result of the conversion. |
Explicit(Int3 to Float4)
Declaration
public static explicit operator Float4(Int3 value)
Parameters
Int3
value
The value. |
Returns
Float4
The result of the conversion. |
Explicit(Int3 to Int2)
Declaration
public static explicit operator Int2(Int3 value)
Parameters
Int3
value
The value. |
Returns
Int2
The result of the conversion. |
Explicit(Int3 to Int4)
Declaration
public static explicit operator Int4(Int3 value)
Parameters
Int3
value
The value. |
Returns
Int4
The result of the conversion. |
Explicit(Int3 to Vector2)
Declaration
public static explicit operator Vector2(Int3 value)
Parameters
Int3
value
The value. |
Returns
Vector2
The result of the conversion. |
Explicit(Int3 to Vector3)
Declaration
public static explicit operator Vector3(Int3 value)
Parameters
Int3
value
The value. |
Returns
Vector3
The result of the conversion. |
Explicit(Int3 to Vector4)
Declaration
public static explicit operator Vector4(Int3 value)
Parameters
Int3
value
The value. |
Returns
Vector4
The result of the conversion. |
Inequality(Int3, Int3)
Tests for inequality between two objects.
Declaration
public static bool operator !=(Int3 left, Int3 right)
Parameters
Int3
left
The first value to compare. |
Int3
right
The second value to compare. |
Returns
System.Boolean
|
Modulus(Int3, Int3)
Remainder of value divided by scale.
Declaration
public static Int3 operator %(Int3 value, Int3 scale)
Parameters
Int3
value
The vector to scale. |
Int3
scale
The amount by which to scale the vector. |
Returns
Int3
The remained vector. |
Modulus(Int3, Single)
Remainder of value divided by scale.
Declaration
public static Int3 operator %(Int3 value, float scale)
Parameters
Int3
value
The vector to scale. |
System.Single
scale
The amount by which to scale the vector. |
Returns
Int3
The remained vector. |
Modulus(Single, Int3)
Remainder of value divided by scale.
Declaration
public static Int3 operator %(float value, Int3 scale)
Parameters
System.Single
value
The amount by which to scale the vector. |
Int3
scale
The vector to scale. |
Returns
Int3
The remained vector. |
Multiply(Int3, Int3)
Multiplies a vector with another by performing component-wise multiplication equivalent to Multiply(ref Int3, ref Int3, out Int3).
Declaration
public static Int3 operator *(Int3 left, Int3 right)
Parameters
Int3
left
The first vector to multiply. |
Int3
right
The second vector to multiply. |
Returns
Int3
The multiplication of the two vectors. |
Multiply(Int3, Int32)
Scales a vector by the given value.
Declaration
public static Int3 operator *(Int3 value, int scale)
Parameters
Int3
value
The vector to scale. |
System.Int32
scale
The amount by which to scale the vector. |
Returns
Int3
The scaled vector. |
Multiply(Int32, Int3)
Scales a vector by the given value.
Declaration
public static Int3 operator *(int scale, Int3 value)
Parameters
System.Int32
scale
The amount by which to scale the vector. |
Int3
value
The vector to scale. |
Returns
Int3
The scaled vector. |
Subtraction(Int3, Int3)
Subtracts two vectors.
Declaration
public static Int3 operator -(Int3 left, Int3 right)
Parameters
Int3
left
The first vector to subtract. |
Int3
right
The second vector to subtract. |
Returns
Int3
The difference of the two vectors. |
Subtraction(Int3, Int32)
Perform a component-wise subtraction
Declaration
public static Int3 operator -(Int3 value, int scalar)
Parameters
Int3
value
The input vector. |
System.Int32
scalar
The scalar value to be subtracted from elements |
Returns
Int3
The vector with added scalar from each element. |
Subtraction(Int32, Int3)
Perform a component-wise subtraction
Declaration
public static Int3 operator -(int scalar, Int3 value)
Parameters
System.Int32
scalar
The scalar value to be subtracted from elements |
Int3
value
The input vector. |
Returns
Int3
The vector with subtracted scalar from each element. |
UnaryNegation(Int3)
Reverses the direction of a given vector.
Declaration
public static Int3 operator -(Int3 value)
Parameters
Int3
value
The vector to negate. |
Returns
Int3
A vector facing in the opposite direction. |
UnaryPlus(Int3)
Assert a vector (return it unchanged).
Declaration
public static Int3 operator +(Int3 value)
Parameters
Int3
value
The vector to assert (unchanged). |
Returns
Int3
The asserted (unchanged) vector. |