The Open Toolkit library  1.1
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Properties | List of all members
OpenTK.Vector2 Struct Reference

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

Inherits IEquatable< Vector2 >.

Public Member Functions

 Vector2 (float value)
 Constructs a new instance. More...
 
 Vector2 (float x, float y)
 Constructs a new Vector2. More...
 
 Vector2 (Vector2 v)
 Constructs a new Vector2 from the given Vector2. More...
 
 Vector2 (Vector3 v)
 Constructs a new Vector2 from the given Vector3. More...
 
 Vector2 (Vector4 v)
 Constructs a new Vector2 from the given Vector4. More...
 
void Add (Vector2 right)
 Add the Vector passed as parameter to this instance. More...
 
void Add (ref Vector2 right)
 Add the Vector passed as parameter to this instance. More...
 
void Sub (Vector2 right)
 Subtract the Vector passed as parameter from this instance. More...
 
void Sub (ref Vector2 right)
 Subtract the Vector passed as parameter from this instance. More...
 
void Mult (float f)
 Multiply this instance by a scalar. More...
 
void Div (float f)
 Divide this instance by a scalar. More...
 
Vector2 Normalized ()
 Returns a copy of the Vector2 scaled to unit length. More...
 
void Normalize ()
 Scales the Vector2 to unit length. More...
 
void NormalizeFast ()
 Scales the Vector2 to approximately unit length. More...
 
void Scale (float sx, float sy)
 Scales the current Vector2 by the given amounts. More...
 
void Scale (Vector2 scale)
 Scales this instance by the given parameter. More...
 
void Scale (ref Vector2 scale)
 Scales this instance by the given parameter. More...
 
override string ToString ()
 Returns a System.String that represents the current Vector2. 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 (Vector2 other)
 Indicates whether the current vector is equal to another vector. More...
 

Static Public Member Functions

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

Public Attributes

float X
 The X component of the Vector2. More...
 
float Y
 The Y component of the Vector2. More...
 

Static Public Attributes

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

Properties

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

Detailed Description

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

The Vector2 structure is suitable for interoperation with unmanaged code requiring two consecutive floats.

Constructor & Destructor Documentation

OpenTK.Vector2.Vector2 ( float  value)

Constructs a new instance.

Parameters
valueThe value that will initialize this instance.
OpenTK.Vector2.Vector2 ( float  x,
float  y 
)

Constructs a new Vector2.

Parameters
xThe x coordinate of the net Vector2.
yThe y coordinate of the net Vector2.
OpenTK.Vector2.Vector2 ( Vector2  v)

Constructs a new Vector2 from the given Vector2.

Parameters
vThe Vector2 to copy components from.
OpenTK.Vector2.Vector2 ( Vector3  v)

Constructs a new Vector2 from the given Vector3.

Parameters
vThe Vector3 to copy components from. Z is discarded.
OpenTK.Vector2.Vector2 ( Vector4  v)

Constructs a new Vector2 from the given Vector4.

Parameters
vThe Vector4 to copy components from. Z and W are discarded.

Member Function Documentation

void OpenTK.Vector2.Add ( Vector2  right)

Add the Vector passed as parameter to this instance.

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

Add the Vector passed as parameter to this instance.

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

Adds two vectors.

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

Adds two vectors.

Parameters
aLeft operand.
bRight operand.
resultResult of operation.
static Vector2 OpenTK.Vector2.BaryCentric ( Vector2  a,
Vector2  b,
Vector2  c,
float  u,
float  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.Vector2.BaryCentric ( ref Vector2  a,
ref Vector2  b,
ref Vector2  c,
float  u,
float  v,
out Vector2  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 Vector2 OpenTK.Vector2.Clamp ( Vector2  vec,
Vector2  min,
Vector2  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.Vector2.Clamp ( ref Vector2  vec,
ref Vector2  min,
ref Vector2  max,
out Vector2  result 
)
static

Clamp a vector to the given minimum and maximum vectors

Parameters
vecInput vector
minMinimum vector
maxMaximum vector
resultThe clamped vector
static Vector2 OpenTK.Vector2.ComponentMax ( Vector2  a,
Vector2  b 
)
static

Calculate the component-wise maximum of two vectors

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

Calculate the component-wise maximum of two vectors

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

Calculate the component-wise minimum of two vectors

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

Calculate the component-wise minimum of two vectors

Parameters
aFirst operand
bSecond operand
resultThe component-wise minimum
void OpenTK.Vector2.Div ( float  f)

Divide this instance by a scalar.

Parameters
fScalar operand.
static Vector2 OpenTK.Vector2.Div ( Vector2  a,
float  f 
)
static

Divide a vector by a scalar

Parameters
aVector operand
fScalar operand
Returns
Result of the division
static void OpenTK.Vector2.Div ( ref Vector2  a,
float  f,
out Vector2  result 
)
static

Divide a vector by a scalar

Parameters
aVector operand
fScalar operand
resultResult of the division
static Vector2 OpenTK.Vector2.Divide ( Vector2  vector,
float  scale 
)
static

Divides a vector by a scalar.

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

Divides a vector by a scalar.

Parameters
vectorLeft operand.
scaleRight operand.
resultResult of the operation.
static Vector2 OpenTK.Vector2.Divide ( Vector2  vector,
Vector2  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.Vector2.Divide ( ref Vector2  vector,
ref Vector2  scale,
out Vector2  result 
)
static

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

Parameters
vectorLeft operand.
scaleRight operand.
resultResult of the operation.
static float OpenTK.Vector2.Dot ( Vector2  left,
Vector2  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.Vector2.Dot ( ref Vector2  left,
ref Vector2  right,
out float  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.Vector2.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.Vector2.Equals ( Vector2  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.Vector2.GetHashCode ( )

Returns the hashcode for this instance.

Returns
A System.Int32 containing the unique hashcode for this instance.
static Vector2 OpenTK.Vector2.Lerp ( Vector2  a,
Vector2  b,
float  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.Vector2.Lerp ( ref Vector2  a,
ref Vector2  b,
float  blend,
out Vector2  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 Vector2 OpenTK.Vector2.Max ( Vector2  left,
Vector2  right 
)
static

Returns the Vector3 with the minimum magnitude

Parameters
leftLeft operand
rightRight operand
Returns
The minimum Vector3
static Vector2 OpenTK.Vector2.Min ( Vector2  left,
Vector2  right 
)
static

Returns the Vector3 with the minimum magnitude

Parameters
leftLeft operand
rightRight operand
Returns
The minimum Vector3
void OpenTK.Vector2.Mult ( float  f)

Multiply this instance by a scalar.

Parameters
fScalar operand.
static Vector2 OpenTK.Vector2.Mult ( Vector2  a,
float  f 
)
static

Multiply a vector and a scalar

Parameters
aVector operand
fScalar operand
Returns
Result of the multiplication
static void OpenTK.Vector2.Mult ( ref Vector2  a,
float  f,
out Vector2  result 
)
static

Multiply a vector and a scalar

Parameters
aVector operand
fScalar operand
resultResult of the multiplication
static Vector2 OpenTK.Vector2.Multiply ( Vector2  vector,
float  scale 
)
static

Multiplies a vector by a scalar.

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

Multiplies a vector by a scalar.

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

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

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

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

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

Scales the Vector2 to unit length.

static Vector2 OpenTK.Vector2.Normalize ( Vector2  vec)
static

Scale a vector to unit length

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

Scale a vector to unit length

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

Returns a copy of the Vector2 scaled to unit length.

Returns
void OpenTK.Vector2.NormalizeFast ( )

Scales the Vector2 to approximately unit length.

static Vector2 OpenTK.Vector2.NormalizeFast ( Vector2  vec)
static

Scale a vector to approximately unit length

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

Scale a vector to approximately unit length

Parameters
vecThe input vector
resultThe normalized vector
static bool OpenTK.Vector2.operator!= ( Vector2  left,
Vector2  right 
)
static

Compares the specified instances for inequality.

Parameters
leftLeft operand.
rightRight operand.
Returns
True if both instances are not equal; false otherwise.
static Vector2 OpenTK.Vector2.operator* ( Vector2  vec,
float  scale 
)
static

Multiplies the specified instance by a scalar.

Parameters
vecLeft operand.
scaleRight operand.
Returns
Result of multiplication.
static Vector2 OpenTK.Vector2.operator* ( float  scale,
Vector2  vec 
)
static

Multiplies the specified instance by a scalar.

Parameters
scaleLeft operand.
vecRight operand.
Returns
Result of multiplication.
static Vector2 OpenTK.Vector2.operator+ ( Vector2  left,
Vector2  right 
)
static

Adds the specified instances.

Parameters
leftLeft operand.
rightRight operand.
Returns
Result of addition.
static Vector2 OpenTK.Vector2.operator- ( Vector2  left,
Vector2  right 
)
static

Subtracts the specified instances.

Parameters
leftLeft operand.
rightRight operand.
Returns
Result of subtraction.
static Vector2 OpenTK.Vector2.operator- ( Vector2  vec)
static

Negates the specified instance.

Parameters
vecOperand.
Returns
Result of negation.
static Vector2 OpenTK.Vector2.operator/ ( Vector2  vec,
float  scale 
)
static

Divides the specified instance by a scalar.

Parameters
vecLeft operand
scaleRight operand
Returns
Result of the division.
static bool OpenTK.Vector2.operator== ( Vector2  left,
Vector2  right 
)
static

Compares the specified instances for equality.

Parameters
leftLeft operand.
rightRight operand.
Returns
True if both instances are equal; false otherwise.
static float OpenTK.Vector2.PerpDot ( Vector2  left,
Vector2  right 
)
static

Calculate the perpendicular dot (scalar) product of two vectors

Parameters
leftFirst operand
rightSecond operand
Returns
The perpendicular dot product of the two inputs
static void OpenTK.Vector2.PerpDot ( ref Vector2  left,
ref Vector2  right,
out float  result 
)
static

Calculate the perpendicular dot (scalar) product of two vectors

Parameters
leftFirst operand
rightSecond operand
resultThe perpendicular dot product of the two inputs
void OpenTK.Vector2.Scale ( float  sx,
float  sy 
)

Scales the current Vector2 by the given amounts.

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

Scales this instance by the given parameter.

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

Scales this instance by the given parameter.

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

Subtract the Vector passed as parameter from this instance.

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

Subtract the Vector passed as parameter from this instance.

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

Subtract one Vector from another

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

Subtract one Vector from another

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

Subtract one Vector from another

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

Subtract one Vector from another

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

Returns a System.String that represents the current Vector2.

Returns
static Vector2 OpenTK.Vector2.Transform ( Vector2  vec,
Quaternion  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.Vector2.Transform ( ref Vector2  vec,
ref Quaternion  quat,
out Vector2  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 Vector2 OpenTK.Vector2.One = new Vector2(1, 1)
static

Defines an instance with all components set to 1.

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

Defines the size of the Vector2 struct in bytes.

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

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

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

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

float OpenTK.Vector2.X

The X component of the Vector2.

float OpenTK.Vector2.Y

The Y component of the Vector2.

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

Defines a zero-length Vector2.

Property Documentation

float OpenTK.Vector2.Length
get

Gets the length (magnitude) of the vector.

LengthFast

See Also
LengthSquared
float OpenTK.Vector2.LengthFast
get

Gets an approximation of the vector length (magnitude).

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

Length

See Also
LengthSquared
float OpenTK.Vector2.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

See Also
LengthFast
Vector2 OpenTK.Vector2.PerpendicularLeft
get

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

Vector2 OpenTK.Vector2.PerpendicularRight
get

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

float OpenTK.Vector2.this[int index]
getset

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

Vector2 OpenTK.Vector2.Yx
getset

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