|
The Open Toolkit library
1.0
|
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... | |
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.
| OpenTK.Vector2.Vector2 | ( | float | value | ) |
Constructs a new instance.
| value | The value that will initialize this instance. |
| OpenTK.Vector2.Vector2 | ( | float | x, |
| float | y | ||
| ) |
| OpenTK.Vector2.Vector2 | ( | Vector2 | v | ) |
| OpenTK.Vector2.Vector2 | ( | Vector3 | v | ) |
| OpenTK.Vector2.Vector2 | ( | Vector4 | v | ) |
| void OpenTK.Vector2.Add | ( | Vector2 | right | ) |
Add the Vector passed as parameter to this instance.
| right | Right operand. This parameter is only read from. |
| void OpenTK.Vector2.Add | ( | ref Vector2 | right | ) |
Add the Vector passed as parameter to this instance.
| right | Right operand. This parameter is only read from. |
Adds two vectors.
| a | Left operand. |
| b | Right operand. |
Adds two vectors.
| a | Left operand. |
| b | Right operand. |
| result | Result of operation. |
|
static |
Interpolate 3 Vectors using Barycentric coordinates
| a | First input Vector |
| b | Second input Vector |
| c | Third input Vector |
| u | First Barycentric Coordinate |
| v | Second Barycentric Coordinate |
|
static |
Interpolate 3 Vectors using Barycentric coordinates
| a | First input Vector. |
| b | Second input Vector. |
| c | Third input Vector. |
| u | First Barycentric Coordinate. |
| v | Second Barycentric Coordinate. |
| 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 a vector to the given minimum and maximum vectors
| vec | Input vector |
| min | Minimum vector |
| max | Maximum vector |
|
static |
Clamp a vector to the given minimum and maximum vectors
| vec | Input vector |
| min | Minimum vector |
| max | Maximum vector |
| result | The clamped vector |
Calculate the component-wise maximum of two vectors
| a | First operand |
| b | Second operand |
Calculate the component-wise maximum of two vectors
| a | First operand |
| b | Second operand |
| result | The component-wise maximum |
Calculate the component-wise minimum of two vectors
| a | First operand |
| b | Second operand |
Calculate the component-wise minimum of two vectors
| a | First operand |
| b | Second operand |
| result | The component-wise minimum |
| void OpenTK.Vector2.Div | ( | float | f | ) |
Divide this instance by a scalar.
| f | Scalar operand. |
Divide a vector by a scalar
| a | Vector operand |
| f | Scalar operand |
Divide a vector by a scalar
| a | Vector operand |
| f | Scalar operand |
| result | Result of the division |
Divides a vector by a scalar.
| vector | Left operand. |
| scale | Right operand. |
Divides a vector by a scalar.
| vector | Left operand. |
| scale | Right operand. |
| result | Result of the operation. |
Divides a vector by the components of a vector (scale).
| vector | Left operand. |
| scale | Right operand. |
|
static |
Divide a vector by the components of a vector (scale).
| vector | Left operand. |
| scale | Right operand. |
| result | Result of the operation. |
Calculate the dot (scalar) product of two vectors
| left | First operand |
| right | Second operand |
Calculate the dot (scalar) product of two vectors
| left | First operand |
| right | Second operand |
| result | The dot product of the two inputs |
| override bool OpenTK.Vector2.Equals | ( | object | obj | ) |
Indicates whether this instance and a specified object are equal.
| obj | The object to compare to. |
| bool OpenTK.Vector2.Equals | ( | Vector2 | other | ) |
Indicates whether the current vector is equal to another vector.
| other | A vector to compare with this vector. |
| override int OpenTK.Vector2.GetHashCode | ( | ) |
Returns the hashcode for this instance.
Returns a new Vector that is the linear blend of the 2 given Vectors
| a | First input vector |
| b | Second input vector |
| blend | The blend factor. a when blend=0, b when blend=1. |
|
static |
Returns a new Vector that is the linear blend of the 2 given Vectors
| a | First input vector |
| b | Second input vector |
| blend | The blend factor. a when blend=0, b when blend=1. |
| result | a when blend=0, b when blend=1, and a linear combination otherwise |
| void OpenTK.Vector2.Mult | ( | float | f | ) |
Multiply this instance by a scalar.
| f | Scalar operand. |
Multiply a vector and a scalar
| a | Vector operand |
| f | Scalar operand |
Multiply a vector and a scalar
| a | Vector operand |
| f | Scalar operand |
| result | Result of the multiplication |
Multiplies a vector by a scalar.
| vector | Left operand. |
| scale | Right operand. |
Multiplies a vector by a scalar.
| vector | Left operand. |
| scale | Right operand. |
| result | Result of the operation. |
Multiplies a vector by the components a vector (scale).
| vector | Left operand. |
| scale | Right operand. |
|
static |
Multiplies a vector by the components of a vector (scale).
| vector | Left operand. |
| scale | Right operand. |
| result | Result of the operation. |
| void OpenTK.Vector2.Normalize | ( | ) |
Scales the Vector2 to unit length.
Scale a vector to unit length
| vec | The input vector |
Scale a vector to unit length
| vec | The input vector |
| result | The normalized vector |
| void OpenTK.Vector2.NormalizeFast | ( | ) |
Scales the Vector2 to approximately unit length.
Scale a vector to approximately unit length
| vec | The input vector |
Scale a vector to approximately unit length
| vec | The input vector |
| result | The normalized vector |
Compares the specified instances for inequality.
| left | Left operand. |
| right | Right operand. |
Multiplies the specified instance by a scalar.
| vec | Left operand. |
| scale | Right operand. |
Multiplies the specified instance by a scalar.
| scale | Left operand. |
| vec | Right operand. |
Adds the specified instances.
| left | Left operand. |
| right | Right operand. |
Subtracts the specified instances.
| left | Left operand. |
| right | Right operand. |
Negates the specified instance.
| vec | Operand. |
Divides the specified instance by a scalar.
| vec | Left operand |
| scale | Right operand |
Compares the specified instances for equality.
| left | Left operand. |
| right | Right operand. |
Calculate the perpendicular dot (scalar) product of two vectors
| left | First operand |
| right | Second operand |
Calculate the perpendicular dot (scalar) product of two vectors
| left | First operand |
| right | Second operand |
| result | The perpendicular dot product of the two inputs |
| void OpenTK.Vector2.Scale | ( | float | sx, |
| float | sy | ||
| ) |
Scales the current Vector2 by the given amounts.
| sx | The scale of the X component. |
| sy | The scale of the Y component. |
| void OpenTK.Vector2.Scale | ( | Vector2 | scale | ) |
Scales this instance by the given parameter.
| scale | The scaling of the individual components. |
| void OpenTK.Vector2.Scale | ( | ref Vector2 | scale | ) |
Scales this instance by the given parameter.
| scale | The scaling of the individual components. |
| void OpenTK.Vector2.Sub | ( | Vector2 | right | ) |
Subtract the Vector passed as parameter from this instance.
| right | Right operand. This parameter is only read from. |
| void OpenTK.Vector2.Sub | ( | ref Vector2 | right | ) |
Subtract the Vector passed as parameter from this instance.
| right | Right operand. This parameter is only read from. |
Subtract one Vector from another
| a | First operand |
| b | Second operand |
Subtract one Vector from another
| a | First operand |
| b | Second operand |
| result | Result of subtraction |
Subtract one Vector from another
| a | First operand |
| b | Second operand |
Subtract one Vector from another
| a | First operand |
| b | Second operand |
| result | Result of subtraction |
| override string OpenTK.Vector2.ToString | ( | ) |
Returns a System.String that represents the current Vector2.
|
static |
Transforms a vector by a quaternion rotation.
| vec | The vector to transform. |
| quat | The quaternion to rotate the vector by. |
|
static |
Transforms a vector by a quaternion rotation.
| vec | The vector to transform. |
| quat | The quaternion to rotate the vector by. |
| result | The result of the operation. |
Defines an instance with all components set to 1.
|
static |
Defines the size of the Vector2 struct in bytes.
Defines a unit-length Vector2 that points towards the X-axis.
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.
|
get |
|
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.
|
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.
|
get |
Gets the perpendicular vector on the left side of this vector.
|
get |
Gets the perpendicular vector on the right side of this vector.
|
getset |
Gets or sets the value at the index of the Vector.
|
getset |
Gets or sets an OpenTK.Vector2 with the Y and X components of this instance.