The Open Toolkit library
1.0
|
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... | |
Represents a 2D vector using two double-precision floating-point numbers.
OpenTK.Vector2d.Vector2d | ( | double | value | ) |
Constructs a new instance.
value | The value that will initialize this instance. |
OpenTK.Vector2d.Vector2d | ( | double | x, |
double | y | ||
) |
Constructs left vector with the given coordinates.
x | The X coordinate. |
y | The Y coordinate. |
void OpenTK.Vector2d.Add | ( | Vector2d | right | ) |
Add the Vector passed as parameter to this instance.
right | Right operand. This parameter is only read from. |
void OpenTK.Vector2d.Add | ( | ref Vector2d | 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 |
void OpenTK.Vector2d.Div | ( | double | f | ) |
Divide this instance by a scalar.
f | Scalar operand. |
Divide a vector by a scalar
a | Vector operand |
d | Scalar operand |
Divide a vector by a scalar
a | Vector operand |
d | Scalar operand |
result | Result of the division |
Divides a vector by a scalar.
vector | Left operand. |
scale | Right operand. |
|
static |
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.Vector2d.Equals | ( | object | obj | ) |
Indicates whether this instance and a specified object are equal.
obj | The object to compare to. |
bool OpenTK.Vector2d.Equals | ( | Vector2d | other | ) |
Indicates whether the current vector is equal to another vector.
other | A vector to compare with this vector. |
override int OpenTK.Vector2d.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 |
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.Vector2d.Mult | ( | double | f | ) |
Multiply this instance by a scalar.
f | Scalar operand. |
Multiply a vector and a scalar
a | Vector operand |
d | Scalar operand |
Multiply a vector and a scalar
a | Vector operand |
d | Scalar operand |
result | Result of the multiplication |
Multiplies a vector by a scalar.
vector | Left operand. |
scale | Right operand. |
|
static |
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.Vector2d.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 |
Vector2d OpenTK.Vector2d.Normalized | ( | ) |
Returns a copy of the Vector2d scaled to 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 |
Converts OpenTK.Vector2d to OpenTK.Vector2.
v2d | The Vector2d to convert. |
Converts OpenTK.Vector2 to OpenTK.Vector2d.
v2 | The Vector2 to convert. |
Compares two instances for ienquality.
left | The left instance. |
right | The right instance. |
Multiplies an instance by a scalar.
vec | The instance. |
f | The scalar. |
Multiply an instance by a scalar.
f | The scalar. |
vec | The instance. |
Adds two instances.
left | The left instance. |
right | The right instance. |
Subtracts two instances.
left | The left instance. |
right | The right instance. |
Negates an instance.
vec | The instance. |
Divides an instance by a scalar.
vec | The instance. |
f | The scalar. |
Compares two instances for equality.
left | The left instance. |
right | The right instance. |
void OpenTK.Vector2d.Scale | ( | double | sx, |
double | 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.Vector2d.Scale | ( | Vector2d | scale | ) |
Scales this instance by the given parameter.
scale | The scaling of the individual components. |
void OpenTK.Vector2d.Scale | ( | ref Vector2d | scale | ) |
Scales this instance by the given parameter.
scale | The scaling of the individual components. |
void OpenTK.Vector2d.Sub | ( | Vector2d | right | ) |
Subtract the Vector passed as parameter from this instance.
right | Right operand. This parameter is only read from. |
void OpenTK.Vector2d.Sub | ( | ref Vector2d | 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.Vector2d.ToString | ( | ) |
Returns a System.String that represents the current instance.
|
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 Vector2d struct in bytes.
Defines a unit-length Vector2d that points towards the X-axis.
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.
|
get |
Gets the length (magnitude) of the vector.
|
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.Vector2d with the Y and X components of this instance.