Struct Vector2d
Represents a 2D vector using two double-precision floating-point numbers.
Inherited Members
Namespace: OpenTK.Mathematics
Assembly: OpenTK.Mathematics.dll
Syntax
[Serializable]
public struct Vector2d : IEquatable<Vector2d>, IFormattable
Constructors
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. |
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 component of the Vector2d. |
double | y | The y component of the Vector2d. |
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
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.
See Also
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. |
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 |
See Also
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 |
See Also
Equals(Vector2d)
Indicates whether the current object is equal to another object of the same type.
Declaration
public readonly bool Equals(Vector2d other)
Parameters
Type | Name | Description |
---|---|---|
Vector2d | other | An object to compare with this object. |
Returns
Type | Description |
---|---|
bool | true if the current object is equal to the |
Equals(object)
Indicates whether this instance and a specified object are equal.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to compare with the current instance. |
Returns
Type | Description |
---|---|
bool | true if |
Overrides
GetHashCode()
Returns the hash code for this instance.
Declaration
public override readonly int GetHashCode()
Returns
Type | Description |
---|---|
int | A 32-bit signed integer that is the hash code for this instance. |
Overrides
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. |
NormalizeFast()
Scales the Vector2d 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. |
Normalized()
Returns a copy of the Vector2d scaled to unit length.
Declaration
public readonly Vector2d Normalized()
Returns
Type | Description |
---|---|
Vector2d | The normalized copy. |
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 |
|
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 |
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()
Returns the fully qualified type name of this instance.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | The fully qualified type name. |
Overrides
ToString(IFormatProvider)
Formats the value of the current instance using the specified format.
Declaration
public string ToString(IFormatProvider formatProvider)
Parameters
Type | Name | Description |
---|---|---|
IFormatProvider | formatProvider | The provider to use to format the value. -or- A null reference ( |
Returns
Type | Description |
---|---|
string | The value of the current instance in the specified format. |
ToString(string)
Formats the value of the current instance using the specified format.
Declaration
public string ToString(string format)
Parameters
Type | Name | Description |
---|---|---|
string | format | The format to use. -or- A null reference ( |
Returns
Type | Description |
---|---|
string | The value of the current instance in the specified format. |
ToString(string, IFormatProvider)
Formats the value of the current instance using the specified format.
Declaration
public readonly string ToString(string format, IFormatProvider formatProvider)
Parameters
Type | Name | Description |
---|---|---|
string | format | The format to use. -or- A null reference ( |
IFormatProvider | formatProvider | The provider to use to format the value. -or- A null reference ( |
Returns
Type | Description |
---|---|
string | The value of the current instance in the specified format. |
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. |
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. |