<PackageReference Include="System.Numerics.Vectors" Version="4.6.0" />

System.Numerics.Vector3

A structure encapsulating three single precision floating point values and provides hardware accelerated methods.
public float X

The X component of the vector.

public float Y

The Y component of the vector.

public float Z

The Z component of the vector.

public static Vector3 One { get; }

Returns the vector (1,1,1).

public static Vector3 UnitX { get; }

Returns the vector (1,0,0).

public static Vector3 UnitY { get; }

Returns the vector (0,1,0).

public static Vector3 UnitZ { get; }

Returns the vector (0,0,1).

public static Vector3 Zero { get; }

Returns the vector (0,0,0).

public Vector3(float value)

Constructs a vector whose elements are all the single specified value.

public Vector3(Vector2 value, float z)

Constructs a Vector3 from the given Vector2 and a third value.

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

Constructs a vector with the given individual elements.

public static Vector3 Abs(Vector3 value)

Returns a vector whose elements are the absolute values of each of the source vector's elements.

public static Vector3 Add(Vector3 left, Vector3 right)

Adds two vectors together.

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

Restricts a vector between a min and max value.

public static Vector3 Cross(Vector3 vector1, Vector3 vector2)

Computes the cross product of two vectors.

public static float Distance(Vector3 value1, Vector3 value2)

Returns the Euclidean distance between the two given points.

public static float DistanceSquared(Vector3 value1, Vector3 value2)

Returns the Euclidean distance squared between the two given points.

public static Vector3 Divide(Vector3 left, Vector3 right)

Divides the first vector by the second.

public static Vector3 Divide(Vector3 left, float divisor)

Divides the vector by the given scalar.

public static float Dot(Vector3 vector1, Vector3 vector2)

Returns the dot product of two vectors.

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

Linearly interpolates between two vectors based on the given weighting.

public static Vector3 Max(Vector3 value1, Vector3 value2)

Returns a vector whose elements are the maximum of each of the pairs of elements in the two source vectors.

public static Vector3 Min(Vector3 value1, Vector3 value2)

Returns a vector whose elements are the minimum of each of the pairs of elements in the two source vectors.

public static Vector3 Multiply(Vector3 left, Vector3 right)

Multiplies two vectors together.

public static Vector3 Multiply(Vector3 left, float right)

Multiplies a vector by the given scalar.

public static Vector3 Multiply(float left, Vector3 right)

Multiplies a vector by the given scalar.

public static Vector3 Negate(Vector3 value)

Negates a given vector.

public static Vector3 Normalize(Vector3 value)

Returns a vector with the same direction as the given vector, but with a length of 1.

public static Vector3 op_Addition(Vector3 left, Vector3 right)

Adds two vectors together.

public static Vector3 op_Division(Vector3 left, Vector3 right)

Divides the first vector by the second.

public static Vector3 op_Division(Vector3 value1, float value2)

Divides the vector by the given scalar.

public static bool op_Equality(Vector3 left, Vector3 right)

Returns a boolean indicating whether the two given vectors are equal.

public static bool op_Inequality(Vector3 left, Vector3 right)

Returns a boolean indicating whether the two given vectors are not equal.

public static Vector3 op_Multiply(Vector3 left, Vector3 right)

Multiplies two vectors together.

public static Vector3 op_Multiply(Vector3 left, float right)

Multiplies a vector by the given scalar.

public static Vector3 op_Multiply(float left, Vector3 right)

Multiplies a vector by the given scalar.

public static Vector3 op_Subtraction(Vector3 left, Vector3 right)

Subtracts the second vector from the first.

public static Vector3 op_UnaryNegation(Vector3 value)

Negates a given vector.

public static Vector3 Reflect(Vector3 vector, Vector3 normal)

Returns the reflection of a vector off a surface that has the specified normal.

public static Vector3 SquareRoot(Vector3 value)

Returns a vector whose elements are the square root of each of the source vector's elements.

public static Vector3 Subtract(Vector3 left, Vector3 right)

Subtracts the second vector from the first.

public static Vector3 Transform(Vector3 position, Matrix4x4 matrix)

Transforms a vector by the given matrix.

public static Vector3 Transform(Vector3 value, Quaternion rotation)

Transforms a vector by the given Quaternion rotation value.

public static Vector3 TransformNormal(Vector3 normal, Matrix4x4 matrix)

Transforms a vector normal by the given matrix.

public void CopyTo(float[] array)

Copies the contents of the vector into the given array.

public void CopyTo(float[] array, int index)

Copies the contents of the vector into the given array, starting from index.

public bool Equals(Vector3 other)

Returns a boolean indicating whether the given Vector3 is equal to this Vector3 instance.

public float Length()

Returns the length of the vector.

public float LengthSquared()

Returns the length of the vector squared. This operation is cheaper than Length().

public string ToString(string format)

Returns a String representing this Vector3 instance, using the specified format to format individual elements.

public string ToString(string format, IFormatProvider formatProvider)

Returns a String representing this Vector3 instance, using the specified format to format individual elements and the given IFormatProvider.