Search Results for

    Show / Hide Table of Contents

    Struct Vector3

    A structure encapsulating three doule values and provides hardware accelerated methods.

    Inherited Members
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetType()
    Namespace: System.Numerics
    Assembly: System.Numerics.dll
    Syntax
    public struct Vector3

    Constructors

    | Improve this Doc View Source

    Vector3(Double)

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

    Declaration
    public Vector3(double value)
    Parameters
    Type Name Description
    Double value

    The element to fill the vector with.

    | Improve this Doc View Source

    Vector3(Double, Double, Double)

    Constructs a vector with the given individual elements.

    Declaration
    public Vector3(double x, double y, double z)
    Parameters
    Type Name Description
    Double x

    The X component.

    Double y

    The Y component.

    Double z

    The Z component.

    | Improve this Doc View Source

    Vector3(Vector2, Double)

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

    Declaration
    public Vector3(Vector2 value, double z)
    Parameters
    Type Name Description
    Vector2 value

    The Vector to extract X and Y components from.

    Double z

    The Z component.

    Fields

    | Improve this Doc View Source

    X

    The X component of the vector.

    Declaration
    public double X
    Field Value
    Type Description
    Double
    | Improve this Doc View Source

    Y

    The Y component of the vector.

    Declaration
    public double Y
    Field Value
    Type Description
    Double
    | Improve this Doc View Source

    Z

    The Z component of the vector.

    Declaration
    public double Z
    Field Value
    Type Description
    Double

    Properties

    | Improve this Doc View Source

    One

    Returns the vector (1,1,1).

    Declaration
    public static readonly Vector3 One { get; }
    Property Value
    Type Description
    Vector3
    | Improve this Doc View Source

    UnitX

    Returns the vector (1,0,0).

    Declaration
    public static readonly Vector3 UnitX { get; }
    Property Value
    Type Description
    Vector3
    | Improve this Doc View Source

    UnitZ

    Returns the vector (0,1,0).

    Declaration
    public static readonly Vector3 UnitZ { get; }
    Property Value
    Type Description
    Vector3
    | Improve this Doc View Source

    Zero

    Returns the vector (0,0,0).

    Declaration
    public static readonly Vector3 Zero { get; }
    Property Value
    Type Description
    Vector3

    Methods

    | Improve this Doc View Source

    Abs(Vector3)

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

    Declaration
    public static Vector3 Abs(Vector3 value)
    Parameters
    Type Name Description
    Vector3 value

    The source vector.

    Returns
    Type Description
    Vector3

    The absolute value vector.

    | Improve this Doc View Source

    Add(Vector3, Vector3)

    Adds two vectors together.

    Declaration
    public static Vector3 Add(Vector3 left, Vector3 right)
    Parameters
    Type Name Description
    Vector3 left

    The first source vector.

    Vector3 right

    The second source vector.

    Returns
    Type Description
    Vector3

    The summed vector.

    | Improve this Doc View Source

    Clamp(Vector3, Vector3, Vector3)

    Restricts a vector between a min and max value.

    Declaration
    public static Vector3 Clamp(Vector3 value1, Vector3 min, Vector3 max)
    Parameters
    Type Name Description
    Vector3 value1

    The source vector.

    Vector3 min

    The minimum value.

    Vector3 max

    The maximum value.

    Returns
    Type Description
    Vector3

    The restricted vector.

    | Improve this Doc View Source

    CopyTo(Double[])

    Copies the contents of the vector into the given array.

    Declaration
    public void CopyTo(double[] array)
    Parameters
    Type Name Description
    Double[] array
    | Improve this Doc View Source

    CopyTo(Double[], Int32)

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

    Declaration
    public void CopyTo(double[] array, int index)
    Parameters
    Type Name Description
    Double[] array
    Int32 index
    Exceptions
    Type Condition
    ArgumentNullException

    If array is null.

    ArgumentOutOfRangeException

    If index is greater than end of the array or index is less than zero.

    ArgumentException

    If number of elements in source vector is greater than those available in destination array.

    | Improve this Doc View Source

    Cross(Vector3, Vector3)

    Computes the cross product of two vectors.

    Declaration
    public static Vector3 Cross(Vector3 vector1, Vector3 vector2)
    Parameters
    Type Name Description
    Vector3 vector1

    The first vector.

    Vector3 vector2

    The second vector.

    Returns
    Type Description
    Vector3

    The cross product.

    | Improve this Doc View Source

    Distance(Vector3, Vector3)

    Returns the Euclidean distance between the two given points.

    Declaration
    public static double Distance(Vector3 value1, Vector3 value2)
    Parameters
    Type Name Description
    Vector3 value1

    The first point.

    Vector3 value2

    The second point.

    Returns
    Type Description
    Double

    The distance.

    | Improve this Doc View Source

    DistanceSquared(Vector3, Vector3)

    Returns the Euclidean distance squared between the two given points.

    Declaration
    public static double DistanceSquared(Vector3 value1, Vector3 value2)
    Parameters
    Type Name Description
    Vector3 value1

    The first point.

    Vector3 value2

    The second point.

    Returns
    Type Description
    Double

    The distance squared.

    | Improve this Doc View Source

    Divide(Vector3, Double)

    Divides the vector by the given scalar.

    Declaration
    public static Vector3 Divide(Vector3 left, double divisor)
    Parameters
    Type Name Description
    Vector3 left

    The source vector.

    Double divisor

    The scalar value.

    Returns
    Type Description
    Vector3

    The result of the division.

    | Improve this Doc View Source

    Divide(Vector3, Vector3)

    Divides the first vector by the second.

    Declaration
    public static Vector3 Divide(Vector3 left, Vector3 right)
    Parameters
    Type Name Description
    Vector3 left

    The first source vector.

    Vector3 right

    The second source vector.

    Returns
    Type Description
    Vector3

    The vector resulting from the division.

    | Improve this Doc View Source

    Dot(Vector3, Vector3)

    Returns the dot product of two vectors.

    Declaration
    public static double Dot(Vector3 vector1, Vector3 vector2)
    Parameters
    Type Name Description
    Vector3 vector1

    The first vector.

    Vector3 vector2

    The second vector.

    Returns
    Type Description
    Double

    The dot product.

    | Improve this Doc View Source

    Equals(Vector3)

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

    Declaration
    public bool Equals(Vector3 other)
    Parameters
    Type Name Description
    Vector3 other

    The Vector3 to compare this instance to.

    Returns
    Type Description
    Boolean

    True if the other Vector3 is equal to this instance; False otherwise.

    | Improve this Doc View Source

    Equals(Object)

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

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    Object obj

    The Object to compare against.

    Returns
    Type Description
    Boolean

    True if the Object is equal to this Vector3; False otherwise.

    Overrides
    ValueType.Equals(Object)
    | Improve this Doc View Source

    GetHashCode()

    Returns the hash code for this instance.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    Int32

    The hash code.

    Overrides
    Object.GetHashCode()
    | Improve this Doc View Source

    Length()

    Returns the length of the vector.

    Declaration
    public double Length()
    Returns
    Type Description
    Double

    The vector's length.

    | Improve this Doc View Source

    LengthSquared()

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

    Declaration
    public double LengthSquared()
    Returns
    Type Description
    Double

    The vector's length squared.

    | Improve this Doc View Source

    Lerp(Vector3, Vector3, Double)

    Linearly interpolates between two vectors based on the given weighting.

    Declaration
    public static Vector3 Lerp(Vector3 value1, Vector3 value2, double amount)
    Parameters
    Type Name Description
    Vector3 value1

    The first source vector.

    Vector3 value2

    The second source vector.

    Double amount

    Value between 0 and 1 indicating the weight of the second source vector.

    Returns
    Type Description
    Vector3

    The interpolated vector.

    | Improve this Doc View Source

    Max(Vector3, Vector3)

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

    Declaration
    public static Vector3 Max(Vector3 value1, Vector3 value2)
    Parameters
    Type Name Description
    Vector3 value1

    The first source vector.

    Vector3 value2

    The second source vector.

    Returns
    Type Description
    Vector3

    The maximized vector.

    | Improve this Doc View Source

    Min(Vector3, Vector3)

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

    Declaration
    public static Vector3 Min(Vector3 value1, Vector3 value2)
    Parameters
    Type Name Description
    Vector3 value1

    The first source vector.

    Vector3 value2

    The second source vector.

    Returns
    Type Description
    Vector3

    The minimized vector.

    | Improve this Doc View Source

    Multiply(Double, Vector3)

    Multiplies a vector by the given scalar.

    Declaration
    public static Vector3 Multiply(double left, Vector3 right)
    Parameters
    Type Name Description
    Double left

    The scalar value.

    Vector3 right

    The source vector.

    Returns
    Type Description
    Vector3

    The scaled vector.

    | Improve this Doc View Source

    Multiply(Vector3, Double)

    Multiplies a vector by the given scalar.

    Declaration
    public static Vector3 Multiply(Vector3 left, double right)
    Parameters
    Type Name Description
    Vector3 left

    The source vector.

    Double right

    The scalar value.

    Returns
    Type Description
    Vector3

    The scaled vector.

    | Improve this Doc View Source

    Multiply(Vector3, Vector3)

    Multiplies two vectors together.

    Declaration
    public static Vector3 Multiply(Vector3 left, Vector3 right)
    Parameters
    Type Name Description
    Vector3 left

    The first source vector.

    Vector3 right

    The second source vector.

    Returns
    Type Description
    Vector3

    The product vector.

    | Improve this Doc View Source

    Negate(Vector3)

    Negates a given vector.

    Declaration
    public static Vector3 Negate(Vector3 value)
    Parameters
    Type Name Description
    Vector3 value

    The source vector.

    Returns
    Type Description
    Vector3

    The negated vector.

    | Improve this Doc View Source

    Normalize(Vector3)

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

    Declaration
    public static Vector3 Normalize(Vector3 value)
    Parameters
    Type Name Description
    Vector3 value

    The vector to normalize.

    Returns
    Type Description
    Vector3

    The normalized vector.

    | Improve this Doc View Source

    Reflect(Vector3, Vector3)

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

    Declaration
    public static Vector3 Reflect(Vector3 vector, Vector3 normal)
    Parameters
    Type Name Description
    Vector3 vector

    The source vector.

    Vector3 normal

    The normal of the surface being reflected off.

    Returns
    Type Description
    Vector3

    The reflected vector.

    | Improve this Doc View Source

    SquareRoot(Vector3)

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

    Declaration
    public static Vector3 SquareRoot(Vector3 value)
    Parameters
    Type Name Description
    Vector3 value

    The source vector.

    Returns
    Type Description
    Vector3

    The square root vector.

    | Improve this Doc View Source

    Subtract(Vector3, Vector3)

    Subtracts the second vector from the first.

    Declaration
    public static Vector3 Subtract(Vector3 left, Vector3 right)
    Parameters
    Type Name Description
    Vector3 left

    The first source vector.

    Vector3 right

    The second source vector.

    Returns
    Type Description
    Vector3

    The difference vector.

    | Improve this Doc View Source

    ToString()

    Returns a String representing this Vector3 instance.

    Declaration
    public override string ToString()
    Returns
    Type Description
    String

    The string representation.

    Overrides
    Object.ToString()
    | Improve this Doc View Source

    Transform(Vector3, Quaternion)

    Transforms a vector by the given Quaternion rotation value.

    Declaration
    public static Vector3 Transform(Vector3 value, Quaternion rotation)
    Parameters
    Type Name Description
    Vector3 value

    The source vector to be rotated.

    Quaternion rotation

    The rotation to apply.

    Returns
    Type Description
    Vector3

    The transformed vector.

    Operators

    | Improve this Doc View Source

    Addition(Vector3, Vector3)

    Adds two vectors together.

    Declaration
    public static Vector3 operator +(Vector3 left, Vector3 right)
    Parameters
    Type Name Description
    Vector3 left

    The first source vector.

    Vector3 right

    The second source vector.

    Returns
    Type Description
    Vector3

    The summed vector.

    | Improve this Doc View Source

    Division(Vector3, Double)

    Divides the vector by the given scalar.

    Declaration
    public static Vector3 operator /(Vector3 value1, double value2)
    Parameters
    Type Name Description
    Vector3 value1

    The source vector.

    Double value2

    The scalar value.

    Returns
    Type Description
    Vector3

    The result of the division.

    | Improve this Doc View Source

    Division(Vector3, Vector3)

    Divides the first vector by the second.

    Declaration
    public static Vector3 operator /(Vector3 left, Vector3 right)
    Parameters
    Type Name Description
    Vector3 left

    The first source vector.

    Vector3 right

    The second source vector.

    Returns
    Type Description
    Vector3

    The vector resulting from the division.

    | Improve this Doc View Source

    Equality(Vector3, Vector3)

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

    Declaration
    public static bool operator ==(Vector3 left, Vector3 right)
    Parameters
    Type Name Description
    Vector3 left

    The first vector to compare.

    Vector3 right

    The second vector to compare.

    Returns
    Type Description
    Boolean

    True if the vectors are equal; False otherwise.

    | Improve this Doc View Source

    Inequality(Vector3, Vector3)

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

    Declaration
    public static bool operator !=(Vector3 left, Vector3 right)
    Parameters
    Type Name Description
    Vector3 left

    The first vector to compare.

    Vector3 right

    The second vector to compare.

    Returns
    Type Description
    Boolean

    True if the vectors are not equal; False if they are equal.

    | Improve this Doc View Source

    Multiply(Double, Vector3)

    Multiplies a vector by the given scalar.

    Declaration
    public static Vector3 operator *(double left, Vector3 right)
    Parameters
    Type Name Description
    Double left

    The scalar value.

    Vector3 right

    The source vector.

    Returns
    Type Description
    Vector3

    The scaled vector.

    | Improve this Doc View Source

    Multiply(Vector3, Double)

    Multiplies a vector by the given scalar.

    Declaration
    public static Vector3 operator *(Vector3 left, double right)
    Parameters
    Type Name Description
    Vector3 left

    The source vector.

    Double right

    The scalar value.

    Returns
    Type Description
    Vector3

    The scaled vector.

    | Improve this Doc View Source

    Multiply(Vector3, Vector3)

    Multiplies two vectors together.

    Declaration
    public static Vector3 operator *(Vector3 left, Vector3 right)
    Parameters
    Type Name Description
    Vector3 left

    The first source vector.

    Vector3 right

    The second source vector.

    Returns
    Type Description
    Vector3

    The product vector.

    | Improve this Doc View Source

    Subtraction(Vector3, Vector3)

    Subtracts the second vector from the first.

    Declaration
    public static Vector3 operator -(Vector3 left, Vector3 right)
    Parameters
    Type Name Description
    Vector3 left

    The first source vector.

    Vector3 right

    The second source vector.

    Returns
    Type Description
    Vector3

    The difference vector.

    | Improve this Doc View Source

    UnaryNegation(Vector3)

    Negates a given vector.

    Declaration
    public static Vector3 operator -(Vector3 value)
    Parameters
    Type Name Description
    Vector3 value

    The source vector.

    Returns
    Type Description
    Vector3

    The negated vector.

    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © 2018 nanoFramework Contributors
    Generated by DocFX