Table of Contents

Struct Vector3

Namespace
Microsoft.Xna.Framework
Assembly
MonoGame.Framework.dll

Describes a 3D-vector.

[TypeConverter(typeof(Vector3TypeConverter))]
[DataContract]
public struct Vector3 : IEquatable<Vector3>
Implements
Inherited Members

Constructors

Vector3(Vector2, float)

Constructs a 3d vector with X, Y from Vector2 and Z from a scalar.

public Vector3(Vector2 value, float z)

Parameters

value Vector2

The x and y coordinates in 3d-space.

z float

The z coordinate in 3d-space.

Vector3(float)

Constructs a 3d vector with X, Y and Z set to the same value.

public Vector3(float value)

Parameters

value float

The x, y and z coordinates in 3d-space.

Vector3(float, float, float)

Constructs a 3d vector with X, Y and Z from three values.

public Vector3(float x, float y, float z)

Parameters

x float

The x coordinate in 3d-space.

y float

The y coordinate in 3d-space.

z float

The z coordinate in 3d-space.

Fields

X

The x coordinate of this Vector3.

[DataMember]
public float X

Field Value

float

Y

The y coordinate of this Vector3.

[DataMember]
public float Y

Field Value

float

Z

The z coordinate of this Vector3.

[DataMember]
public float Z

Field Value

float

Properties

Backward

Returns a Vector3 with components 0, 0, 1.

public static Vector3 Backward { get; }

Property Value

Vector3

Down

Returns a Vector3 with components 0, -1, 0.

public static Vector3 Down { get; }

Property Value

Vector3

Forward

Returns a Vector3 with components 0, 0, -1.

public static Vector3 Forward { get; }

Property Value

Vector3

Left

Returns a Vector3 with components -1, 0, 0.

public static Vector3 Left { get; }

Property Value

Vector3

One

Returns a Vector3 with components 1, 1, 1.

public static Vector3 One { get; }

Property Value

Vector3

Right

Returns a Vector3 with components 1, 0, 0.

public static Vector3 Right { get; }

Property Value

Vector3

UnitX

Returns a Vector3 with components 1, 0, 0.

public static Vector3 UnitX { get; }

Property Value

Vector3

UnitY

Returns a Vector3 with components 0, 1, 0.

public static Vector3 UnitY { get; }

Property Value

Vector3

UnitZ

Returns a Vector3 with components 0, 0, 1.

public static Vector3 UnitZ { get; }

Property Value

Vector3

Up

Returns a Vector3 with components 0, 1, 0.

public static Vector3 Up { get; }

Property Value

Vector3

Zero

Returns a Vector3 with components 0, 0, 0.

public static Vector3 Zero { get; }

Property Value

Vector3

Methods

Add(Vector3, Vector3)

Performs vector addition on value1 and value2.

public static Vector3 Add(Vector3 value1, Vector3 value2)

Parameters

value1 Vector3

The first vector to add.

value2 Vector3

The second vector to add.

Returns

Vector3

The result of the vector addition.

Add(ref Vector3, ref Vector3, out Vector3)

Performs vector addition on value1 and value2, storing the result of the addition in result.

public static void Add(ref Vector3 value1, ref Vector3 value2, out Vector3 result)

Parameters

value1 Vector3

The first vector to add.

value2 Vector3

The second vector to add.

result Vector3

The result of the vector addition.

Barycentric(Vector3, Vector3, Vector3, float, float)

Creates a new Vector3 that contains the cartesian coordinates of a vector specified in barycentric coordinates and relative to 3d-triangle.

public static Vector3 Barycentric(Vector3 value1, Vector3 value2, Vector3 value3, float amount1, float amount2)

Parameters

value1 Vector3

The first vector of 3d-triangle.

value2 Vector3

The second vector of 3d-triangle.

value3 Vector3

The third vector of 3d-triangle.

amount1 float

Barycentric scalar b2 which represents a weighting factor towards second vector of 3d-triangle.

amount2 float

Barycentric scalar b3 which represents a weighting factor towards third vector of 3d-triangle.

Returns

Vector3

The cartesian translation of barycentric coordinates.

Barycentric(ref Vector3, ref Vector3, ref Vector3, float, float, out Vector3)

Creates a new Vector3 that contains the cartesian coordinates of a vector specified in barycentric coordinates and relative to 3d-triangle.

public static void Barycentric(ref Vector3 value1, ref Vector3 value2, ref Vector3 value3, float amount1, float amount2, out Vector3 result)

Parameters

value1 Vector3

The first vector of 3d-triangle.

value2 Vector3

The second vector of 3d-triangle.

value3 Vector3

The third vector of 3d-triangle.

amount1 float

Barycentric scalar b2 which represents a weighting factor towards second vector of 3d-triangle.

amount2 float

Barycentric scalar b3 which represents a weighting factor towards third vector of 3d-triangle.

result Vector3

The cartesian translation of barycentric coordinates as an output parameter.

CatmullRom(Vector3, Vector3, Vector3, Vector3, float)

Creates a new Vector3 that contains CatmullRom interpolation of the specified vectors.

public static Vector3 CatmullRom(Vector3 value1, Vector3 value2, Vector3 value3, Vector3 value4, float amount)

Parameters

value1 Vector3

The first vector in interpolation.

value2 Vector3

The second vector in interpolation.

value3 Vector3

The third vector in interpolation.

value4 Vector3

The fourth vector in interpolation.

amount float

Weighting factor.

Returns

Vector3

The result of CatmullRom interpolation.

CatmullRom(ref Vector3, ref Vector3, ref Vector3, ref Vector3, float, out Vector3)

Creates a new Vector3 that contains CatmullRom interpolation of the specified vectors.

public static void CatmullRom(ref Vector3 value1, ref Vector3 value2, ref Vector3 value3, ref Vector3 value4, float amount, out Vector3 result)

Parameters

value1 Vector3

The first vector in interpolation.

value2 Vector3

The second vector in interpolation.

value3 Vector3

The third vector in interpolation.

value4 Vector3

The fourth vector in interpolation.

amount float

Weighting factor.

result Vector3

The result of CatmullRom interpolation as an output parameter.

Ceiling()

Round the members of this Vector3 towards positive infinity.

public void Ceiling()

Ceiling(Vector3)

Creates a new Vector3 that contains members from another vector rounded towards positive infinity.

public static Vector3 Ceiling(Vector3 value)

Parameters

value Vector3

Source Vector3.

Returns

Vector3

The rounded Vector3.

Ceiling(ref Vector3, out Vector3)

Creates a new Vector3 that contains members from another vector rounded towards positive infinity.

public static void Ceiling(ref Vector3 value, out Vector3 result)

Parameters

value Vector3

Source Vector3.

result Vector3

The rounded Vector3.

Clamp(Vector3, Vector3, Vector3)

Clamps the specified value within a range.

public static Vector3 Clamp(Vector3 value1, Vector3 min, Vector3 max)

Parameters

value1 Vector3

The value to clamp.

min Vector3

The min value.

max Vector3

The max value.

Returns

Vector3

The clamped value.

Clamp(ref Vector3, ref Vector3, ref Vector3, out Vector3)

Clamps the specified value within a range.

public static void Clamp(ref Vector3 value1, ref Vector3 min, ref Vector3 max, out Vector3 result)

Parameters

value1 Vector3

The value to clamp.

min Vector3

The min value.

max Vector3

The max value.

result Vector3

The clamped value as an output parameter.

Cross(Vector3, Vector3)

Computes the cross product of two vectors.

public static Vector3 Cross(Vector3 vector1, Vector3 vector2)

Parameters

vector1 Vector3

The first vector.

vector2 Vector3

The second vector.

Returns

Vector3

The cross product of two vectors.

Cross(ref Vector3, ref Vector3, out Vector3)

Computes the cross product of two vectors.

public static void Cross(ref Vector3 vector1, ref Vector3 vector2, out Vector3 result)

Parameters

vector1 Vector3

The first vector.

vector2 Vector3

The second vector.

result Vector3

The cross product of two vectors as an output parameter.

Deconstruct(out float, out float, out float)

Deconstruction method for Vector3.

public void Deconstruct(out float x, out float y, out float z)

Parameters

x float
y float
z float

Distance(Vector3, Vector3)

Returns the distance between two vectors.

public static float Distance(Vector3 value1, Vector3 value2)

Parameters

value1 Vector3

The first vector.

value2 Vector3

The second vector.

Returns

float

The distance between two vectors.

Distance(ref Vector3, ref Vector3, out float)

Returns the distance between two vectors.

public static void Distance(ref Vector3 value1, ref Vector3 value2, out float result)

Parameters

value1 Vector3

The first vector.

value2 Vector3

The second vector.

result float

The distance between two vectors as an output parameter.

DistanceSquared(Vector3, Vector3)

Returns the squared distance between two vectors.

public static float DistanceSquared(Vector3 value1, Vector3 value2)

Parameters

value1 Vector3

The first vector.

value2 Vector3

The second vector.

Returns

float

The squared distance between two vectors.

DistanceSquared(ref Vector3, ref Vector3, out float)

Returns the squared distance between two vectors.

public static void DistanceSquared(ref Vector3 value1, ref Vector3 value2, out float result)

Parameters

value1 Vector3

The first vector.

value2 Vector3

The second vector.

result float

The squared distance between two vectors as an output parameter.

Divide(Vector3, Vector3)

Divides the components of a Vector3 by the components of another Vector3.

public static Vector3 Divide(Vector3 value1, Vector3 value2)

Parameters

value1 Vector3

Source Vector3.

value2 Vector3

Divisor Vector3.

Returns

Vector3

The result of dividing the vectors.

Divide(Vector3, float)

Divides the components of a Vector3 by a scalar.

public static Vector3 Divide(Vector3 value1, float divider)

Parameters

value1 Vector3

Source Vector3.

divider float

Divisor scalar.

Returns

Vector3

The result of dividing a vector by a scalar.

Divide(ref Vector3, ref Vector3, out Vector3)

Divides the components of a Vector3 by the components of another Vector3.

public static void Divide(ref Vector3 value1, ref Vector3 value2, out Vector3 result)

Parameters

value1 Vector3

Source Vector3.

value2 Vector3

Divisor Vector3.

result Vector3

The result of dividing the vectors as an output parameter.

Divide(ref Vector3, float, out Vector3)

Divides the components of a Vector3 by a scalar.

public static void Divide(ref Vector3 value1, float divider, out Vector3 result)

Parameters

value1 Vector3

Source Vector3.

divider float

Divisor scalar.

result Vector3

The result of dividing a vector by a scalar as an output parameter.

Dot(Vector3, Vector3)

Returns a dot product of two vectors.

public static float Dot(Vector3 value1, Vector3 value2)

Parameters

value1 Vector3

The first vector.

value2 Vector3

The second vector.

Returns

float

The dot product of two vectors.

Dot(ref Vector3, ref Vector3, out float)

Returns a dot product of two vectors.

public static void Dot(ref Vector3 value1, ref Vector3 value2, out float result)

Parameters

value1 Vector3

The first vector.

value2 Vector3

The second vector.

result float

The dot product of two vectors as an output parameter.

Equals(Vector3)

Compares whether current instance is equal to specified Vector3.

public bool Equals(Vector3 other)

Parameters

other Vector3

The Vector3 to compare.

Returns

bool

true if the instances are equal; false otherwise.

Equals(object)

Compares whether current instance is equal to specified object.

public override bool Equals(object obj)

Parameters

obj object

The object to compare.

Returns

bool

true if the instances are equal; false otherwise.

Floor()

Round the members of this Vector3 towards negative infinity.

public void Floor()

Floor(Vector3)

Creates a new Vector3 that contains members from another vector rounded towards negative infinity.

public static Vector3 Floor(Vector3 value)

Parameters

value Vector3

Source Vector3.

Returns

Vector3

The rounded Vector3.

Floor(ref Vector3, out Vector3)

Creates a new Vector3 that contains members from another vector rounded towards negative infinity.

public static void Floor(ref Vector3 value, out Vector3 result)

Parameters

value Vector3

Source Vector3.

result Vector3

The rounded Vector3.

GetHashCode()

Gets the hash code of this Vector3.

public override int GetHashCode()

Returns

int

Hash code of this Vector3.

Hermite(Vector3, Vector3, Vector3, Vector3, float)

Creates a new Vector3 that contains hermite spline interpolation.

public static Vector3 Hermite(Vector3 value1, Vector3 tangent1, Vector3 value2, Vector3 tangent2, float amount)

Parameters

value1 Vector3

The first position vector.

tangent1 Vector3

The first tangent vector.

value2 Vector3

The second position vector.

tangent2 Vector3

The second tangent vector.

amount float

Weighting factor.

Returns

Vector3

The hermite spline interpolation vector.

Hermite(ref Vector3, ref Vector3, ref Vector3, ref Vector3, float, out Vector3)

Creates a new Vector3 that contains hermite spline interpolation.

public static void Hermite(ref Vector3 value1, ref Vector3 tangent1, ref Vector3 value2, ref Vector3 tangent2, float amount, out Vector3 result)

Parameters

value1 Vector3

The first position vector.

tangent1 Vector3

The first tangent vector.

value2 Vector3

The second position vector.

tangent2 Vector3

The second tangent vector.

amount float

Weighting factor.

result Vector3

The hermite spline interpolation vector as an output parameter.

Length()

Returns the length of this Vector3.

public float Length()

Returns

float

The length of this Vector3.

LengthSquared()

Returns the squared length of this Vector3.

public float LengthSquared()

Returns

float

The squared length of this Vector3.

Lerp(Vector3, Vector3, float)

Creates a new Vector3 that contains linear interpolation of the specified vectors.

public static Vector3 Lerp(Vector3 value1, Vector3 value2, float amount)

Parameters

value1 Vector3

The first vector.

value2 Vector3

The second vector.

amount float

Weighting value(between 0.0 and 1.0).

Returns

Vector3

The result of linear interpolation of the specified vectors.

Lerp(ref Vector3, ref Vector3, float, out Vector3)

Creates a new Vector3 that contains linear interpolation of the specified vectors.

public static void Lerp(ref Vector3 value1, ref Vector3 value2, float amount, out Vector3 result)

Parameters

value1 Vector3

The first vector.

value2 Vector3

The second vector.

amount float

Weighting value(between 0.0 and 1.0).

result Vector3

The result of linear interpolation of the specified vectors as an output parameter.

LerpPrecise(Vector3, Vector3, float)

Creates a new Vector3 that contains linear interpolation of the specified vectors. Uses LerpPrecise(float, float, float) on MathHelper for the interpolation. Less efficient but more precise compared to Lerp(Vector3, Vector3, float). See remarks section of LerpPrecise(float, float, float) on MathHelper for more info.

public static Vector3 LerpPrecise(Vector3 value1, Vector3 value2, float amount)

Parameters

value1 Vector3

The first vector.

value2 Vector3

The second vector.

amount float

Weighting value(between 0.0 and 1.0).

Returns

Vector3

The result of linear interpolation of the specified vectors.

LerpPrecise(ref Vector3, ref Vector3, float, out Vector3)

Creates a new Vector3 that contains linear interpolation of the specified vectors. Uses LerpPrecise(float, float, float) on MathHelper for the interpolation. Less efficient but more precise compared to Lerp(ref Vector3, ref Vector3, float, out Vector3). See remarks section of LerpPrecise(float, float, float) on MathHelper for more info.

public static void LerpPrecise(ref Vector3 value1, ref Vector3 value2, float amount, out Vector3 result)

Parameters

value1 Vector3

The first vector.

value2 Vector3

The second vector.

amount float

Weighting value(between 0.0 and 1.0).

result Vector3

The result of linear interpolation of the specified vectors as an output parameter.

Max(Vector3, Vector3)

Creates a new Vector3 that contains a maximal values from the two vectors.

public static Vector3 Max(Vector3 value1, Vector3 value2)

Parameters

value1 Vector3

The first vector.

value2 Vector3

The second vector.

Returns

Vector3

The Vector3 with maximal values from the two vectors.

Max(ref Vector3, ref Vector3, out Vector3)

Creates a new Vector3 that contains a maximal values from the two vectors.

public static void Max(ref Vector3 value1, ref Vector3 value2, out Vector3 result)

Parameters

value1 Vector3

The first vector.

value2 Vector3

The second vector.

result Vector3

The Vector3 with maximal values from the two vectors as an output parameter.

Min(Vector3, Vector3)

Creates a new Vector3 that contains a minimal values from the two vectors.

public static Vector3 Min(Vector3 value1, Vector3 value2)

Parameters

value1 Vector3

The first vector.

value2 Vector3

The second vector.

Returns

Vector3

The Vector3 with minimal values from the two vectors.

Min(ref Vector3, ref Vector3, out Vector3)

Creates a new Vector3 that contains a minimal values from the two vectors.

public static void Min(ref Vector3 value1, ref Vector3 value2, out Vector3 result)

Parameters

value1 Vector3

The first vector.

value2 Vector3

The second vector.

result Vector3

The Vector3 with minimal values from the two vectors as an output parameter.

Multiply(Vector3, Vector3)

Creates a new Vector3 that contains a multiplication of two vectors.

public static Vector3 Multiply(Vector3 value1, Vector3 value2)

Parameters

value1 Vector3

Source Vector3.

value2 Vector3

Source Vector3.

Returns

Vector3

The result of the vector multiplication.

Multiply(Vector3, float)

Creates a new Vector3 that contains a multiplication of Vector3 and a scalar.

public static Vector3 Multiply(Vector3 value1, float scaleFactor)

Parameters

value1 Vector3

Source Vector3.

scaleFactor float

Scalar value.

Returns

Vector3

The result of the vector multiplication with a scalar.

Multiply(ref Vector3, ref Vector3, out Vector3)

Creates a new Vector3 that contains a multiplication of two vectors.

public static void Multiply(ref Vector3 value1, ref Vector3 value2, out Vector3 result)

Parameters

value1 Vector3

Source Vector3.

value2 Vector3

Source Vector3.

result Vector3

The result of the vector multiplication as an output parameter.

Multiply(ref Vector3, float, out Vector3)

Creates a new Vector3 that contains a multiplication of Vector3 and a scalar.

public static void Multiply(ref Vector3 value1, float scaleFactor, out Vector3 result)

Parameters

value1 Vector3

Source Vector3.

scaleFactor float

Scalar value.

result Vector3

The result of the multiplication with a scalar as an output parameter.

Negate(Vector3)

Creates a new Vector3 that contains the specified vector inversion.

public static Vector3 Negate(Vector3 value)

Parameters

value Vector3

Source Vector3.

Returns

Vector3

The result of the vector inversion.

Negate(ref Vector3, out Vector3)

Creates a new Vector3 that contains the specified vector inversion.

public static void Negate(ref Vector3 value, out Vector3 result)

Parameters

value Vector3

Source Vector3.

result Vector3

The result of the vector inversion as an output parameter.

Normalize()

Turns this Vector3 to a unit vector with the same direction.

public void Normalize()

Normalize(Vector3)

Creates a new Vector3 that contains a normalized values from another vector.

public static Vector3 Normalize(Vector3 value)

Parameters

value Vector3

Source Vector3.

Returns

Vector3

Unit vector.

Normalize(ref Vector3, out Vector3)

Creates a new Vector3 that contains a normalized values from another vector.

public static void Normalize(ref Vector3 value, out Vector3 result)

Parameters

value Vector3

Source Vector3.

result Vector3

Unit vector as an output parameter.

Reflect(Vector3, Vector3)

Creates a new Vector3 that contains reflect vector of the given vector and normal.

public static Vector3 Reflect(Vector3 vector, Vector3 normal)

Parameters

vector Vector3

Source Vector3.

normal Vector3

Reflection normal.

Returns

Vector3

Reflected vector.

Reflect(ref Vector3, ref Vector3, out Vector3)

Creates a new Vector3 that contains reflect vector of the given vector and normal.

public static void Reflect(ref Vector3 vector, ref Vector3 normal, out Vector3 result)

Parameters

vector Vector3

Source Vector3.

normal Vector3

Reflection normal.

result Vector3

Reflected vector as an output parameter.

Round()

Round the members of this Vector3 towards the nearest integer value.

public void Round()

Round(Vector3)

Creates a new Vector3 that contains members from another vector rounded to the nearest integer value.

public static Vector3 Round(Vector3 value)

Parameters

value Vector3

Source Vector3.

Returns

Vector3

The rounded Vector3.

Round(ref Vector3, out Vector3)

Creates a new Vector3 that contains members from another vector rounded to the nearest integer value.

public static void Round(ref Vector3 value, out Vector3 result)

Parameters

value Vector3

Source Vector3.

result Vector3

The rounded Vector3.

SmoothStep(Vector3, Vector3, float)

Creates a new Vector3 that contains cubic interpolation of the specified vectors.

public static Vector3 SmoothStep(Vector3 value1, Vector3 value2, float amount)

Parameters

value1 Vector3

Source Vector3.

value2 Vector3

Source Vector3.

amount float

Weighting value.

Returns

Vector3

Cubic interpolation of the specified vectors.

SmoothStep(ref Vector3, ref Vector3, float, out Vector3)

Creates a new Vector3 that contains cubic interpolation of the specified vectors.

public static void SmoothStep(ref Vector3 value1, ref Vector3 value2, float amount, out Vector3 result)

Parameters

value1 Vector3

Source Vector3.

value2 Vector3

Source Vector3.

amount float

Weighting value.

result Vector3

Cubic interpolation of the specified vectors as an output parameter.

Subtract(Vector3, Vector3)

Creates a new Vector3 that contains subtraction of on Vector3 from a another.

public static Vector3 Subtract(Vector3 value1, Vector3 value2)

Parameters

value1 Vector3

Source Vector3.

value2 Vector3

Source Vector3.

Returns

Vector3

The result of the vector subtraction.

Subtract(ref Vector3, ref Vector3, out Vector3)

Creates a new Vector3 that contains subtraction of on Vector3 from a another.

public static void Subtract(ref Vector3 value1, ref Vector3 value2, out Vector3 result)

Parameters

value1 Vector3

Source Vector3.

value2 Vector3

Source Vector3.

result Vector3

The result of the vector subtraction as an output parameter.

ToNumerics()

Returns a Vector3.

public Vector3 ToNumerics()

Returns

Vector3

ToString()

Returns a string representation of this Vector3 in the format: {X:[X] Y:[Y] Z:[Z]}

public override string ToString()

Returns

string

A string representation of this Vector3.

Transform(Vector3, Matrix)

Creates a new Vector3 that contains a transformation of 3d-vector by the specified Matrix.

public static Vector3 Transform(Vector3 position, Matrix matrix)

Parameters

position Vector3

Source Vector3.

matrix Matrix

The transformation Matrix.

Returns

Vector3

Transformed Vector3.

Transform(Vector3, Quaternion)

Creates a new Vector3 that contains a transformation of 3d-vector by the specified Quaternion, representing the rotation.

public static Vector3 Transform(Vector3 value, Quaternion rotation)

Parameters

value Vector3

Source Vector3.

rotation Quaternion

The Quaternion which contains rotation transformation.

Returns

Vector3

Transformed Vector3.

Transform(ref Vector3, ref Matrix, out Vector3)

Creates a new Vector3 that contains a transformation of 3d-vector by the specified Matrix.

public static void Transform(ref Vector3 position, ref Matrix matrix, out Vector3 result)

Parameters

position Vector3

Source Vector3.

matrix Matrix

The transformation Matrix.

result Vector3

Transformed Vector3 as an output parameter.

Transform(ref Vector3, ref Quaternion, out Vector3)

Creates a new Vector3 that contains a transformation of 3d-vector by the specified Quaternion, representing the rotation.

public static void Transform(ref Vector3 value, ref Quaternion rotation, out Vector3 result)

Parameters

value Vector3

Source Vector3.

rotation Quaternion

The Quaternion which contains rotation transformation.

result Vector3

Transformed Vector3 as an output parameter.

Transform(Vector3[], ref Matrix, Vector3[])

Apply transformation on all vectors within array of Vector3 by the specified Matrix and places the results in an another array.

public static void Transform(Vector3[] sourceArray, ref Matrix matrix, Vector3[] destinationArray)

Parameters

sourceArray Vector3[]

Source array.

matrix Matrix

The transformation Matrix.

destinationArray Vector3[]

Destination array.

Transform(Vector3[], ref Quaternion, Vector3[])

Apply transformation on all vectors within array of Vector3 by the specified Quaternion and places the results in an another array.

public static void Transform(Vector3[] sourceArray, ref Quaternion rotation, Vector3[] destinationArray)

Parameters

sourceArray Vector3[]

Source array.

rotation Quaternion

The Quaternion which contains rotation transformation.

destinationArray Vector3[]

Destination array.

Transform(Vector3[], int, ref Matrix, Vector3[], int, int)

Apply transformation on vectors within array of Vector3 by the specified Matrix and places the results in an another array.

public static void Transform(Vector3[] sourceArray, int sourceIndex, ref Matrix matrix, Vector3[] destinationArray, int destinationIndex, int length)

Parameters

sourceArray Vector3[]

Source array.

sourceIndex int

The starting index of transformation in the source array.

matrix Matrix

The transformation Matrix.

destinationArray Vector3[]

Destination array.

destinationIndex int

The starting index in the destination array, where the first Vector3 should be written.

length int

The number of vectors to be transformed.

Transform(Vector3[], int, ref Quaternion, Vector3[], int, int)

Apply transformation on vectors within array of Vector3 by the specified Quaternion and places the results in an another array.

public static void Transform(Vector3[] sourceArray, int sourceIndex, ref Quaternion rotation, Vector3[] destinationArray, int destinationIndex, int length)

Parameters

sourceArray Vector3[]

Source array.

sourceIndex int

The starting index of transformation in the source array.

rotation Quaternion

The Quaternion which contains rotation transformation.

destinationArray Vector3[]

Destination array.

destinationIndex int

The starting index in the destination array, where the first Vector3 should be written.

length int

The number of vectors to be transformed.

TransformNormal(Vector3, Matrix)

Creates a new Vector3 that contains a transformation of the specified normal by the specified Matrix.

public static Vector3 TransformNormal(Vector3 normal, Matrix matrix)

Parameters

normal Vector3

Source Vector3 which represents a normal vector.

matrix Matrix

The transformation Matrix.

Returns

Vector3

Transformed normal.

TransformNormal(ref Vector3, ref Matrix, out Vector3)

Creates a new Vector3 that contains a transformation of the specified normal by the specified Matrix.

public static void TransformNormal(ref Vector3 normal, ref Matrix matrix, out Vector3 result)

Parameters

normal Vector3

Source Vector3 which represents a normal vector.

matrix Matrix

The transformation Matrix.

result Vector3

Transformed normal as an output parameter.

TransformNormal(Vector3[], ref Matrix, Vector3[])

Apply transformation on all normals within array of Vector3 by the specified Matrix and places the results in an another array.

public static void TransformNormal(Vector3[] sourceArray, ref Matrix matrix, Vector3[] destinationArray)

Parameters

sourceArray Vector3[]

Source array.

matrix Matrix

The transformation Matrix.

destinationArray Vector3[]

Destination array.

TransformNormal(Vector3[], int, ref Matrix, Vector3[], int, int)

Apply transformation on normals within array of Vector3 by the specified Matrix and places the results in an another array.

public static void TransformNormal(Vector3[] sourceArray, int sourceIndex, ref Matrix matrix, Vector3[] destinationArray, int destinationIndex, int length)

Parameters

sourceArray Vector3[]

Source array.

sourceIndex int

The starting index of transformation in the source array.

matrix Matrix

The transformation Matrix.

destinationArray Vector3[]

Destination array.

destinationIndex int

The starting index in the destination array, where the first Vector3 should be written.

length int

The number of normals to be transformed.

Operators

operator +(Vector3, Vector3)

Adds two vectors.

public static Vector3 operator +(Vector3 value1, Vector3 value2)

Parameters

value1 Vector3

Source Vector3 on the left of the add sign.

value2 Vector3

Source Vector3 on the right of the add sign.

Returns

Vector3

Sum of the vectors.

operator /(Vector3, Vector3)

Divides the components of a Vector3 by the components of another Vector3.

public static Vector3 operator /(Vector3 value1, Vector3 value2)

Parameters

value1 Vector3

Source Vector3 on the left of the div sign.

value2 Vector3

Divisor Vector3 on the right of the div sign.

Returns

Vector3

The result of dividing the vectors.

operator /(Vector3, float)

Divides the components of a Vector3 by a scalar.

public static Vector3 operator /(Vector3 value1, float divider)

Parameters

value1 Vector3

Source Vector3 on the left of the div sign.

divider float

Divisor scalar on the right of the div sign.

Returns

Vector3

The result of dividing a vector by a scalar.

operator ==(Vector3, Vector3)

Compares whether two Vector3 instances are equal.

public static bool operator ==(Vector3 value1, Vector3 value2)

Parameters

value1 Vector3

Vector3 instance on the left of the equal sign.

value2 Vector3

Vector3 instance on the right of the equal sign.

Returns

bool

true if the instances are equal; false otherwise.

implicit operator Vector3(Vector3)

Converts a Vector3 to a Vector3.

public static implicit operator Vector3(Vector3 value)

Parameters

value Vector3

The converted value.

Returns

Vector3

operator !=(Vector3, Vector3)

Compares whether two Vector3 instances are not equal.

public static bool operator !=(Vector3 value1, Vector3 value2)

Parameters

value1 Vector3

Vector3 instance on the left of the not equal sign.

value2 Vector3

Vector3 instance on the right of the not equal sign.

Returns

bool

true if the instances are not equal; false otherwise.

operator *(Vector3, Vector3)

Multiplies the components of two vectors by each other.

public static Vector3 operator *(Vector3 value1, Vector3 value2)

Parameters

value1 Vector3

Source Vector3 on the left of the mul sign.

value2 Vector3

Source Vector3 on the right of the mul sign.

Returns

Vector3

Result of the vector multiplication.

operator *(Vector3, float)

Multiplies the components of vector by a scalar.

public static Vector3 operator *(Vector3 value, float scaleFactor)

Parameters

value Vector3

Source Vector3 on the left of the mul sign.

scaleFactor float

Scalar value on the right of the mul sign.

Returns

Vector3

Result of the vector multiplication with a scalar.

operator *(float, Vector3)

Multiplies the components of vector by a scalar.

public static Vector3 operator *(float scaleFactor, Vector3 value)

Parameters

scaleFactor float

Scalar value on the left of the mul sign.

value Vector3

Source Vector3 on the right of the mul sign.

Returns

Vector3

Result of the vector multiplication with a scalar.

operator -(Vector3, Vector3)

Subtracts a Vector3 from a Vector3.

public static Vector3 operator -(Vector3 value1, Vector3 value2)

Parameters

value1 Vector3

Source Vector3 on the left of the sub sign.

value2 Vector3

Source Vector3 on the right of the sub sign.

Returns

Vector3

Result of the vector subtraction.

operator -(Vector3)

Inverts values in the specified Vector3.

public static Vector3 operator -(Vector3 value)

Parameters

value Vector3

Source Vector3 on the right of the sub sign.

Returns

Vector3

Result of the inversion.