Search Results for

    Show / Hide Table of Contents

    Class Double2

    Represents a two dimensional mathematical vector.

    Inheritance
    System.Object
    Double2
    Implements
    System.IEquatable<Double2>
    System.IFormattable
    Namespace: FlaxEngine
    Assembly: FlaxEngine.CSharp.dll
    Syntax
    [Unmanaged]
    public sealed class Double2 : ValueType, IEquatable<Double2>, IFormattable

    Constructors

    Double2(Double3)

    Initializes a new instance of the Double2 struct.

    Declaration
    public Double2(Double3 value)
    Parameters
    Double3 value

    A vector containing the values with which to initialize the X and Y components.

    Double2(Double4)

    Initializes a new instance of the Double2 struct.

    Declaration
    public Double2(Double4 value)
    Parameters
    Double4 value

    A vector containing the values with which to initialize the X and Y components.

    Double2(Vector3)

    Initializes a new instance of the Double2 struct.

    Declaration
    public Double2(Vector3 value)
    Parameters
    Vector3 value

    A vector containing the values with which to initialize the X and Y components.

    Double2(Double)

    Initializes a new instance of the Double2 struct.

    Declaration
    public Double2(double value)
    Parameters
    System.Double value

    The value that will be assigned to all components.

    Double2(Double, Double)

    Initializes a new instance of the Double2 struct.

    Declaration
    public Double2(double x, double y)
    Parameters
    System.Double x

    Initial value for the X component of the vector.

    System.Double y

    Initial value for the Y component of the vector.

    Double2(Double[])

    Initializes a new instance of the Double2 struct.

    Declaration
    public Double2(double[] values)
    Parameters
    System.Double[] values

    The values to assign to the X and Y components of the vector. This must be an array with two elements.

    Exceptions
    System.ArgumentNullException

    Thrown when values is null.

    System.ArgumentOutOfRangeException

    Thrown when values contains more or less than two elements.

    Fields

    Half

    A Double2 with all of its components set to half.

    Declaration
    public static readonly Double2 Half
    Field Value
    Double2

    Maximum

    A Double2 with all components equal to System.Double.MaxValue.

    Declaration
    public static readonly Double2 Maximum
    Field Value
    Double2

    Minimum

    A Double2 with all components equal to System.Double.MinValue.

    Declaration
    public static readonly Double2 Minimum
    Field Value
    Double2

    One

    A Double2 with all of its components set to one.

    Declaration
    public static readonly Double2 One
    Field Value
    Double2

    SizeInBytes

    The size of the Double2 type, in bytes.

    Declaration
    public static readonly int SizeInBytes
    Field Value
    System.Int32

    UnitX

    The X unit Double2 (1, 0).

    Declaration
    public static readonly Double2 UnitX
    Field Value
    Double2

    UnitY

    The Y unit Double2 (0, 1).

    Declaration
    public static readonly Double2 UnitY
    Field Value
    Double2

    X

    The X component of the vector.

    Declaration
    public double X
    Field Value
    System.Double

    Y

    The Y component of the vector.

    Declaration
    public double Y
    Field Value
    System.Double

    Zero

    A Double2 with all of its components set to zero.

    Declaration
    public static readonly Double2 Zero
    Field Value
    Double2

    Properties

    Absolute

    Gets a vector with values being absolute values of that vector.

    Declaration
    public Double2 Absolute { get; }
    Property Value
    Double2

    AvgValue

    Gets an arithmetic average value of all vector components.

    Declaration
    public double AvgValue { get; }
    Property Value
    System.Double

    Default

    The default Double2.

    Declaration
    public static Double2 Default { get; }
    Property Value
    Double2

    IsNormalized

    Gets a value indicting whether this instance is normalized.

    Declaration
    public bool IsNormalized { 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 double this[int index] { get; set; }
    Parameters
    System.Int32 index

    The index of the component to access. Use 0 for the X component and 1 for the Y component.

    Property Value
    System.Double

    The value of the X or Y component, depending on the index.

    Exceptions
    System.ArgumentOutOfRangeException

    Thrown when the index is out of the range [0,1].

    Length

    Calculates the length of the vector.

    Declaration
    public double Length { get; }
    Property Value
    System.Double

    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 double LengthSquared { get; }
    Property Value
    System.Double

    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 double MaxValue { get; }
    Property Value
    System.Double

    MinValue

    Gets a minimum component value

    Declaration
    public double MinValue { get; }
    Property Value
    System.Double

    Negative

    Gets a vector with values being opposite to values of that vector.

    Declaration
    public Double2 Negative { get; }
    Property Value
    Double2

    ValuesSum

    Gets a sum of the component values.

    Declaration
    public double ValuesSum { get; }
    Property Value
    System.Double

    Methods

    Abs(Double2)

    Returns the absolute value of a vector.

    Declaration
    public static Double2 Abs(Double2 v)
    Parameters
    Double2 v

    The value.

    Returns
    Double2

    A vector which components are less or equal to 0.

    Add(Double2, Double2)

    Adds two vectors.

    Declaration
    public static Double2 Add(Double2 left, Double2 right)
    Parameters
    Double2 left

    The first vector to add.

    Double2 right

    The second vector to add.

    Returns
    Double2

    The sum of the two vectors.

    Add(Double2, Double)

    Performs a component-wise addition.

    Declaration
    public static Double2 Add(Double2 left, double right)
    Parameters
    Double2 left

    The input vector

    System.Double right

    The scalar value to be added to elements

    Returns
    Double2

    The vector with added scalar for each element.

    Add(ref Double2, ref Double2, out Double2)

    Adds two vectors.

    Declaration
    public static void Add(ref Double2 left, ref Double2 right, out Double2 result)
    Parameters
    Double2 left

    The first vector to add.

    Double2 right

    The second vector to add.

    Double2 result

    When the method completes, contains the sum of the two vectors.

    Add(ref Double2, ref Double, out Double2)

    Performs a component-wise addition.

    Declaration
    public static void Add(ref Double2 left, ref double right, out Double2 result)
    Parameters
    Double2 left

    The input vector

    System.Double right

    The scalar value to be added to elements

    Double2 result

    The vector with added scalar for each element.

    Barycentric(Double2, Double2, Double2, Double, Double)

    Returns a Double2 containing the 2D Cartesian coordinates of a point specified in Barycentric coordinates relative to a 2D triangle.

    Declaration
    public static Double2 Barycentric(Double2 value1, Double2 value2, Double2 value3, double amount1, double amount2)
    Parameters
    Double2 value1

    A Double2 containing the 2D Cartesian coordinates of vertex 1 of the triangle.

    Double2 value2

    A Double2 containing the 2D Cartesian coordinates of vertex 2 of the triangle.

    Double2 value3

    A Double2 containing the 2D Cartesian coordinates of vertex 3 of the triangle.

    System.Double amount1

    Barycentric coordinate b2, which expresses the weighting factor toward vertex 2 (specified in value2).

    System.Double amount2

    Barycentric coordinate b3, which expresses the weighting factor toward vertex 3 (specified in value3).

    Returns
    Double2

    A new Double2 containing the 2D Cartesian coordinates of the specified point.

    Barycentric(ref Double2, ref Double2, ref Double2, Double, Double, out Double2)

    Returns a Double2 containing the 2D Cartesian coordinates of a point specified in Barycentric coordinates relative to a 2D triangle.

    Declaration
    public static void Barycentric(ref Double2 value1, ref Double2 value2, ref Double2 value3, double amount1, double amount2, out Double2 result)
    Parameters
    Double2 value1

    A Double2 containing the 2D Cartesian coordinates of vertex 1 of the triangle.

    Double2 value2

    A Double2 containing the 2D Cartesian coordinates of vertex 2 of the triangle.

    Double2 value3

    A Double2 containing the 2D Cartesian coordinates of vertex 3 of the triangle.

    System.Double amount1

    Barycentric coordinate b2, which expresses the weighting factor toward vertex 2 (specified in value2).

    System.Double amount2

    Barycentric coordinate b3, which expresses the weighting factor toward vertex 3 (specified in value3).

    Double2 result

    When the method completes, contains the 2D Cartesian coordinates of the specified point.

    CatmullRom(Double2, Double2, Double2, Double2, Double)

    Performs a Catmull-Rom interpolation using the specified positions.

    Declaration
    public static Double2 CatmullRom(Double2 value1, Double2 value2, Double2 value3, Double2 value4, double amount)
    Parameters
    Double2 value1

    The first position in the interpolation.

    Double2 value2

    The second position in the interpolation.

    Double2 value3

    The third position in the interpolation.

    Double2 value4

    The fourth position in the interpolation.

    System.Double amount

    Weighting factor.

    Returns
    Double2

    A vector that is the result of the Catmull-Rom interpolation.

    CatmullRom(ref Double2, ref Double2, ref Double2, ref Double2, Double, out Double2)

    Performs a Catmull-Rom interpolation using the specified positions.

    Declaration
    public static void CatmullRom(ref Double2 value1, ref Double2 value2, ref Double2 value3, ref Double2 value4, double amount, out Double2 result)
    Parameters
    Double2 value1

    The first position in the interpolation.

    Double2 value2

    The second position in the interpolation.

    Double2 value3

    The third position in the interpolation.

    Double2 value4

    The fourth position in the interpolation.

    System.Double amount

    Weighting factor.

    Double2 result

    When the method completes, contains the result of the Catmull-Rom interpolation.

    Ceil(Double2)

    Returns the vector with components containing the smallest integer greater to or equal to the original value.

    Declaration
    public static Double2 Ceil(Double2 v)
    Parameters
    Double2 v

    The value.

    Returns
    Double2

    The result.

    Clamp(Double2, Double2, Double2)

    Restricts a value to be within a specified range.

    Declaration
    public static Double2 Clamp(Double2 value, Double2 min, Double2 max)
    Parameters
    Double2 value

    The value to clamp.

    Double2 min

    The minimum value.

    Double2 max

    The maximum value.

    Returns
    Double2

    The clamped value.

    Clamp(ref Double2, ref Double2, ref Double2, out Double2)

    Restricts a value to be within a specified range.

    Declaration
    public static void Clamp(ref Double2 value, ref Double2 min, ref Double2 max, out Double2 result)
    Parameters
    Double2 value

    The value to clamp.

    Double2 min

    The minimum value.

    Double2 max

    The maximum value.

    Double2 result

    When the method completes, contains the clamped value.

    ClampLength(Double2, Double)

    Makes sure that Length of the output vector is always below max and above 0.

    Declaration
    public static Double2 ClampLength(Double2 vector, double max)
    Parameters
    Double2 vector

    Input Vector.

    System.Double max

    Max Length

    Returns
    Double2

    ClampLength(Double2, Double, Double)

    Makes sure that Length of the output vector is always below max and above min.

    Declaration
    public static Double2 ClampLength(Double2 vector, double min, double max)
    Parameters
    Double2 vector

    Input Vector.

    System.Double min

    Min Length

    System.Double max

    Max Length

    Returns
    Double2

    ClampLength(Double2, Double, Double, out Double2)

    Makes sure that Length of the output vector is always below max and above min.

    Declaration
    public static void ClampLength(Double2 vector, double min, double max, out Double2 result)
    Parameters
    Double2 vector

    Input Vector.

    System.Double min

    Min Length

    System.Double max

    Max Length

    Double2 result

    The result value.

    Cross(Double2, Double2)

    Calculates the cross product of two vectors.

    Declaration
    public static double Cross(Double2 left, Double2 right)
    Parameters
    Double2 left

    First source vector.

    Double2 right

    Second source vector.

    Returns
    System.Double

    The cross product of the two vectors.

    Cross(ref Double2, ref Double2)

    Calculates the cross product of two vectors.

    Declaration
    public static double Cross(ref Double2 left, ref Double2 right)
    Parameters
    Double2 left

    First source vector.

    Double2 right

    Second source vector.

    Returns
    System.Double

    The cross product of the two vectors.

    Cross(ref Double2, ref Double2, out Double)

    Calculates the cross product of two vectors.

    Declaration
    public static void Cross(ref Double2 left, ref Double2 right, out double result)
    Parameters
    Double2 left

    First source vector.

    Double2 right

    Second source vector.

    System.Double result

    When the method completes, contains the cross product of the two vectors.

    Distance(Double2, Double2)

    Calculates the distance between two vectors.

    Declaration
    public static double Distance(Double2 value1, Double2 value2)
    Parameters
    Double2 value1

    The first vector.

    Double2 value2

    The second vector.

    Returns
    System.Double

    The distance between the two vectors.

    Remarks

    DistanceSquared(Double2, Double2) may be preferred when only the relative distance is needed and speed is of the essence.

    Distance(ref Double2, ref Double2)

    Calculates the distance between two vectors.

    Declaration
    public static double Distance(ref Double2 value1, ref Double2 value2)
    Parameters
    Double2 value1

    The first vector.

    Double2 value2

    The second vector.

    Returns
    System.Double

    The distance between the two vectors.

    Remarks

    DistanceSquared(ref Double2, ref Double2, out Double) may be preferred when only the relative distance is needed and speed is of the essence.

    Distance(ref Double2, ref Double2, out Double)

    Calculates the distance between two vectors.

    Declaration
    public static void Distance(ref Double2 value1, ref Double2 value2, out double result)
    Parameters
    Double2 value1

    The first vector.

    Double2 value2

    The second vector.

    System.Double result

    When the method completes, contains the distance between the two vectors.

    Remarks

    DistanceSquared(ref Double2, ref Double2, out Double) may be preferred when only the relative distance is needed and speed is of the essence.

    DistanceSquared(Double2, Double2)

    Calculates the squared distance between two vectors.

    Declaration
    public static double DistanceSquared(Double2 value1, Double2 value2)
    Parameters
    Double2 value1

    The first vector.

    Double2 value2

    The second vector.

    Returns
    System.Double

    The squared distance between the two vectors.

    DistanceSquared(ref Double2, ref Double2)

    Calculates the squared distance between two vectors.

    Declaration
    public static double DistanceSquared(ref Double2 value1, ref Double2 value2)
    Parameters
    Double2 value1

    The first vector.

    Double2 value2

    The second vector

    Returns
    System.Double

    The squared distance between the two vectors.

    DistanceSquared(ref Double2, ref Double2, out Double)

    Calculates the squared distance between two vectors.

    Declaration
    public static void DistanceSquared(ref Double2 value1, ref Double2 value2, out double result)
    Parameters
    Double2 value1

    The first vector.

    Double2 value2

    The second vector

    System.Double result

    When the method completes, contains the squared distance between the two vectors.

    Divide(Double2, Double)

    Scales a vector by the given value.

    Declaration
    public static Double2 Divide(Double2 value, double scale)
    Parameters
    Double2 value

    The vector to scale.

    System.Double scale

    The amount by which to scale the vector.

    Returns
    Double2

    The scaled vector.

    Divide(ref Double2, Double, out Double2)

    Scales a vector by the given value.

    Declaration
    public static void Divide(ref Double2 value, double scale, out Double2 result)
    Parameters
    Double2 value

    The vector to scale.

    System.Double scale

    The amount by which to scale the vector.

    Double2 result

    When the method completes, contains the scaled vector.

    Divide(Double, Double2)

    Scales a vector by the given value.

    Declaration
    public static Double2 Divide(double scale, Double2 value)
    Parameters
    System.Double scale

    The amount by which to scale the vector.

    Double2 value

    The vector to scale.

    Returns
    Double2

    The scaled vector.

    Divide(Double, ref Double2, out Double2)

    Scales a vector by the given value.

    Declaration
    public static void Divide(double scale, ref Double2 value, out Double2 result)
    Parameters
    System.Double scale

    The amount by which to scale the vector.

    Double2 value

    The vector to scale.

    Double2 result

    When the method completes, contains the scaled vector.

    Dot(Double2, Double2)

    Calculates the dot product of two vectors.

    Declaration
    public static double Dot(Double2 left, Double2 right)
    Parameters
    Double2 left

    First source vector.

    Double2 right

    Second source vector.

    Returns
    System.Double

    The dot product of the two vectors.

    Dot(ref Double2, ref Double2)

    Calculates the dot product of two vectors.

    Declaration
    public static double Dot(ref Double2 left, ref Double2 right)
    Parameters
    Double2 left

    First source vector.

    Double2 right

    Second source vector.

    Returns
    System.Double

    The dot product of the two vectors.

    Dot(ref Double2, ref Double2, out Double)

    Calculates the dot product of two vectors.

    Declaration
    public static void Dot(ref Double2 left, ref Double2 right, out double result)
    Parameters
    Double2 left

    First source vector.

    Double2 right

    Second source vector.

    System.Double result

    When the method completes, contains the dot product of the two vectors.

    Equals(Double2)

    Determines whether the specified Double2 is equal to this instance.

    Declaration
    public bool Equals(Double2 other)
    Parameters
    Double2 other

    The Double2 to compare with this instance.

    Returns
    System.Boolean

    true if the specified Double2 is equal to this instance; otherwise, false.

    Equals(ref Double2)

    Determines whether the specified Double2 is equal to this instance.

    Declaration
    public bool Equals(ref Double2 other)
    Parameters
    Double2 other

    The Double2 to compare with this instance.

    Returns
    System.Boolean

    true if the specified Double2 is equal to this instance; otherwise, false.

    Equals(ref Double2, ref Double2)

    Determines whether the specified Double2 are equal.

    Declaration
    public static bool Equals(ref Double2 a, ref Double2 b)
    Parameters
    Double2 a

    Double2 b

    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

    true if the specified System.Object is equal to this instance; otherwise, false.

    GetHashCode()

    Returns a hash code for this instance.

    Declaration
    public override int GetHashCode()
    Returns
    System.Int32

    Hermite(Double2, Double2, Double2, Double2, Double)

    Performs a Hermite spline interpolation.

    Declaration
    public static Double2 Hermite(Double2 value1, Double2 tangent1, Double2 value2, Double2 tangent2, double amount)
    Parameters
    Double2 value1

    First source position vector.

    Double2 tangent1

    First source tangent vector.

    Double2 value2

    Second source position vector.

    Double2 tangent2

    Second source tangent vector.

    System.Double amount

    Weighting factor.

    Returns
    Double2

    The result of the Hermite spline interpolation.

    Hermite(ref Double2, ref Double2, ref Double2, ref Double2, Double, out Double2)

    Performs a Hermite spline interpolation.

    Declaration
    public static void Hermite(ref Double2 value1, ref Double2 tangent1, ref Double2 value2, ref Double2 tangent2, double amount, out Double2 result)
    Parameters
    Double2 value1

    First source position vector.

    Double2 tangent1

    First source tangent vector.

    Double2 value2

    Second source position vector.

    Double2 tangent2

    Second source tangent vector.

    System.Double amount

    Weighting factor.

    Double2 result

    When the method completes, contains the result of the Hermite spline interpolation.

    Lerp(Double2, Double2, Double2)

    Performs a linear interpolation between two vectors.

    Declaration
    public static Double2 Lerp(Double2 start, Double2 end, Double2 amount)
    Parameters
    Double2 start

    Start vector.

    Double2 end

    End vector.

    Double2 amount

    Value between 0 and 1 indicating the weight of end.

    Returns
    Double2

    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(Double2, Double2, Double)

    Performs a linear interpolation between two vectors.

    Declaration
    public static Double2 Lerp(Double2 start, Double2 end, double amount)
    Parameters
    Double2 start

    Start vector.

    Double2 end

    End vector.

    System.Double amount

    Value between 0 and 1 indicating the weight of end.

    Returns
    Double2

    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 Double2, ref Double2, ref Double2, out Double2)

    Performs a linear interpolation between two vectors.

    Declaration
    public static void Lerp(ref Double2 start, ref Double2 end, ref Double2 amount, out Double2 result)
    Parameters
    Double2 start

    Start vector.

    Double2 end

    End vector.

    Double2 amount

    Value between 0 and 1 indicating the weight of end.

    Double2 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.

    Lerp(ref Double2, ref Double2, Double, out Double2)

    Performs a linear interpolation between two vectors.

    Declaration
    public static void Lerp(ref Double2 start, ref Double2 end, double amount, out Double2 result)
    Parameters
    Double2 start

    Start vector.

    Double2 end

    End vector.

    System.Double amount

    Value between 0 and 1 indicating the weight of end.

    Double2 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(Double2, Double2)

    Returns a vector containing the largest components of the specified vectors.

    Declaration
    public static Double2 Max(Double2 left, Double2 right)
    Parameters
    Double2 left

    The first source vector.

    Double2 right

    The second source vector.

    Returns
    Double2

    A vector containing the largest components of the source vectors.

    Max(ref Double2, ref Double2, out Double2)

    Returns a vector containing the largest components of the specified vectors.

    Declaration
    public static void Max(ref Double2 left, ref Double2 right, out Double2 result)
    Parameters
    Double2 left

    The first source vector.

    Double2 right

    The second source vector.

    Double2 result

    When the method completes, contains an new vector composed of the largest components of the source vectors.

    Min(Double2, Double2)

    Returns a vector containing the smallest components of the specified vectors.

    Declaration
    public static Double2 Min(Double2 left, Double2 right)
    Parameters
    Double2 left

    The first source vector.

    Double2 right

    The second source vector.

    Returns
    Double2

    A vector containing the smallest components of the source vectors.

    Min(ref Double2, ref Double2, out Double2)

    Returns a vector containing the smallest components of the specified vectors.

    Declaration
    public static void Min(ref Double2 left, ref Double2 right, out Double2 result)
    Parameters
    Double2 left

    The first source vector.

    Double2 right

    The second source vector.

    Double2 result

    When the method completes, contains an new vector composed of the smallest components of the source vectors.

    Mod(Double2)

    Breaks the components of the vector into an integral and a fractional part. Returns vector made of fractional parts.

    Declaration
    public static Double2 Mod(Double2 v)
    Parameters
    Double2 v

    The value.

    Returns
    Double2

    The result.

    Multiply(Double2, Double2)

    Multiplies a vector with another by performing component-wise multiplication.

    Declaration
    public static Double2 Multiply(Double2 left, Double2 right)
    Parameters
    Double2 left

    The first vector to multiply.

    Double2 right

    The second vector to multiply.

    Returns
    Double2

    The multiplied vector.

    Multiply(Double2, Double)

    Scales a vector by the given value.

    Declaration
    public static Double2 Multiply(Double2 value, double scale)
    Parameters
    Double2 value

    The vector to scale.

    System.Double scale

    The amount by which to scale the vector.

    Returns
    Double2

    The scaled vector.

    Multiply(ref Double2, ref Double2, out Double2)

    Multiplies a vector with another by performing component-wise multiplication.

    Declaration
    public static void Multiply(ref Double2 left, ref Double2 right, out Double2 result)
    Parameters
    Double2 left

    The first vector to multiply.

    Double2 right

    The second vector to multiply.

    Double2 result

    When the method completes, contains the multiplied vector.

    Multiply(ref Double2, Double, out Double2)

    Scales a vector by the given value.

    Declaration
    public static void Multiply(ref Double2 value, double scale, out Double2 result)
    Parameters
    Double2 value

    The vector to scale.

    System.Double scale

    The amount by which to scale the vector.

    Double2 result

    When the method completes, contains the scaled vector.

    NearEqual(Double2, Double2, Double)

    Tests whether one vector is near another vector.

    Declaration
    public static bool NearEqual(Double2 left, Double2 right, double epsilon = 1E-16)
    Parameters
    Double2 left

    The left vector.

    Double2 right

    The right vector.

    System.Double epsilon

    The epsilon.

    Returns
    System.Boolean

    true if left and right are near, false otherwise

    NearEqual(ref Double2, ref Double2, Double)

    Tests whether one vector is near another vector.

    Declaration
    public static bool NearEqual(ref Double2 left, ref Double2 right, double epsilon = 1E-16)
    Parameters
    Double2 left

    The left vector.

    Double2 right

    The right vector.

    System.Double epsilon

    The epsilon.

    Returns
    System.Boolean

    true if left and right are near another, false otherwise

    Negate(Double2)

    Reverses the direction of a given vector.

    Declaration
    public static Double2 Negate(Double2 value)
    Parameters
    Double2 value

    The vector to negate.

    Returns
    Double2

    A vector facing in the opposite direction.

    Negate(ref Double2, out Double2)

    Reverses the direction of a given vector.

    Declaration
    public static void Negate(ref Double2 value, out Double2 result)
    Parameters
    Double2 value

    The vector to negate.

    Double2 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(Double2)

    Converts the vector into a unit vector.

    Declaration
    public static Double2 Normalize(Double2 value)
    Parameters
    Double2 value

    The vector to normalize.

    Returns
    Double2

    The normalized vector.

    Normalize(ref Double2, out Double2)

    Converts the vector into a unit vector.

    Declaration
    public static void Normalize(ref Double2 value, out Double2 result)
    Parameters
    Double2 value

    The vector to normalize.

    Double2 result

    When the method completes, contains the normalized vector.

    Perpendicular(Double2)

    Calculates the 2D vector perpendicular to the given 2D vector. The result is always rotated 90-degrees in a counter-clockwise direction for a 2D coordinate system where the positive Y axis goes up.

    Declaration
    public static Double2 Perpendicular(Double2 inDirection)
    Parameters
    Double2 inDirection

    The input direction.

    Returns
    Double2

    The result.

    Perpendicular(ref Double2, out Double2)

    Calculates the 2D vector perpendicular to the given 2D vector. The result is always rotated 90-degrees in a counter-clockwise direction for a 2D coordinate system where the positive Y axis goes up.

    Declaration
    public static void Perpendicular(ref Double2 inDirection, out Double2 result)
    Parameters
    Double2 inDirection

    The in direction.

    Double2 result

    When the method completes, contains the result of the calculation.

    Reflect(Double2, Double2)

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

    Declaration
    public static Double2 Reflect(Double2 vector, Double2 normal)
    Parameters
    Double2 vector

    The source vector.

    Double2 normal

    Normal of the surface.

    Returns
    Double2

    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 Double2, ref Double2, out Double2)

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

    Declaration
    public static void Reflect(ref Double2 vector, ref Double2 normal, out Double2 result)
    Parameters
    Double2 vector

    The source vector.

    Double2 normal

    Normal of the surface.

    Double2 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.

    Round(Double2)

    Returns the vector with components rounded to the nearest integer.

    Declaration
    public static Double2 Round(Double2 v)
    Parameters
    Double2 v

    The value.

    Returns
    Double2

    The result.

    Saturate()

    Saturates this instance in the range [0,1].

    Declaration
    public void Saturate()

    SmoothStep(Double2, Double2, Double)

    Performs a cubic interpolation between two vectors.

    Declaration
    public static Double2 SmoothStep(Double2 start, Double2 end, double amount)
    Parameters
    Double2 start

    Start vector.

    Double2 end

    End vector.

    System.Double amount

    Value between 0 and 1 indicating the weight of end.

    Returns
    Double2

    The cubic interpolation of the two vectors.

    SmoothStep(ref Double2, ref Double2, Double, out Double2)

    Performs a cubic interpolation between two vectors.

    Declaration
    public static void SmoothStep(ref Double2 start, ref Double2 end, double amount, out Double2 result)
    Parameters
    Double2 start

    Start vector.

    Double2 end

    End vector.

    System.Double amount

    Value between 0 and 1 indicating the weight of end.

    Double2 result

    When the method completes, contains the cubic interpolation of the two vectors.

    SnapToGrid(Double2, Double2)

    Snaps the input position into the grid.

    Declaration
    public static Double2 SnapToGrid(Double2 pos, Double2 gridSize)
    Parameters
    Double2 pos

    The position to snap.

    Double2 gridSize

    The size of the grid.

    Returns
    Double2

    The position snapped to the grid.

    Subtract(Double2, Double2)

    Subtracts two vectors.

    Declaration
    public static Double2 Subtract(Double2 left, Double2 right)
    Parameters
    Double2 left

    The first vector to subtract.

    Double2 right

    The second vector to subtract.

    Returns
    Double2

    The difference of the two vectors.

    Subtract(Double2, Double)

    Performs a component-wise subtraction.

    Declaration
    public static Double2 Subtract(Double2 left, double right)
    Parameters
    Double2 left

    The input vector

    System.Double right

    The scalar value to be subtracted from elements

    Returns
    Double2

    The vector with subtracted scalar for each element.

    Subtract(ref Double2, ref Double2, out Double2)

    Subtracts two vectors.

    Declaration
    public static void Subtract(ref Double2 left, ref Double2 right, out Double2 result)
    Parameters
    Double2 left

    The first vector to subtract.

    Double2 right

    The second vector to subtract.

    Double2 result

    When the method completes, contains the difference of the two vectors.

    Subtract(ref Double2, ref Double, out Double2)

    Performs a component-wise subtraction.

    Declaration
    public static void Subtract(ref Double2 left, ref double right, out Double2 result)
    Parameters
    Double2 left

    The input vector

    System.Double right

    The scalar value to be subtracted from elements

    Double2 result

    The vector with subtracted scalar for each element.

    Subtract(Double, Double2)

    Performs a component-wise subtraction.

    Declaration
    public static Double2 Subtract(double left, Double2 right)
    Parameters
    System.Double left

    The scalar value to be subtracted from elements

    Double2 right

    The input vector

    Returns
    Double2

    The vector with subtracted scalar for each element.

    Subtract(ref Double, ref Double2, out Double2)

    Performs a component-wise subtraction.

    Declaration
    public static void Subtract(ref double left, ref Double2 right, out Double2 result)
    Parameters
    System.Double left

    The scalar value to be subtracted from elements

    Double2 right

    The input vector

    Double2 result

    The vector with subtracted scalar for each element.

    ToArray()

    Creates an array containing the elements of the vector.

    Declaration
    public double[] ToArray()
    Returns
    System.Double[]

    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(Double2, Matrix)

    Transforms a 2D vector by the given Matrix.

    Declaration
    public static Double4 Transform(Double2 vector, Matrix transform)
    Parameters
    Double2 vector

    The source vector.

    Matrix transform

    The transformation Matrix.

    Returns
    Double4

    The transformed Double4.

    Transform(Double2, Quaternion)

    Transforms a 2D vector by the given Quaternion rotation.

    Declaration
    public static Double2 Transform(Double2 vector, Quaternion rotation)
    Parameters
    Double2 vector

    The vector to rotate.

    Quaternion rotation

    The Quaternion rotation to apply.

    Returns
    Double2

    The transformed Double4.

    Transform(ref Double2, ref Matrix, out Double4)

    Transforms a 2D vector by the given Matrix.

    Declaration
    public static void Transform(ref Double2 vector, ref Matrix transform, out Double4 result)
    Parameters
    Double2 vector

    The source vector.

    Matrix transform

    The transformation Matrix.

    Double4 result

    When the method completes, contains the transformed Double4.

    Transform(ref Double2, ref Quaternion, out Double2)

    Transforms a 2D vector by the given Quaternion rotation.

    Declaration
    public static void Transform(ref Double2 vector, ref Quaternion rotation, out Double2 result)
    Parameters
    Double2 vector

    The vector to rotate.

    Quaternion rotation

    The Quaternion rotation to apply.

    Double2 result

    When the method completes, contains the transformed Double4.

    TransformCoordinate(Double2, Matrix)

    Performs a coordinate transformation using the given Matrix.

    Declaration
    public static Double2 TransformCoordinate(Double2 coordinate, Matrix transform)
    Parameters
    Double2 coordinate

    The coordinate vector to transform.

    Matrix transform

    The transformation Matrix.

    Returns
    Double2

    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 Double2, ref Matrix, out Double2)

    Performs a coordinate transformation using the given Matrix.

    Declaration
    public static void TransformCoordinate(ref Double2 coordinate, ref Matrix transform, out Double2 result)
    Parameters
    Double2 coordinate

    The coordinate vector to transform.

    Matrix transform

    The transformation Matrix.

    Double2 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(Double2, Matrix)

    Performs a normal transformation using the given Matrix.

    Declaration
    public static Double2 TransformNormal(Double2 normal, Matrix transform)
    Parameters
    Double2 normal

    The normal vector to transform.

    Matrix transform

    The transformation Matrix.

    Returns
    Double2

    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 Double2, ref Matrix, out Double2)

    Performs a normal transformation using the given Matrix.

    Declaration
    public static void TransformNormal(ref Double2 normal, ref Matrix transform, out Double2 result)
    Parameters
    Double2 normal

    The normal vector to transform.

    Matrix transform

    The transformation Matrix.

    Double2 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.

    TriangleArea(ref Double2, ref Double2, ref Double2)

    Calculates the area of the triangle.

    Declaration
    public static double TriangleArea(ref Double2 v0, ref Double2 v1, ref Double2 v2)
    Parameters
    Double2 v0

    The first triangle vertex.

    Double2 v1

    The second triangle vertex.

    Double2 v2

    The third triangle vertex.

    Returns
    System.Double

    The triangle area.

    Operators

    Addition(Double2, Double2)

    Adds two vectors.

    Declaration
    public static Double2 operator +(Double2 left, Double2 right)
    Parameters
    Double2 left

    The first vector to add.

    Double2 right

    The second vector to add.

    Returns
    Double2

    The sum of the two vectors.

    Addition(Double2, Double)

    Performs a component-wise addition.

    Declaration
    public static Double2 operator +(Double2 value, double scalar)
    Parameters
    Double2 value

    The input vector.

    System.Double scalar

    The scalar value to be added on elements

    Returns
    Double2

    The vector with added scalar for each element.

    Addition(Double, Double2)

    Performs a component-wise addition.

    Declaration
    public static Double2 operator +(double scalar, Double2 value)
    Parameters
    System.Double scalar

    The scalar value to be added on elements

    Double2 value

    The input vector.

    Returns
    Double2

    The vector with added scalar for each element.

    Division(Double2, Double2)

    Scales a vector by the given value.

    Declaration
    public static Double2 operator /(Double2 value, Double2 scale)
    Parameters
    Double2 value

    The vector to scale.

    Double2 scale

    The amount by which to scale the vector.

    Returns
    Double2

    The scaled vector.

    Division(Double2, Double)

    Scales a vector by the given value.

    Declaration
    public static Double2 operator /(Double2 value, double scale)
    Parameters
    Double2 value

    The vector to scale.

    System.Double scale

    The amount by which to scale the vector.

    Returns
    Double2

    The scaled vector.

    Division(Double, Double2)

    Scales a vector by the given value.

    Declaration
    public static Double2 operator /(double scale, Double2 value)
    Parameters
    System.Double scale

    The amount by which to scale the vector.

    Double2 value

    The vector to scale.

    Returns
    Double2

    The scaled vector.

    Equality(Double2, Double2)

    Tests for equality between two objects.

    Declaration
    public static bool operator ==(Double2 left, Double2 right)
    Parameters
    Double2 left

    The first value to compare.

    Double2 right

    The second value to compare.

    Returns
    System.Boolean

    true if left has the same value as right; otherwise,false.

    Explicit(Double2 to Double3)

    Performs an explicit conversion from Double2 to Vector3.

    Declaration
    public static explicit operator Double3(Double2 value)
    Parameters
    Double2 value

    The value.

    Returns
    Double3

    The result of the conversion.

    Explicit(Double2 to Double4)

    Performs an explicit conversion from Double2 to Double4.

    Declaration
    public static explicit operator Double4(Double2 value)
    Parameters
    Double2 value

    The value.

    Returns
    Double4

    The result of the conversion.

    Implicit(Double2 to Float2)

    Performs an implicit conversion from Double2 to Float2.

    Declaration
    public static implicit operator Float2(Double2 value)
    Parameters
    Double2 value

    The value.

    Returns
    Float2

    The result of the conversion.

    Implicit(Double2 to Vector2)

    Performs an implicit conversion from Double2 to Vector2.

    Declaration
    public static implicit operator Vector2(Double2 value)
    Parameters
    Double2 value

    The value.

    Returns
    Vector2

    The result of the conversion.

    Inequality(Double2, Double2)

    Tests for inequality between two objects.

    Declaration
    public static bool operator !=(Double2 left, Double2 right)
    Parameters
    Double2 left

    The first value to compare.

    Double2 right

    The second value to compare.

    Returns
    System.Boolean

    true if left has a different value than right; otherwise,false.

    Modulus(Double2, Double2)

    Remainder of value divided by scale.

    Declaration
    public static Double2 operator %(Double2 value, Double2 scale)
    Parameters
    Double2 value

    The vector to scale.

    Double2 scale

    The amount by which to scale the vector.

    Returns
    Double2

    The remained vector.

    Modulus(Double2, Double)

    Remainder of value divided by scale.

    Declaration
    public static Double2 operator %(Double2 value, double scale)
    Parameters
    Double2 value

    The vector to scale.

    System.Double scale

    The amount by which to scale the vector.

    Returns
    Double2

    The remained vector.

    Modulus(Double, Double2)

    Remainder of value divided by scale.

    Declaration
    public static Double2 operator %(double value, Double2 scale)
    Parameters
    System.Double value

    The amount by which to scale the vector.

    Double2 scale

    The vector to scale.

    Returns
    Double2

    The remained vector.

    Multiply(Double2, Double2)

    Multiplies a vector with another by performing component-wise multiplication equivalent to Multiply(ref Double2, ref Double2, out Double2).

    Declaration
    public static Double2 operator *(Double2 left, Double2 right)
    Parameters
    Double2 left

    The first vector to multiply.

    Double2 right

    The second vector to multiply.

    Returns
    Double2

    The multiplication of the two vectors.

    Multiply(Double2, Double)

    Scales a vector by the given value.

    Declaration
    public static Double2 operator *(Double2 value, double scale)
    Parameters
    Double2 value

    The vector to scale.

    System.Double scale

    The amount by which to scale the vector.

    Returns
    Double2

    The scaled vector.

    Multiply(Double, Double2)

    Scales a vector by the given value.

    Declaration
    public static Double2 operator *(double scale, Double2 value)
    Parameters
    System.Double scale

    The amount by which to scale the vector.

    Double2 value

    The vector to scale.

    Returns
    Double2

    The scaled vector.

    Subtraction(Double2, Double2)

    Subtracts two vectors.

    Declaration
    public static Double2 operator -(Double2 left, Double2 right)
    Parameters
    Double2 left

    The first vector to subtract.

    Double2 right

    The second vector to subtract.

    Returns
    Double2

    The difference of the two vectors.

    Subtraction(Double2, Double)

    Performs a component-wise subtraction.

    Declaration
    public static Double2 operator -(Double2 value, double scalar)
    Parameters
    Double2 value

    The input vector.

    System.Double scalar

    The scalar value to be subtracted from elements

    Returns
    Double2

    The vector with subtracted scalar from each element.

    Subtraction(Double, Double2)

    Performs a component-wise subtraction.

    Declaration
    public static Double2 operator -(double scalar, Double2 value)
    Parameters
    System.Double scalar

    The scalar value to be subtracted from elements

    Double2 value

    The input vector.

    Returns
    Double2

    The vector with subtracted scalar from each element.

    UnaryNegation(Double2)

    Reverses the direction of a given vector.

    Declaration
    public static Double2 operator -(Double2 value)
    Parameters
    Double2 value

    The vector to negate.

    Returns
    Double2

    A vector facing in the opposite direction.

    UnaryPlus(Double2)

    Assert a vector (return it unchanged).

    Declaration
    public static Double2 operator +(Double2 value)
    Parameters
    Double2 value

    The vector to assert (unchanged).

    Returns
    Double2

    The asserted (unchanged) vector.

    Extension Methods

    Extensions.ReflectiveCompare<T>(T, T)
    Extensions.RawClone<T>(T)
    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat