The Open Toolkit library  1.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events
OpenTK.Vector2d Struct Reference

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

Inherits IEquatable< Vector2d >.

Public Member Functions

 Vector2d (double value)
 Constructs a new instance. More...
 
 Vector2d (double x, double y)
 Constructs left vector with the given coordinates. More...
 
void Add (Vector2d right)
 Add the Vector passed as parameter to this instance. More...
 
void Add (ref Vector2d right)
 Add the Vector passed as parameter to this instance. More...
 
void Sub (Vector2d right)
 Subtract the Vector passed as parameter from this instance. More...
 
void Sub (ref Vector2d right)
 Subtract the Vector passed as parameter from this instance. More...
 
void Mult (double f)
 Multiply this instance by a scalar. More...
 
void Div (double f)
 Divide this instance by a scalar. More...
 
Vector2d Normalized ()
 Returns a copy of the Vector2d scaled to unit length. More...
 
void Normalize ()
 Scales the Vector2 to unit length. More...
 
void Scale (double sx, double sy)
 Scales the current Vector2 by the given amounts. More...
 
void Scale (Vector2d scale)
 Scales this instance by the given parameter. More...
 
void Scale (ref Vector2d scale)
 Scales this instance by the given parameter. More...
 
override string ToString ()
 Returns a System.String that represents the current instance. More...
 
override int GetHashCode ()
 Returns the hashcode for this instance. More...
 
override bool Equals (object obj)
 Indicates whether this instance and a specified object are equal. More...
 
bool Equals (Vector2d other)
 Indicates whether the current vector is equal to another vector. More...
 

Static Public Member Functions

static Vector2d Sub (Vector2d a, Vector2d b)
 Subtract one Vector from another More...
 
static void Sub (ref Vector2d a, ref Vector2d b, out Vector2d result)
 Subtract one Vector from another More...
 
static Vector2d Mult (Vector2d a, double d)
 Multiply a vector and a scalar More...
 
static void Mult (ref Vector2d a, double d, out Vector2d result)
 Multiply a vector and a scalar More...
 
static Vector2d Div (Vector2d a, double d)
 Divide a vector by a scalar More...
 
static void Div (ref Vector2d a, double d, out Vector2d result)
 Divide a vector by a scalar More...
 
static Vector2d Add (Vector2d a, Vector2d b)
 Adds two vectors. More...
 
static void Add (ref Vector2d a, ref Vector2d b, out Vector2d result)
 Adds two vectors. More...
 
static Vector2d Subtract (Vector2d a, Vector2d b)
 Subtract one Vector from another More...
 
static void Subtract (ref Vector2d a, ref Vector2d b, out Vector2d result)
 Subtract one Vector from another More...
 
static Vector2d Multiply (Vector2d vector, double scale)
 Multiplies a vector by a scalar. More...
 
static void Multiply (ref Vector2d vector, double scale, out Vector2d result)
 Multiplies a vector by a scalar. More...
 
static Vector2d Multiply (Vector2d vector, Vector2d scale)
 Multiplies a vector by the components a vector (scale). More...
 
static void Multiply (ref Vector2d vector, ref Vector2d scale, out Vector2d result)
 Multiplies a vector by the components of a vector (scale). More...
 
static Vector2d Divide (Vector2d vector, double scale)
 Divides a vector by a scalar. More...
 
static void Divide (ref Vector2d vector, double scale, out Vector2d result)
 Divides a vector by a scalar. More...
 
static Vector2d Divide (Vector2d vector, Vector2d scale)
 Divides a vector by the components of a vector (scale). More...
 
static void Divide (ref Vector2d vector, ref Vector2d scale, out Vector2d result)
 Divide a vector by the components of a vector (scale). More...
 
static Vector2d Min (Vector2d a, Vector2d b)
 Calculate the component-wise minimum of two vectors More...
 
static void Min (ref Vector2d a, ref Vector2d b, out Vector2d result)
 Calculate the component-wise minimum of two vectors More...
 
static Vector2d Max (Vector2d a, Vector2d b)
 Calculate the component-wise maximum of two vectors More...
 
static void Max (ref Vector2d a, ref Vector2d b, out Vector2d result)
 Calculate the component-wise maximum of two vectors More...
 
static Vector2d Clamp (Vector2d vec, Vector2d min, Vector2d max)
 Clamp a vector to the given minimum and maximum vectors More...
 
static void Clamp (ref Vector2d vec, ref Vector2d min, ref Vector2d max, out Vector2d result)
 Clamp a vector to the given minimum and maximum vectors More...
 
static Vector2d Normalize (Vector2d vec)
 Scale a vector to unit length More...
 
static void Normalize (ref Vector2d vec, out Vector2d result)
 Scale a vector to unit length More...
 
static Vector2d NormalizeFast (Vector2d vec)
 Scale a vector to approximately unit length More...
 
static void NormalizeFast (ref Vector2d vec, out Vector2d result)
 Scale a vector to approximately unit length More...
 
static double Dot (Vector2d left, Vector2d right)
 Calculate the dot (scalar) product of two vectors More...
 
static void Dot (ref Vector2d left, ref Vector2d right, out double result)
 Calculate the dot (scalar) product of two vectors More...
 
static Vector2d Lerp (Vector2d a, Vector2d b, double blend)
 Returns a new Vector that is the linear blend of the 2 given Vectors More...
 
static void Lerp (ref Vector2d a, ref Vector2d b, double blend, out Vector2d result)
 Returns a new Vector that is the linear blend of the 2 given Vectors More...
 
static Vector2d BaryCentric (Vector2d a, Vector2d b, Vector2d c, double u, double v)
 Interpolate 3 Vectors using Barycentric coordinates More...
 
static void BaryCentric (ref Vector2d a, ref Vector2d b, ref Vector2d c, double u, double v, out Vector2d result)
 Interpolate 3 Vectors using Barycentric coordinates More...
 
static Vector2d Transform (Vector2d vec, Quaterniond quat)
 Transforms a vector by a quaternion rotation. More...
 
static void Transform (ref Vector2d vec, ref Quaterniond quat, out Vector2d result)
 Transforms a vector by a quaternion rotation. More...
 
static Vector2d operator+ (Vector2d left, Vector2d right)
 Adds two instances. More...
 
static Vector2d operator- (Vector2d left, Vector2d right)
 Subtracts two instances. More...
 
static Vector2d operator- (Vector2d vec)
 Negates an instance. More...
 
static Vector2d operator* (Vector2d vec, double f)
 Multiplies an instance by a scalar. More...
 
static Vector2d operator* (double f, Vector2d vec)
 Multiply an instance by a scalar. More...
 
static Vector2d operator/ (Vector2d vec, double f)
 Divides an instance by a scalar. More...
 
static bool operator== (Vector2d left, Vector2d right)
 Compares two instances for equality. More...
 
static bool operator!= (Vector2d left, Vector2d right)
 Compares two instances for ienquality. More...
 
static operator Vector2d (Vector2 v2)
 Converts OpenTK.Vector2 to OpenTK.Vector2d. More...
 
static operator Vector2 (Vector2d v2d)
 Converts OpenTK.Vector2d to OpenTK.Vector2. More...
 

Public Attributes

double X
 The X coordinate of this instance. More...
 
double Y
 The Y coordinate of this instance. More...
 

Static Public Attributes

static readonly Vector2d UnitX = new Vector2d(1, 0)
 Defines a unit-length Vector2d that points towards the X-axis. More...
 
static readonly Vector2d UnitY = new Vector2d(0, 1)
 Defines a unit-length Vector2d that points towards the Y-axis. More...
 
static readonly Vector2d Zero = new Vector2d(0, 0)
 Defines a zero-length Vector2d. More...
 
static readonly Vector2d One = new Vector2d(1, 1)
 Defines an instance with all components set to 1. More...
 
static readonly int SizeInBytes = Marshal.SizeOf(new Vector2d())
 Defines the size of the Vector2d struct in bytes. More...
 

Properties

double this[int index] [get, set]
 Gets or sets the value at the index of the Vector. More...
 
double Length [get]
 Gets the length (magnitude) of the vector. More...
 
double LengthSquared [get]
 Gets the square of the vector length (magnitude). More...
 
Vector2d PerpendicularRight [get]
 Gets the perpendicular vector on the right side of this vector. More...
 
Vector2d PerpendicularLeft [get]
 Gets the perpendicular vector on the left side of this vector. More...
 
Vector2d Yx [get, set]
 Gets or sets an OpenTK.Vector2d with the Y and X components of this instance. More...
 

Detailed Description

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

Constructor & Destructor Documentation

OpenTK.Vector2d.Vector2d ( double  value)

Constructs a new instance.

Parameters
valueThe value that will initialize this instance.
OpenTK.Vector2d.Vector2d ( double  x,
double  y 
)

Constructs left vector with the given coordinates.

Parameters
xThe X coordinate.
yThe Y coordinate.

Member Function Documentation

void OpenTK.Vector2d.Add ( Vector2d  right)

Add the Vector passed as parameter to this instance.

Parameters
rightRight operand. This parameter is only read from.
void OpenTK.Vector2d.Add ( ref Vector2d  right)

Add the Vector passed as parameter to this instance.

Parameters
rightRight operand. This parameter is only read from.
static Vector2d OpenTK.Vector2d.Add ( Vector2d  a,
Vector2d  b 
)
static

Adds two vectors.

Parameters
aLeft operand.
bRight operand.
Returns
Result of operation.
static void OpenTK.Vector2d.Add ( ref Vector2d  a,
ref Vector2d  b,
out Vector2d  result 
)
static

Adds two vectors.

Parameters
aLeft operand.
bRight operand.
resultResult of operation.
static Vector2d OpenTK.Vector2d.BaryCentric ( Vector2d  a,
Vector2d  b,
Vector2d  c,
double  u,
double  v 
)
static

Interpolate 3 Vectors using Barycentric coordinates

Parameters
aFirst input Vector
bSecond input Vector
cThird input Vector
uFirst Barycentric Coordinate
vSecond Barycentric Coordinate
Returns
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
static void OpenTK.Vector2d.BaryCentric ( ref Vector2d  a,
ref Vector2d  b,
ref Vector2d  c,
double  u,
double  v,
out Vector2d  result 
)
static

Interpolate 3 Vectors using Barycentric coordinates

Parameters
aFirst input Vector.
bSecond input Vector.
cThird input Vector.
uFirst Barycentric Coordinate.
vSecond Barycentric Coordinate.
resultOutput 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
static Vector2d OpenTK.Vector2d.Clamp ( Vector2d  vec,
Vector2d  min,
Vector2d  max 
)
static

Clamp a vector to the given minimum and maximum vectors

Parameters
vecInput vector
minMinimum vector
maxMaximum vector
Returns
The clamped vector
static void OpenTK.Vector2d.Clamp ( ref Vector2d  vec,
ref Vector2d  min,
ref Vector2d  max,
out Vector2d  result 
)
static

Clamp a vector to the given minimum and maximum vectors

Parameters
vecInput vector
minMinimum vector
maxMaximum vector
resultThe clamped vector
void OpenTK.Vector2d.Div ( double  f)

Divide this instance by a scalar.

Parameters
fScalar operand.
static Vector2d OpenTK.Vector2d.Div ( Vector2d  a,
double  d 
)
static

Divide a vector by a scalar

Parameters
aVector operand
dScalar operand
Returns
Result of the division
static void OpenTK.Vector2d.Div ( ref Vector2d  a,
double  d,
out Vector2d  result 
)
static

Divide a vector by a scalar

Parameters
aVector operand
dScalar operand
resultResult of the division
static Vector2d OpenTK.Vector2d.Divide ( Vector2d  vector,
double  scale 
)
static

Divides a vector by a scalar.

Parameters
vectorLeft operand.
scaleRight operand.
Returns
Result of the operation.
static void OpenTK.Vector2d.Divide ( ref Vector2d  vector,
double  scale,
out Vector2d  result 
)
static

Divides a vector by a scalar.

Parameters
vectorLeft operand.
scaleRight operand.
resultResult of the operation.
static Vector2d OpenTK.Vector2d.Divide ( Vector2d  vector,
Vector2d  scale 
)
static

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

Parameters
vectorLeft operand.
scaleRight operand.
Returns
Result of the operation.
static void OpenTK.Vector2d.Divide ( ref Vector2d  vector,
ref Vector2d  scale,
out Vector2d  result 
)
static

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

Parameters
vectorLeft operand.
scaleRight operand.
resultResult of the operation.
static double OpenTK.Vector2d.Dot ( Vector2d  left,
Vector2d  right 
)
static

Calculate the dot (scalar) product of two vectors

Parameters
leftFirst operand
rightSecond operand
Returns
The dot product of the two inputs
static void OpenTK.Vector2d.Dot ( ref Vector2d  left,
ref Vector2d  right,
out double  result 
)
static

Calculate the dot (scalar) product of two vectors

Parameters
leftFirst operand
rightSecond operand
resultThe dot product of the two inputs
override bool OpenTK.Vector2d.Equals ( object  obj)

Indicates whether this instance and a specified object are equal.

Parameters
objThe object to compare to.
Returns
True if the instances are equal; false otherwise.
bool OpenTK.Vector2d.Equals ( Vector2d  other)

Indicates whether the current vector is equal to another vector.

Parameters
otherA vector to compare with this vector.
Returns
true if the current vector is equal to the vector parameter; otherwise, false.
override int OpenTK.Vector2d.GetHashCode ( )

Returns the hashcode for this instance.

Returns
A System.Int32 containing the unique hashcode for this instance.
static Vector2d OpenTK.Vector2d.Lerp ( Vector2d  a,
Vector2d  b,
double  blend 
)
static

Returns a new Vector that is the linear blend of the 2 given Vectors

Parameters
aFirst input vector
bSecond input vector
blendThe blend factor. a when blend=0, b when blend=1.
Returns
a when blend=0, b when blend=1, and a linear combination otherwise
static void OpenTK.Vector2d.Lerp ( ref Vector2d  a,
ref Vector2d  b,
double  blend,
out Vector2d  result 
)
static

Returns a new Vector that is the linear blend of the 2 given Vectors

Parameters
aFirst input vector
bSecond input vector
blendThe blend factor. a when blend=0, b when blend=1.
resulta when blend=0, b when blend=1, and a linear combination otherwise
static Vector2d OpenTK.Vector2d.Max ( Vector2d  a,
Vector2d  b 
)
static

Calculate the component-wise maximum of two vectors

Parameters
aFirst operand
bSecond operand
Returns
The component-wise maximum
static void OpenTK.Vector2d.Max ( ref Vector2d  a,
ref Vector2d  b,
out Vector2d  result 
)
static

Calculate the component-wise maximum of two vectors

Parameters
aFirst operand
bSecond operand
resultThe component-wise maximum
static Vector2d OpenTK.Vector2d.Min ( Vector2d  a,
Vector2d  b 
)
static

Calculate the component-wise minimum of two vectors

Parameters
aFirst operand
bSecond operand
Returns
The component-wise minimum
static void OpenTK.Vector2d.Min ( ref Vector2d  a,
ref Vector2d  b,
out Vector2d  result 
)
static

Calculate the component-wise minimum of two vectors

Parameters
aFirst operand
bSecond operand
resultThe component-wise minimum
void OpenTK.Vector2d.Mult ( double  f)

Multiply this instance by a scalar.

Parameters
fScalar operand.
static Vector2d OpenTK.Vector2d.Mult ( Vector2d  a,
double  d 
)
static

Multiply a vector and a scalar

Parameters
aVector operand
dScalar operand
Returns
Result of the multiplication
static void OpenTK.Vector2d.Mult ( ref Vector2d  a,
double  d,
out Vector2d  result 
)
static

Multiply a vector and a scalar

Parameters
aVector operand
dScalar operand
resultResult of the multiplication
static Vector2d OpenTK.Vector2d.Multiply ( Vector2d  vector,
double  scale 
)
static

Multiplies a vector by a scalar.

Parameters
vectorLeft operand.
scaleRight operand.
Returns
Result of the operation.
static void OpenTK.Vector2d.Multiply ( ref Vector2d  vector,
double  scale,
out Vector2d  result 
)
static

Multiplies a vector by a scalar.

Parameters
vectorLeft operand.
scaleRight operand.
resultResult of the operation.
static Vector2d OpenTK.Vector2d.Multiply ( Vector2d  vector,
Vector2d  scale 
)
static

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

Parameters
vectorLeft operand.
scaleRight operand.
Returns
Result of the operation.
static void OpenTK.Vector2d.Multiply ( ref Vector2d  vector,
ref Vector2d  scale,
out Vector2d  result 
)
static

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

Parameters
vectorLeft operand.
scaleRight operand.
resultResult of the operation.
void OpenTK.Vector2d.Normalize ( )

Scales the Vector2 to unit length.

static Vector2d OpenTK.Vector2d.Normalize ( Vector2d  vec)
static

Scale a vector to unit length

Parameters
vecThe input vector
Returns
The normalized vector
static void OpenTK.Vector2d.Normalize ( ref Vector2d  vec,
out Vector2d  result 
)
static

Scale a vector to unit length

Parameters
vecThe input vector
resultThe normalized vector
Vector2d OpenTK.Vector2d.Normalized ( )

Returns a copy of the Vector2d scaled to unit length.

Returns
static Vector2d OpenTK.Vector2d.NormalizeFast ( Vector2d  vec)
static

Scale a vector to approximately unit length

Parameters
vecThe input vector
Returns
The normalized vector
static void OpenTK.Vector2d.NormalizeFast ( ref Vector2d  vec,
out Vector2d  result 
)
static

Scale a vector to approximately unit length

Parameters
vecThe input vector
resultThe normalized vector
static OpenTK.Vector2d.operator Vector2 ( Vector2d  v2d)
explicitstatic

Converts OpenTK.Vector2d to OpenTK.Vector2.

Parameters
v2dThe Vector2d to convert.
Returns
The resulting Vector2.
static OpenTK.Vector2d.operator Vector2d ( Vector2  v2)
explicitstatic

Converts OpenTK.Vector2 to OpenTK.Vector2d.

Parameters
v2The Vector2 to convert.
Returns
The resulting Vector2d.
static bool OpenTK.Vector2d.operator!= ( Vector2d  left,
Vector2d  right 
)
static

Compares two instances for ienquality.

Parameters
leftThe left instance.
rightThe right instance.
Returns
True, if the instances are not equal; false otherwise.
static Vector2d OpenTK.Vector2d.operator* ( Vector2d  vec,
double  f 
)
static

Multiplies an instance by a scalar.

Parameters
vecThe instance.
fThe scalar.
Returns
The result of the operation.
static Vector2d OpenTK.Vector2d.operator* ( double  f,
Vector2d  vec 
)
static

Multiply an instance by a scalar.

Parameters
fThe scalar.
vecThe instance.
Returns
The result of the operation.
static Vector2d OpenTK.Vector2d.operator+ ( Vector2d  left,
Vector2d  right 
)
static

Adds two instances.

Parameters
leftThe left instance.
rightThe right instance.
Returns
The result of the operation.
static Vector2d OpenTK.Vector2d.operator- ( Vector2d  left,
Vector2d  right 
)
static

Subtracts two instances.

Parameters
leftThe left instance.
rightThe right instance.
Returns
The result of the operation.
static Vector2d OpenTK.Vector2d.operator- ( Vector2d  vec)
static

Negates an instance.

Parameters
vecThe instance.
Returns
The result of the operation.
static Vector2d OpenTK.Vector2d.operator/ ( Vector2d  vec,
double  f 
)
static

Divides an instance by a scalar.

Parameters
vecThe instance.
fThe scalar.
Returns
The result of the operation.
static bool OpenTK.Vector2d.operator== ( Vector2d  left,
Vector2d  right 
)
static

Compares two instances for equality.

Parameters
leftThe left instance.
rightThe right instance.
Returns
True, if both instances are equal; false otherwise.
void OpenTK.Vector2d.Scale ( double  sx,
double  sy 
)

Scales the current Vector2 by the given amounts.

Parameters
sxThe scale of the X component.
syThe scale of the Y component.
void OpenTK.Vector2d.Scale ( Vector2d  scale)

Scales this instance by the given parameter.

Parameters
scaleThe scaling of the individual components.
void OpenTK.Vector2d.Scale ( ref Vector2d  scale)

Scales this instance by the given parameter.

Parameters
scaleThe scaling of the individual components.
void OpenTK.Vector2d.Sub ( Vector2d  right)

Subtract the Vector passed as parameter from this instance.

Parameters
rightRight operand. This parameter is only read from.
void OpenTK.Vector2d.Sub ( ref Vector2d  right)

Subtract the Vector passed as parameter from this instance.

Parameters
rightRight operand. This parameter is only read from.
static Vector2d OpenTK.Vector2d.Sub ( Vector2d  a,
Vector2d  b 
)
static

Subtract one Vector from another

Parameters
aFirst operand
bSecond operand
Returns
Result of subtraction
static void OpenTK.Vector2d.Sub ( ref Vector2d  a,
ref Vector2d  b,
out Vector2d  result 
)
static

Subtract one Vector from another

Parameters
aFirst operand
bSecond operand
resultResult of subtraction
static Vector2d OpenTK.Vector2d.Subtract ( Vector2d  a,
Vector2d  b 
)
static

Subtract one Vector from another

Parameters
aFirst operand
bSecond operand
Returns
Result of subtraction
static void OpenTK.Vector2d.Subtract ( ref Vector2d  a,
ref Vector2d  b,
out Vector2d  result 
)
static

Subtract one Vector from another

Parameters
aFirst operand
bSecond operand
resultResult of subtraction
override string OpenTK.Vector2d.ToString ( )

Returns a System.String that represents the current instance.

Returns
static Vector2d OpenTK.Vector2d.Transform ( Vector2d  vec,
Quaterniond  quat 
)
static

Transforms a vector by a quaternion rotation.

Parameters
vecThe vector to transform.
quatThe quaternion to rotate the vector by.
Returns
The result of the operation.
static void OpenTK.Vector2d.Transform ( ref Vector2d  vec,
ref Quaterniond  quat,
out Vector2d  result 
)
static

Transforms a vector by a quaternion rotation.

Parameters
vecThe vector to transform.
quatThe quaternion to rotate the vector by.
resultThe result of the operation.

Member Data Documentation

readonly Vector2d OpenTK.Vector2d.One = new Vector2d(1, 1)
static

Defines an instance with all components set to 1.

readonly int OpenTK.Vector2d.SizeInBytes = Marshal.SizeOf(new Vector2d())
static

Defines the size of the Vector2d struct in bytes.

readonly Vector2d OpenTK.Vector2d.UnitX = new Vector2d(1, 0)
static

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

readonly Vector2d OpenTK.Vector2d.UnitY = new Vector2d(0, 1)
static

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

double OpenTK.Vector2d.X

The X coordinate of this instance.

double OpenTK.Vector2d.Y

The Y coordinate of this instance.

readonly Vector2d OpenTK.Vector2d.Zero = new Vector2d(0, 0)
static

Defines a zero-length Vector2d.

Property Documentation

double OpenTK.Vector2d.Length
get

Gets the length (magnitude) of the vector.

See Also
LengthSquared
double OpenTK.Vector2d.LengthSquared
get

Gets the square of the vector length (magnitude).

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

Length

Vector2d OpenTK.Vector2d.PerpendicularLeft
get

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

Vector2d OpenTK.Vector2d.PerpendicularRight
get

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

double OpenTK.Vector2d.this[int index]
getset

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

Vector2d OpenTK.Vector2d.Yx
getset

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