Dungeon Architect
17.0.0
|
Represents a 2D vector using two single-precision floating-point numbers. More...
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 | Normalized () |
Returns a copy of the Vector2 scaled to unit length. More... | |
void | Normalize () |
Scales the Vector2 to unit length. 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 | Add (Vector2 a, Vector2 b) |
Defines the size of the Vector2 struct in bytes. 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 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 | 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, Vector2 scale) |
Component-wise multiplication between the specified instance by a scale vector. 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... | |
Properties | |
float | Length [get] |
Gets the length (magnitude) of the vector. 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... | |
float | this[int index] [get, set] |
Gets or sets the value at the index of the 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.
Definition at line 38 of file Vector2.cs.
SharpNav.Geometry.Vector2.Vector2 | ( | float | value | ) |
Constructs a new instance.
value | The value that will initialize this instance. |
Definition at line 62 of file Vector2.cs.
SharpNav.Geometry.Vector2.Vector2 | ( | float | x, |
float | y | ||
) |
Constructs a new Vector2.
Definition at line 73 of file Vector2.cs.
SharpNav.Geometry.Vector2.Vector2 | ( | Vector2 | v | ) |
Constructs a new Vector2 from the given Vector2.
v | The Vector2 to copy components from. |
Definition at line 84 of file Vector2.cs.
SharpNav.Geometry.Vector2.Vector2 | ( | Vector3 | v | ) |
Constructs a new Vector2 from the given Vector3.
v | The Vector3 to copy components from. Z is discarded. |
Definition at line 95 of file Vector2.cs.
|
static |
Adds two vectors.
a | Left operand. |
b | Right operand. |
result | Result of operation. |
Definition at line 269 of file Vector2.cs.
Defines the size of the Vector2 struct in bytes.
Adds two vectors.
a | Left operand. |
b | Right operand. |
Definition at line 257 of file Vector2.cs.
|
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 |
Definition at line 657 of file Vector2.cs.
|
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 |
Definition at line 645 of file Vector2.cs.
|
static |
Clamp a vector to the given minimum and maximum vectors
vec | Input vector |
min | Minimum vector |
max | Maximum vector |
result | The clamped vector |
Definition at line 514 of file Vector2.cs.
Clamp a vector to the given minimum and maximum vectors
vec | Input vector |
min | Minimum vector |
max | Maximum vector |
Definition at line 500 of file Vector2.cs.
|
static |
Calculate the component-wise maximum of two vectors
a | First operand |
b | Second operand |
result | The component-wise maximum |
Definition at line 453 of file Vector2.cs.
Calculate the component-wise maximum of two vectors
a | First operand |
b | Second operand |
Definition at line 440 of file Vector2.cs.
|
static |
Calculate the component-wise minimum of two vectors
a | First operand |
b | Second operand |
result | The component-wise minimum |
Definition at line 424 of file Vector2.cs.
Calculate the component-wise minimum of two vectors
a | First operand |
b | Second operand |
Definition at line 411 of file Vector2.cs.
|
static |
Divides a vector by a scalar.
vector | Left operand. |
scale | Right operand. |
result | Result of the operation. |
Definition at line 373 of file Vector2.cs.
|
static |
Divide a vector by the components of a vector (scale).
vector | Left operand. |
scale | Right operand. |
result | Result of the operation. |
Definition at line 396 of file Vector2.cs.
Divides a vector by a scalar.
vector | Left operand. |
scale | Right operand. |
Definition at line 361 of file Vector2.cs.
Divides a vector by the components of a vector (scale).
vector | Left operand. |
scale | Right operand. |
Definition at line 384 of file Vector2.cs.
|
static |
Calculate the dot (scalar) product of two vectors
left | First operand |
right | Second operand |
result | The dot product of the two inputs |
Definition at line 570 of file Vector2.cs.
Calculate the dot (scalar) product of two vectors
left | First operand |
right | Second operand |
Definition at line 559 of file Vector2.cs.
override bool SharpNav.Geometry.Vector2.Equals | ( | object | obj | ) |
Indicates whether this instance and a specified object are equal.
obj | The object to compare to. |
Definition at line 848 of file Vector2.cs.
bool SharpNav.Geometry.Vector2.Equals | ( | Vector2 | other | ) |
Indicates whether the current vector is equal to another vector.
other | A vector to compare with this vector. |
Definition at line 867 of file Vector2.cs.
override int SharpNav.Geometry.Vector2.GetHashCode | ( | ) |
Returns the hashcode for this instance.
Definition at line 834 of file Vector2.cs.
|
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 |
Definition at line 626 of file Vector2.cs.
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. |
Definition at line 612 of file Vector2.cs.
Returns the Vector3 with the minimum magnitude
left | Left operand |
right | Right operand |
Definition at line 484 of file Vector2.cs.
Returns the Vector3 with the minimum magnitude
left | Left operand |
right | Right operand |
Definition at line 469 of file Vector2.cs.
|
static |
Multiplies a vector by a scalar.
vector | Left operand. |
scale | Right operand. |
result | Result of the operation. |
Definition at line 323 of file Vector2.cs.
|
static |
Multiplies a vector by the components of a vector (scale).
vector | Left operand. |
scale | Right operand. |
result | Result of the operation. |
Definition at line 346 of file Vector2.cs.
Multiplies a vector by a scalar.
vector | Left operand. |
scale | Right operand. |
Definition at line 311 of file Vector2.cs.
Multiplies a vector by the components a vector (scale).
vector | Left operand. |
scale | Right operand. |
Definition at line 334 of file Vector2.cs.
void SharpNav.Geometry.Vector2.Normalize | ( | ) |
Scales the Vector2 to unit length.
Definition at line 207 of file Vector2.cs.
Scale a vector to unit length
vec | The input vector |
result | The normalized vector |
Definition at line 542 of file Vector2.cs.
Scale a vector to unit length
vec | The input vector |
Definition at line 529 of file Vector2.cs.
Vector2 SharpNav.Geometry.Vector2.Normalized | ( | ) |
Returns a copy of the Vector2 scaled to unit length.
Definition at line 196 of file Vector2.cs.
Compares the specified instances for inequality.
left | Left operand. |
right | Right operand. |
Definition at line 806 of file Vector2.cs.
Multiplies the specified instance by a scalar.
scale | Left operand. |
vec | Right operand. |
Definition at line 755 of file Vector2.cs.
Multiplies the specified instance by a scalar.
vec | Left operand. |
scale | Right operand. |
Definition at line 742 of file Vector2.cs.
Component-wise multiplication between the specified instance by a scale vector.
scale | Left operand. |
vec | Right operand. |
Definition at line 768 of file Vector2.cs.
Adds the specified instances.
left | Left operand. |
right | Right operand. |
Definition at line 704 of file Vector2.cs.
Subtracts the specified instances.
left | Left operand. |
right | Right operand. |
Definition at line 717 of file Vector2.cs.
Negates the specified instance.
vec | Operand. |
Definition at line 729 of file Vector2.cs.
Divides the specified instance by a scalar.
vec | Left operand |
scale | Right operand |
Definition at line 781 of file Vector2.cs.
Compares the specified instances for equality.
left | Left operand. |
right | Right operand. |
Definition at line 795 of file Vector2.cs.
|
static |
Calculate the perpendicular dot (scalar) product of two vectors
left | First operand |
right | Second operand |
result | The perpendicular dot product of the two inputs |
Definition at line 596 of file Vector2.cs.
Calculate the perpendicular dot (scalar) product of two vectors
left | First operand |
right | Second operand |
Definition at line 585 of file Vector2.cs.
|
static |
Subtract one Vector from another
a | First operand |
b | Second operand |
result | Result of subtraction |
Definition at line 296 of file Vector2.cs.
Subtract one Vector from another
a | First operand |
b | Second operand |
Definition at line 284 of file Vector2.cs.
override string SharpNav.Geometry.Vector2.ToString | ( | ) |
Returns a System.String that represents the current Vector2.
Definition at line 821 of file Vector2.cs.
Defines an instance with all components set to 1.
Definition at line 240 of file Vector2.cs.
Defines a unit-length Vector2 that points towards the X-axis.
Definition at line 225 of file Vector2.cs.
Defines a unit-length Vector2 that points towards the Y-axis.
Definition at line 230 of file Vector2.cs.
float SharpNav.Geometry.Vector2.X |
The X component of the Vector2.
Definition at line 47 of file Vector2.cs.
float SharpNav.Geometry.Vector2.Y |
The Y component of the Vector2.
Definition at line 52 of file Vector2.cs.
Defines a zero-length Vector2.
Definition at line 235 of file Vector2.cs.
|
get |
|
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.
Definition at line 133 of file Vector2.cs.
|
get |
Gets the perpendicular vector on the left side of this vector.
Definition at line 163 of file Vector2.cs.
|
get |
Gets the perpendicular vector on the right side of this vector.
Definition at line 148 of file Vector2.cs.
|
getset |
Gets or sets the value at the index of the Vector.
Definition at line 176 of file Vector2.cs.
|
getset |
Gets or sets an OpenTK.Vector2 with the Y and X components of this instance.
Definition at line 681 of file Vector2.cs.