Summary
Defines a vector.
Syntax
public readonly struct Vector : ValueType, IEquatable<Vector>
Constructors
Name | Summary |
---|---|
Vector |
Initializes a new instance of the Vector structure.
|
Properties
Name | Value | Summary |
---|---|---|
IsDefault | bool |
Gets a value indicating whether the X and Y components are zero.
|
Length | double |
Length of the vector.
|
One | Vector |
Returns the vector (1.0, 1.0).
static
|
SquaredLength | double |
Squared Length of the vector.
|
UnitX | Vector |
Returns the vector (1.0, 0.0).
static
|
UnitY | Vector |
Returns the vector (0.0, 1.0).
static
|
X | double |
Gets the X component.
|
Y | double |
Gets the Y component.
|
Zero | Vector |
Returns the vector (0.0, 0.0).
static
|
Methods
Name | Value | Summary |
---|---|---|
Add |
Vector |
Adds the second to the first vector
static
|
Cross |
double |
Returns the cross product of two vectors.
static
|
Deconstruct |
void |
Deconstructs the vector into its X and Y components.
|
Divide |
Vector |
Divides the vector by the given scalar.
static
|
Divide |
Vector |
Divides the first vector by the second.
static
|
Dot |
double |
Returns the dot product of two vectors.
static
|
Equals |
bool | |
Equals |
bool |
Check if two vectors are equal (bitwise).
|
GetHashCode |
int | |
Multiply |
Vector |
Multiplies the vector by the given scalar.
static
|
Multiply |
Vector |
Multiplies the first vector by the second.
static
|
NearlyEquals |
bool |
Check if two vectors are nearly equal (numerically).
|
Negate |
Vector |
Returns a negated version of this vector.
|
Negate |
Vector |
Negates the vector
static
|
Normalize |
Vector |
Returns a normalized version of this vector.
|
Normalize |
Vector |
Normalizes the given vector.
static
|
Parse |
Vector |
Parses a
Vector string.
static
|
Subtract |
Vector |
Subtracts the second from the first vector
static
|
ToString |
string |
Returns the string representation of the vector.
|
WithX |
Vector |
Returns a new vector with the specified X component.
|
WithY |
Vector |
Returns a new vector with the specified Y component.
|
Operators
Name | Value | Summary |
---|---|---|
explicit operator |
Point | |
operator != |
bool | |
operator - |
Vector | |
operator - |
Vector | |
operator * |
Vector | |
operator * |
Vector | |
operator * |
double | |
operator / |
Vector | |
operator + |
Vector | |
operator == |
bool |