Show / Hide Table of Contents

Struct Vector2d

Represents a 2D vector using two double-precision floating-point numbers.

Implements
IEquatable<Vector2d>
IFormattable
Inherited Members
object.Equals(object, object)
object.GetType()
object.ReferenceEquals(object, object)
Namespace: OpenTK.Mathematics
Assembly: OpenTK.Mathematics.dll
Syntax
[Serializable]
public struct Vector2d : IEquatable<Vector2d>, IFormattable

Constructors

Vector2d(double, double)

Initializes a new instance of the Vector2d struct.

Declaration
public Vector2d(double x, double y)
Parameters
Type Name Description
double x

The X coordinate.

double y

The Y coordinate.

Vector2d(double)

Initializes a new instance of the Vector2d struct.

Declaration
public Vector2d(double value)
Parameters
Type Name Description
double value

The value that will initialize this instance.

Fields

NegativeInfinity

Defines an instance with all components set to negative infinity.

Declaration
public static readonly Vector2d NegativeInfinity
Field Value
Type Description
Vector2d

One

Defines an instance with all components set to 1.

Declaration
public static readonly Vector2d One
Field Value
Type Description
Vector2d

PositiveInfinity

Defines an instance with all components set to positive infinity.

Declaration
public static readonly Vector2d PositiveInfinity
Field Value
Type Description
Vector2d

SizeInBytes

Defines the size of the Vector2d struct in bytes.

Declaration
public static readonly int SizeInBytes
Field Value
Type Description
int

UnitX

Defines a unit-length Vector2d that points towards the X-axis.

Declaration
public static readonly Vector2d UnitX
Field Value
Type Description
Vector2d

UnitY

Defines a unit-length Vector2d that points towards the Y-axis.

Declaration
public static readonly Vector2d UnitY
Field Value
Type Description
Vector2d

X

The X coordinate of this instance.

Declaration
public double X
Field Value
Type Description
double

Y

The Y coordinate of this instance.

Declaration
public double Y
Field Value
Type Description
double

Zero

Defines an instance with all components set to 0.

Declaration
public static readonly Vector2d Zero
Field Value
Type Description
Vector2d

Properties

this[int]

Gets or sets the value at the index of the Vector.

Declaration
public double this[int index] { readonly get; set; }
Parameters
Type Name Description
int index

The index of the component from the Vector.

Property Value
Type Description
double
Exceptions
Type Condition
IndexOutOfRangeException

Thrown if the index is less than 0 or greater than 1.

Length

Gets the length (magnitude) of the vector.

Declaration
public readonly double Length { get; }
Property Value
Type Description
double
See Also
LengthSquared

LengthFast

Gets an approximation of the vector length (magnitude).

Declaration
public readonly double LengthFast { get; }
Property Value
Type Description
double
Remarks

This property uses an approximation of the square root function to calculate vector magnitude, with an upper error bound of 0.001.

See Also
LengthSquared

LengthSquared

Gets the square of the vector length (magnitude).

Declaration
public readonly double LengthSquared { get; }
Property Value
Type Description
double
Remarks

This property avoids the costly square root operation required by the Length property. This makes it more suitable for comparisons.

PerpendicularLeft

Gets the perpendicular vector on the left side of this vector.

Declaration
public readonly Vector2d PerpendicularLeft { get; }
Property Value
Type Description
Vector2d

PerpendicularRight

Gets the perpendicular vector on the right side of this vector.

Declaration
public readonly Vector2d PerpendicularRight { get; }
Property Value
Type Description
Vector2d

ReciprocalLengthFast

Gets an approximation of 1 over the length (magnitude) of the vector.

Declaration
public readonly double ReciprocalLengthFast { get; }
Property Value
Type Description
double

Yx

Gets or sets an OpenTK.Vector2d with the Y and X components of this instance.

Declaration
public Vector2d Yx { readonly get; set; }
Property Value
Type Description
Vector2d

Methods

Abs()

Returns a new vector that is the component-wise absolute value of the vector.

Declaration
public readonly Vector2d Abs()
Returns
Type Description
Vector2d

The component-wise absolute value vector.

Abs(Vector2d)

Take the component-wise absolute value of a vector.

Declaration
public static Vector2d Abs(Vector2d vec)
Parameters
Type Name Description
Vector2d vec

The vector to apply component-wise absolute value to.

Returns
Type Description
Vector2d

The component-wise absolute value vector.

Abs(in Vector2d, out Vector2d)

Take the component-wise absolute value of a vector.

Declaration
public static void Abs(in Vector2d vec, out Vector2d result)
Parameters
Type Name Description
Vector2d vec

The vector to apply component-wise absolute value to.

Vector2d result

The component-wise absolute value vector.

Add(Vector2d, Vector2d)

Adds two vectors.

Declaration
[Pure]
public static Vector2d Add(Vector2d a, Vector2d b)
Parameters
Type Name Description
Vector2d a

Left operand.

Vector2d b

Right operand.

Returns
Type Description
Vector2d

Result of operation.

Add(in Vector2d, in Vector2d, out Vector2d)

Adds two vectors.

Declaration
public static void Add(in Vector2d a, in Vector2d b, out Vector2d result)
Parameters
Type Name Description
Vector2d a

Left operand.

Vector2d b

Right operand.

Vector2d result

Result of operation.

BaryCentric(Vector2d, Vector2d, Vector2d, double, double)

Interpolate 3 Vectors using Barycentric coordinates.

Declaration
[Pure]
public static Vector2d BaryCentric(Vector2d a, Vector2d b, Vector2d c, double u, double v)
Parameters
Type Name Description
Vector2d a

First input Vector.

Vector2d b

Second input Vector.

Vector2d c

Third input Vector.

double u

First Barycentric Coordinate.

double v

Second Barycentric Coordinate.

Returns
Type Description
Vector2d

a when u=v=0, b when u=1,v=0, c when u=0,v=1, and a linear combination of a,b,c otherwise.

BaryCentric(in Vector2d, in Vector2d, in Vector2d, double, double, out Vector2d)

Interpolate 3 Vectors using Barycentric coordinates.

Declaration
public static void BaryCentric(in Vector2d a, in Vector2d b, in Vector2d c, double u, double v, out Vector2d result)
Parameters
Type Name Description
Vector2d a

First input Vector.

Vector2d b

Second input Vector.

Vector2d c

Third input Vector.

double u

First Barycentric Coordinate.

double v

Second Barycentric Coordinate.

Vector2d result

Output Vector. a when u=v=0, b when u=1,v=0, c when u=0,v=1, and a linear combination of a,b,c otherwise.

Ceiling()

Returns a new vector were a component-wise ceiling operation has been applied. Equivalent to calling Ceiling(double) on each component.

Declaration
public readonly Vector2d Ceiling()
Returns
Type Description
Vector2d

The ceiled vector.

Ceiling(Vector2d)

Component-wise ceiling operation. Equivalent to calling Ceiling(double) on each component.

Declaration
[Pure]
public static Vector2d Ceiling(Vector2d vec)
Parameters
Type Name Description
Vector2d vec

The vector to take the ceiling of.

Returns
Type Description
Vector2d

The component-wise ceiling vector.

Ceiling(in Vector2d, out Vector2d)

Component-wise ceiling operation. Equivalent to calling Ceiling(double) on each component.

Declaration
public static void Ceiling(in Vector2d vec, out Vector2d result)
Parameters
Type Name Description
Vector2d vec

The vector to take the ceiling of.

Vector2d result

The component-wise ceiling vector.

Clamp(Vector2d, Vector2d, Vector2d)

Clamp a vector to the given minimum and maximum vectors.

Declaration
[Pure]
public static Vector2d Clamp(Vector2d vec, Vector2d min, Vector2d max)
Parameters
Type Name Description
Vector2d vec

Input vector.

Vector2d min

Minimum vector.

Vector2d max

Maximum vector.

Returns
Type Description
Vector2d

The clamped vector.

Clamp(in Vector2d, in Vector2d, in Vector2d, out Vector2d)

Clamp a vector to the given minimum and maximum vectors.

Declaration
public static void Clamp(in Vector2d vec, in Vector2d min, in Vector2d max, out Vector2d result)
Parameters
Type Name Description
Vector2d vec

Input vector.

Vector2d min

Minimum vector.

Vector2d max

Maximum vector.

Vector2d result

The clamped vector.

ComponentMax(Vector2d, Vector2d)

Returns a vector created from the largest of the corresponding components of the given vectors.

Declaration
[Pure]
public static Vector2d ComponentMax(Vector2d a, Vector2d b)
Parameters
Type Name Description
Vector2d a

First operand.

Vector2d b

Second operand.

Returns
Type Description
Vector2d

The component-wise maximum.

ComponentMax(in Vector2d, in Vector2d, out Vector2d)

Returns a vector created from the largest of the corresponding components of the given vectors.

Declaration
public static void ComponentMax(in Vector2d a, in Vector2d b, out Vector2d result)
Parameters
Type Name Description
Vector2d a

First operand.

Vector2d b

Second operand.

Vector2d result

The component-wise maximum.

ComponentMin(Vector2d, Vector2d)

Returns a vector created from the smallest of the corresponding components of the given vectors.

Declaration
[Pure]
public static Vector2d ComponentMin(Vector2d a, Vector2d b)
Parameters
Type Name Description
Vector2d a

First operand.

Vector2d b

Second operand.

Returns
Type Description
Vector2d

The component-wise minimum.

ComponentMin(in Vector2d, in Vector2d, out Vector2d)

Returns a vector created from the smallest of the corresponding components of the given vectors.

Declaration
public static void ComponentMin(in Vector2d a, in Vector2d b, out Vector2d result)
Parameters
Type Name Description
Vector2d a

First operand.

Vector2d b

Second operand.

Vector2d result

The component-wise minimum.

Deconstruct(out double, out double)

Deconstructs the vector into it's individual components.

Declaration
[Pure]
public readonly void Deconstruct(out double x, out double y)
Parameters
Type Name Description
double x

The X component of the vector.

double y

The Y component of the vector.

Distance(Vector2d, Vector2d)

Compute the euclidean distance between two vectors.

Declaration
[Pure]
public static double Distance(Vector2d vec1, Vector2d vec2)
Parameters
Type Name Description
Vector2d vec1

The first vector.

Vector2d vec2

The second vector.

Returns
Type Description
double

The distance.

Distance(in Vector2d, in Vector2d, out double)

Compute the euclidean distance between two vectors.

Declaration
public static void Distance(in Vector2d vec1, in Vector2d vec2, out double result)
Parameters
Type Name Description
Vector2d vec1

The first vector.

Vector2d vec2

The second vector.

double result

The distance.

DistanceSquared(Vector2d, Vector2d)

Compute the squared euclidean distance between two vectors.

Declaration
[Pure]
public static double DistanceSquared(Vector2d vec1, Vector2d vec2)
Parameters
Type Name Description
Vector2d vec1

The first vector.

Vector2d vec2

The second vector.

Returns
Type Description
double

The squared distance.

DistanceSquared(in Vector2d, in Vector2d, out double)

Compute the squared euclidean distance between two vectors.

Declaration
public static void DistanceSquared(in Vector2d vec1, in Vector2d vec2, out double result)
Parameters
Type Name Description
Vector2d vec1

The first vector.

Vector2d vec2

The second vector.

double result

The squared distance.

Divide(Vector2d, Vector2d)

Divides a vector by the components of a vector (scale).

Declaration
[Pure]
public static Vector2d Divide(Vector2d vector, Vector2d scale)
Parameters
Type Name Description
Vector2d vector

Left operand.

Vector2d scale

Right operand.

Returns
Type Description
Vector2d

Result of the operation.

Divide(Vector2d, double)

Divides a vector by a scalar.

Declaration
[Pure]
public static Vector2d Divide(Vector2d vector, double scale)
Parameters
Type Name Description
Vector2d vector

Left operand.

double scale

Right operand.

Returns
Type Description
Vector2d

Result of the operation.

Divide(in Vector2d, in Vector2d, out Vector2d)

Divide a vector by the components of a vector (scale).

Declaration
public static void Divide(in Vector2d vector, in Vector2d scale, out Vector2d result)
Parameters
Type Name Description
Vector2d vector

Left operand.

Vector2d scale

Right operand.

Vector2d result

Result of the operation.

Divide(in Vector2d, double, out Vector2d)

Divides a vector by a scalar.

Declaration
public static void Divide(in Vector2d vector, double scale, out Vector2d result)
Parameters
Type Name Description
Vector2d vector

Left operand.

double scale

Right operand.

Vector2d result

Result of the operation.

Dot(Vector2d, Vector2d)

Calculate the dot (scalar) product of two vectors.

Declaration
[Pure]
public static double Dot(Vector2d left, Vector2d right)
Parameters
Type Name Description
Vector2d left

First operand.

Vector2d right

Second operand.

Returns
Type Description
double

The dot product of the two inputs.

Dot(in Vector2d, in Vector2d, out double)

Calculate the dot (scalar) product of two vectors.

Declaration
public static void Dot(in Vector2d left, in Vector2d right, out double result)
Parameters
Type Name Description
Vector2d left

First operand.

Vector2d right

Second operand.

double result

The dot product of the two inputs.

Elerp(Vector2d, Vector2d, double)

Returns a new vector that is the exponential interpolation of the two vectors. Equivalent to a * pow(b/a, t).

Declaration
public static Vector2d Elerp(Vector2d a, Vector2d b, double t)
Parameters
Type Name Description
Vector2d a

The starting value. Must be non-negative.

Vector2d b

The end value. Must be non-negative.

double t

The blend factor.

Returns
Type Description
Vector2d

The exponential interpolation between a and b.

See Also
Elerp(double, double, double)

Elerp(in Vector2d, in Vector2d, double, out Vector2d)

Returns a new vector that is the exponential interpolation of the two vectors. Equivalent to a * pow(b/a, t).

Declaration
public static void Elerp(in Vector2d a, in Vector2d b, double t, out Vector2d result)
Parameters
Type Name Description
Vector2d a

The starting value. Must be non-negative.

Vector2d b

The end value. Must be non-negative.

double t

The blend factor.

Vector2d result

The exponential interpolation between a and b.

See Also
Elerp(double, double, double)

Equals(Vector2d)

Declaration
public readonly bool Equals(Vector2d other)
Parameters
Type Name Description
Vector2d other
Returns
Type Description
bool

Equals(object)

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
object obj
Returns
Type Description
bool
Overrides
ValueType.Equals(object)

Floor()

Returns a new vector were a component-wise floor operation has been applied. Equivalent to calling Floor(double) on each component.

Declaration
public readonly Vector2d Floor()
Returns
Type Description
Vector2d

The floored vector.

Floor(Vector2d)

Component-wise floor operation. Equivalent to calling Floor(double) on each component.

Declaration
[Pure]
public static Vector2d Floor(Vector2d vec)
Parameters
Type Name Description
Vector2d vec

The vector to take the floor of.

Returns
Type Description
Vector2d

The component-wise floored vector.

Floor(in Vector2d, out Vector2d)

Component-wise floor operation. Equivalent to calling Floor(double) on each component.

Declaration
public static void Floor(in Vector2d vec, out Vector2d result)
Parameters
Type Name Description
Vector2d vec

The vector to take the floor of.

Vector2d result

The component-wise floored vector.

GetHashCode()

Declaration
public override readonly int GetHashCode()
Returns
Type Description
int
Overrides
ValueType.GetHashCode()

Lerp(Vector2d, Vector2d, Vector2d)

Returns a new vector that is the component-wise linear blend of the 2 given vectors.

Declaration
[Pure]
public static Vector2d Lerp(Vector2d a, Vector2d b, Vector2d blend)
Parameters
Type Name Description
Vector2d a

First input vector.

Vector2d b

Second input vector.

Vector2d blend

The blend factor.

Returns
Type Description
Vector2d

a when blend=0, b when blend=1, and a component-wise linear combination otherwise.

Lerp(Vector2d, Vector2d, double)

Returns a new vector that is the linear blend of the 2 given vectors.

Declaration
[Pure]
public static Vector2d Lerp(Vector2d a, Vector2d b, double blend)
Parameters
Type Name Description
Vector2d a

First input vector.

Vector2d b

Second input vector.

double blend

The blend factor.

Returns
Type Description
Vector2d

a when blend=0, b when blend=1, and a linear combination otherwise.

Lerp(in Vector2d, in Vector2d, Vector2d, out Vector2d)

Returns a new vector that is the component-wise linear blend of the 2 given vectors.

Declaration
public static void Lerp(in Vector2d a, in Vector2d b, Vector2d blend, out Vector2d result)
Parameters
Type Name Description
Vector2d a

First input vector.

Vector2d b

Second input vector.

Vector2d blend

The blend factor.

Vector2d result

a when blend=0, b when blend=1, and a component-wise linear combination otherwise.

Lerp(in Vector2d, in Vector2d, double, out Vector2d)

Returns a new vector that is the linear blend of the 2 given vectors.

Declaration
public static void Lerp(in Vector2d a, in Vector2d b, double blend, out Vector2d result)
Parameters
Type Name Description
Vector2d a

First input vector.

Vector2d b

Second input vector.

double blend

The blend factor.

Vector2d result

a when blend=0, b when blend=1, and a linear combination otherwise.

MagnitudeMax(Vector2d, Vector2d)

Returns the Vector2d with the minimum magnitude. If the magnitudes are equal, the first vector is selected.

Declaration
[Pure]
public static Vector2d MagnitudeMax(Vector2d left, Vector2d right)
Parameters
Type Name Description
Vector2d left

Left operand.

Vector2d right

Right operand.

Returns
Type Description
Vector2d

The minimum Vector2d.

MagnitudeMax(in Vector2d, in Vector2d, out Vector2d)

Returns the Vector2d with the maximum magnitude. If the magnitudes are equal, the first vector is selected.

Declaration
public static void MagnitudeMax(in Vector2d left, in Vector2d right, out Vector2d result)
Parameters
Type Name Description
Vector2d left

Left operand.

Vector2d right

Right operand.

Vector2d result

The magnitude-wise maximum.

MagnitudeMin(Vector2d, Vector2d)

Returns the Vector2d with the minimum magnitude. If the magnitudes are equal, the second vector is selected.

Declaration
[Pure]
public static Vector2d MagnitudeMin(Vector2d left, Vector2d right)
Parameters
Type Name Description
Vector2d left

Left operand.

Vector2d right

Right operand.

Returns
Type Description
Vector2d

The minimum Vector2d.

MagnitudeMin(in Vector2d, in Vector2d, out Vector2d)

Returns the Vector2d with the minimum magnitude. If the magnitudes are equal, the second vector is selected.

Declaration
public static void MagnitudeMin(in Vector2d left, in Vector2d right, out Vector2d result)
Parameters
Type Name Description
Vector2d left

Left operand.

Vector2d right

Right operand.

Vector2d result

The magnitude-wise minimum.

Multiply(Vector2d, Vector2d)

Multiplies a vector by the components a vector (scale).

Declaration
[Pure]
public static Vector2d Multiply(Vector2d vector, Vector2d scale)
Parameters
Type Name Description
Vector2d vector

Left operand.

Vector2d scale

Right operand.

Returns
Type Description
Vector2d

Result of the operation.

Multiply(Vector2d, double)

Multiplies a vector by a scalar.

Declaration
[Pure]
public static Vector2d Multiply(Vector2d vector, double scale)
Parameters
Type Name Description
Vector2d vector

Left operand.

double scale

Right operand.

Returns
Type Description
Vector2d

Result of the operation.

Multiply(in Vector2d, in Vector2d, out Vector2d)

Multiplies a vector by the components of a vector (scale).

Declaration
public static void Multiply(in Vector2d vector, in Vector2d scale, out Vector2d result)
Parameters
Type Name Description
Vector2d vector

Left operand.

Vector2d scale

Right operand.

Vector2d result

Result of the operation.

Multiply(in Vector2d, double, out Vector2d)

Multiplies a vector by a scalar.

Declaration
public static void Multiply(in Vector2d vector, double scale, out Vector2d result)
Parameters
Type Name Description
Vector2d vector

Left operand.

double scale

Right operand.

Vector2d result

Result of the operation.

Normalize()

Scales the Vector2 to unit length.

Declaration
public void Normalize()

Normalize(Vector2d)

Scale a vector to unit length.

Declaration
[Pure]
public static Vector2d Normalize(Vector2d vec)
Parameters
Type Name Description
Vector2d vec

The input vector.

Returns
Type Description
Vector2d

The normalized copy.

Normalize(in Vector2d, out Vector2d)

Scale a vector to unit length.

Declaration
public static void Normalize(in Vector2d vec, out Vector2d result)
Parameters
Type Name Description
Vector2d vec

The input vector.

Vector2d result

The normalized vector.

Normalized()

Returns a copy of the Vector2d scaled to unit length.

Declaration
public readonly Vector2d Normalized()
Returns
Type Description
Vector2d

The normalized copy.

NormalizeFast()

Scales the Vector3d to approximately unit length.

Declaration
public void NormalizeFast()

NormalizeFast(Vector2d)

Scale a vector to approximately unit length.

Declaration
[Pure]
public static Vector2d NormalizeFast(Vector2d vec)
Parameters
Type Name Description
Vector2d vec

The input vector.

Returns
Type Description
Vector2d

The normalized copy.

NormalizeFast(in Vector2d, out Vector2d)

Scale a vector to approximately unit length.

Declaration
public static void NormalizeFast(in Vector2d vec, out Vector2d result)
Parameters
Type Name Description
Vector2d vec

The input vector.

Vector2d result

The normalized vector.

Round()

Returns a new vector were component-wise rounding has been applied. Equivalent to calling Round(double) on each component.

Declaration
public readonly Vector2d Round()
Returns
Type Description
Vector2d

The rounded vector.

Round(Vector2d, MidpointRounding)

Component-wise rounding with specified midpoint rounding rule. Equivalent to calling Round(double, MidpointRounding) on each component.

Declaration
[Pure]
public static Vector2d Round(Vector2d vec, MidpointRounding rounding)
Parameters
Type Name Description
Vector2d vec

The vector to round.

MidpointRounding rounding

The midpoint rounding rule to use.

Returns
Type Description
Vector2d

The component-wise rounded vector.

Round(Vector2d)

Component-wise rounding. Equivalent to calling Round(double) on each component.

Declaration
[Pure]
public static Vector2d Round(Vector2d vec)
Parameters
Type Name Description
Vector2d vec

The vector to round.

Returns
Type Description
Vector2d

The component-wise rounded vector.

Round(in Vector2d, out Vector2d)

Component-wise rounding. Equivalent to calling Round(double) on each component.

Declaration
public static void Round(in Vector2d vec, out Vector2d result)
Parameters
Type Name Description
Vector2d vec

The vector to round.

Vector2d result

The component-wise rounded vector.

Round(in Vector2d, MidpointRounding, out Vector2d)

Component-wise rounding with specified midpoint rounding rule. Equivalent to calling Round(double, MidpointRounding) on each component.

Declaration
public static void Round(in Vector2d vec, MidpointRounding rounding, out Vector2d result)
Parameters
Type Name Description
Vector2d vec

The vector to round.

MidpointRounding rounding

The midpoint rounding rule to use.

Vector2d result

The component-wise rounded vector.

Round(MidpointRounding)

Returns a new vector were component-wise rounding has been applied with the specified midpoint rounding rule. Equivalent to calling Round(double, MidpointRounding) on each component.

Declaration
public readonly Vector2d Round(MidpointRounding rounding)
Parameters
Type Name Description
MidpointRounding rounding

The midpoint rounding rule to use.

Returns
Type Description
Vector2d

The rounded vector.

Slerp(Vector2d, Vector2d, double)

Returns a new vector that is the spherical interpolation of the two given vectors. a and b need to be normalized for this function to work properly.

Declaration
[Pure]
public static Vector2d Slerp(Vector2d a, Vector2d b, double t)
Parameters
Type Name Description
Vector2d a

Unit vector start point.

Vector2d b

Unit vector end point.

double t

The blend factor.

Returns
Type Description
Vector2d

a when t=0, b when t=1, and a spherical interpolation between the vectors otherwise.

Slerp(in Vector2d, in Vector2d, double, out Vector2d)

Returns a new vector that is the spherical interpolation of the two given vectors. a and b need to be normalized for this function to work properly.

Declaration
public static void Slerp(in Vector2d a, in Vector2d b, double t, out Vector2d result)
Parameters
Type Name Description
Vector2d a

Unit vector start point.

Vector2d b

Unit vector end point.

double t

The blend factor.

Vector2d result

Is a when t=0, b when t=1, and a spherical interpolation between the vectors otherwise.

Subtract(Vector2d, Vector2d)

Subtract one Vector from another.

Declaration
[Pure]
public static Vector2d Subtract(Vector2d a, Vector2d b)
Parameters
Type Name Description
Vector2d a

First operand.

Vector2d b

Second operand.

Returns
Type Description
Vector2d

Result of subtraction.

Subtract(in Vector2d, in Vector2d, out Vector2d)

Subtract one Vector from another.

Declaration
public static void Subtract(in Vector2d a, in Vector2d b, out Vector2d result)
Parameters
Type Name Description
Vector2d a

First operand.

Vector2d b

Second operand.

Vector2d result

Result of subtraction.

ToString()

Declaration
public override string ToString()
Returns
Type Description
string
Overrides
ValueType.ToString()

ToString(IFormatProvider)

Declaration
public string ToString(IFormatProvider formatProvider)
Parameters
Type Name Description
IFormatProvider formatProvider
Returns
Type Description
string

ToString(string, IFormatProvider)

Declaration
public readonly string ToString(string format, IFormatProvider formatProvider)
Parameters
Type Name Description
string format
IFormatProvider formatProvider
Returns
Type Description
string

ToString(string)

Declaration
public string ToString(string format)
Parameters
Type Name Description
string format
Returns
Type Description
string

Transform(Vector2d, Quaterniond)

Transforms a vector by a quaternion rotation.

Declaration
[Pure]
public static Vector2d Transform(Vector2d vec, Quaterniond quat)
Parameters
Type Name Description
Vector2d vec

The vector to transform.

Quaterniond quat

The quaternion to rotate the vector by.

Returns
Type Description
Vector2d

The result of the operation.

Transform(in Vector2d, in Quaterniond, out Vector2d)

Transforms a vector by a quaternion rotation.

Declaration
public static void Transform(in Vector2d vec, in Quaterniond quat, out Vector2d result)
Parameters
Type Name Description
Vector2d vec

The vector to transform.

Quaterniond quat

The quaternion to rotate the vector by.

Vector2d result

The result of the operation.

TransformColumn(Matrix2d, Vector2d)

Transform a Vector by the given Matrix using right-handed notation.

Declaration
[Pure]
public static Vector2d TransformColumn(Matrix2d mat, Vector2d vec)
Parameters
Type Name Description
Matrix2d mat

The desired transformation.

Vector2d vec

The vector to transform.

Returns
Type Description
Vector2d

The transformed vector.

TransformColumn(in Matrix2d, in Vector2d, out Vector2d)

Transform a Vector by the given Matrix using right-handed notation.

Declaration
public static void TransformColumn(in Matrix2d mat, in Vector2d vec, out Vector2d result)
Parameters
Type Name Description
Matrix2d mat

The desired transformation.

Vector2d vec

The vector to transform.

Vector2d result

The transformed vector.

TransformRow(Vector2d, Matrix2d)

Transform a Vector by the given Matrix.

Declaration
[Pure]
public static Vector2d TransformRow(Vector2d vec, Matrix2d mat)
Parameters
Type Name Description
Vector2d vec

The vector to transform.

Matrix2d mat

The desired transformation.

Returns
Type Description
Vector2d

The transformed vector.

TransformRow(in Vector2d, in Matrix2d, out Vector2d)

Transform a Vector by the given Matrix.

Declaration
public static void TransformRow(in Vector2d vec, in Matrix2d mat, out Vector2d result)
Parameters
Type Name Description
Vector2d vec

The vector to transform.

Matrix2d mat

The desired transformation.

Vector2d result

The transformed vector.

Truncate()

Returns a new vector were component-wise truncation has been applied. Equivalent to calling Truncate(double) on each component.

Declaration
public readonly Vector2d Truncate()
Returns
Type Description
Vector2d

The truncated vector.

Truncate(Vector2d)

Component-wise truncation. Equivalent to calling Truncate(double) on each component.

Declaration
[Pure]
public static Vector2d Truncate(Vector2d vec)
Parameters
Type Name Description
Vector2d vec

The vector to truncate.

Returns
Type Description
Vector2d

The component-wise truncated vector.

Truncate(in Vector2d, out Vector2d)

Component-wise truncation. Equivalent to calling Truncate(double) on each component.

Declaration
public static void Truncate(in Vector2d vec, out Vector2d result)
Parameters
Type Name Description
Vector2d vec

The vector to truncate.

Vector2d result

The component-wise truncated vector.

Operators

operator +(Vector2d, Vector2d)

Adds two instances.

Declaration
[Pure]
public static Vector2d operator +(Vector2d left, Vector2d right)
Parameters
Type Name Description
Vector2d left

The left instance.

Vector2d right

The right instance.

Returns
Type Description
Vector2d

The result of the operation.

operator /(Vector2d, Vector2d)

Component-wise division between the specified instance by a scale vector.

Declaration
[Pure]
public static Vector2d operator /(Vector2d vec, Vector2d scale)
Parameters
Type Name Description
Vector2d vec

Left operand.

Vector2d scale

Right operand.

Returns
Type Description
Vector2d

Result of the division.

operator /(Vector2d, double)

Divides an instance by a scalar.

Declaration
[Pure]
public static Vector2d operator /(Vector2d vec, double f)
Parameters
Type Name Description
Vector2d vec

The instance.

double f

The scalar.

Returns
Type Description
Vector2d

The result of the operation.

operator ==(Vector2d, Vector2d)

Compares two instances for equality.

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

The left instance.

Vector2d right

The right instance.

Returns
Type Description
bool

True, if both instances are equal; false otherwise.

explicit operator Vector2(Vector2d)

Converts OpenTK.Vector2d to OpenTK.Vector2.

Declaration
[Pure]
public static explicit operator Vector2(Vector2d vec)
Parameters
Type Name Description
Vector2d vec

The Vector2d to convert.

Returns
Type Description
Vector2

The resulting Vector2.

explicit operator Vector2h(Vector2d)

Converts OpenTK.Vector2d to OpenTK.Vector2h.

Declaration
[Pure]
public static explicit operator Vector2h(Vector2d vec)
Parameters
Type Name Description
Vector2d vec

The Vector2d to convert.

Returns
Type Description
Vector2h

The resulting Vector2h.

explicit operator Vector2i(Vector2d)

Converts OpenTK.Vector2d to OpenTK.Vector2i.

Declaration
[Pure]
public static explicit operator Vector2i(Vector2d vec)
Parameters
Type Name Description
Vector2d vec

The Vector2d to convert.

Returns
Type Description
Vector2i

The resulting Vector2i.

implicit operator Vector2d((double X, double Y))

Initializes a new instance of the Vector2d struct using a tuple containing the component values.

Declaration
[Pure]
public static implicit operator Vector2d((double X, double Y) values)
Parameters
Type Name Description
(double X, double Y) values

A tuple containing the component values.

Returns
Type Description
Vector2d

A new instance of the Vector2d struct with the given component values.

operator !=(Vector2d, Vector2d)

Compares two instances for ienquality.

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

The left instance.

Vector2d right

The right instance.

Returns
Type Description
bool

True, if the instances are not equal; false otherwise.

operator *(Matrix2d, Vector2d)

Transform a Vector by the given Matrix using right-handed notation.

Declaration
[Pure]
public static Vector2d operator *(Matrix2d mat, Vector2d vec)
Parameters
Type Name Description
Matrix2d mat

The desired transformation.

Vector2d vec

The vector to transform.

Returns
Type Description
Vector2d

The transformed vector.

operator *(Quaterniond, Vector2d)

Transforms a vector by a quaternion rotation.

Declaration
[Pure]
public static Vector2d operator *(Quaterniond quat, Vector2d vec)
Parameters
Type Name Description
Quaterniond quat

The quaternion to rotate the vector by.

Vector2d vec

The vector to transform.

Returns
Type Description
Vector2d

The transformed vector.

operator *(Vector2d, Matrix2d)

Transform a Vector by the given Matrix.

Declaration
[Pure]
public static Vector2d operator *(Vector2d vec, Matrix2d mat)
Parameters
Type Name Description
Vector2d vec

The vector to transform.

Matrix2d mat

The desired transformation.

Returns
Type Description
Vector2d

The transformed vector.

operator *(Vector2d, Vector2d)

Component-wise multiplication between the specified instance by a scale vector.

Declaration
[Pure]
public static Vector2d operator *(Vector2d vec, Vector2d scale)
Parameters
Type Name Description
Vector2d vec

Right operand.

Vector2d scale

Left operand.

Returns
Type Description
Vector2d

Result of multiplication.

operator *(Vector2d, double)

Multiplies an instance by a scalar.

Declaration
[Pure]
public static Vector2d operator *(Vector2d vec, double f)
Parameters
Type Name Description
Vector2d vec

The instance.

double f

The scalar.

Returns
Type Description
Vector2d

The result of the operation.

operator *(double, Vector2d)

Multiply an instance by a scalar.

Declaration
[Pure]
public static Vector2d operator *(double f, Vector2d vec)
Parameters
Type Name Description
double f

The scalar.

Vector2d vec

The instance.

Returns
Type Description
Vector2d

The result of the operation.

operator -(Vector2d, Vector2d)

Subtracts two instances.

Declaration
[Pure]
public static Vector2d operator -(Vector2d left, Vector2d right)
Parameters
Type Name Description
Vector2d left

The left instance.

Vector2d right

The right instance.

Returns
Type Description
Vector2d

The result of the operation.

operator -(Vector2d)

Negates an instance.

Declaration
[Pure]
public static Vector2d operator -(Vector2d vec)
Parameters
Type Name Description
Vector2d vec

The instance.

Returns
Type Description
Vector2d

The result of the operation.

Implements

IEquatable<T>
IFormattable
In This Article
Back to top Generated by DocFX