Vector Struct
Definition
Defines a vector.
public struct Vector
Constructors
| Name | Description |
|---|---|
| Vector | Initializes a new instance of the Avalonia.Vector structure. |
Vector Constructor
Initializes a new instance of the Avalonia.Vector structure.
public Vector(double x, double y)
Parameters
x double
The X component.
y double
The Y component.
Methods
| Name | Description |
|---|---|
| Abs | Returns a vector whose elements are the absolute values of each of the specified vector's elements. |
| Add | Adds the second to the first vector |
| Clamp | Restricts a vector between a minimum and a maximum value. |
| Cross | Returns the cross product of two vectors. |
| Deconstruct | No summary available. |
| Distance | Computes the Euclidean distance between the two given points. |
| DistanceSquared | Returns the Euclidean distance squared between two specified points |
| Divide (2 overloads) | Divides the first vector by the second. |
| Dot | Returns the dot product of two vectors. |
| Equals (2 overloads) | Check if two vectors are equal (bitwise). |
| GetHashCode | No summary available. |
| Max | Returns a vector whose elements are the maximum of each of the pairs of elements in two specified vectors |
| Min | Returns a vector whose elements are the minimum of each of the pairs of elements in two specified vectors |
| Multiply (2 overloads) | Multiplies the first vector by the second. |
| NearlyEquals | Check if two vectors are nearly equal (numerically). |
| Negate (2 overloads) | Returns a negated version of this vector. |
| Normalize (2 overloads) | Returns a normalized version of this vector. |
| Parse | Parses a Avalonia.Vector string. |
| Subtract | Subtracts the second from the first vector |
| ToString | Returns the string representation of the vector. |
| WithX | Returns a new vector with the specified X component. |
| WithY | Returns a new vector with the specified Y component. |
Abs Method
Returns a vector whose elements are the absolute values of each of the specified vector's elements.
public Avalonia.Vector Abs()
Returns
Add Method
Adds the second to the first vector
public Avalonia.Vector Add(Avalonia.Vector a, Avalonia.Vector b)
Parameters
The first vector.
The second vector.
Returns
The summed vector.
Clamp Method
Restricts a vector between a minimum and a maximum value.
public Avalonia.Vector Clamp(Avalonia.Vector value, Avalonia.Vector min, Avalonia.Vector max)
Parameters
value Avalonia.Vector
min Avalonia.Vector
max Avalonia.Vector
Returns
Cross Method
Returns the cross product of two vectors.
public double Cross(Avalonia.Vector a, Avalonia.Vector b)
Parameters
The first vector.
The second vector.
Returns
double
The cross product.
Deconstruct Method
public void Deconstruct(double& x, double& y)
Parameters
x double&
y double&
Distance Method
Computes the Euclidean distance between the two given points.
public double Distance(Avalonia.Vector value1, Avalonia.Vector value2)
Parameters
value1 Avalonia.Vector
The first point.
value2 Avalonia.Vector
The second point.
Returns
double
The Euclidean distance.
DistanceSquared Method
Returns the Euclidean distance squared between two specified points
public double DistanceSquared(Avalonia.Vector value1, Avalonia.Vector value2)
Parameters
value1 Avalonia.Vector
The first point.
value2 Avalonia.Vector
The second point.
Returns
double
The Euclidean distance squared.
Divide overloads
Divide Method
Divides the first vector by the second.
public Avalonia.Vector Divide(Avalonia.Vector a, Avalonia.Vector b)
Parameters
The first vector.
The second vector.
Returns
The scaled vector.
Divide Method
Divides the vector by the given scalar.
public Avalonia.Vector Divide(Avalonia.Vector vector, double scalar)
Parameters
vector Avalonia.Vector
The vector
scalar double
The scalar value
Returns
The scaled vector.
Dot Method
Returns the dot product of two vectors.
public double Dot(Avalonia.Vector a, Avalonia.Vector b)
Parameters
The first vector.
The second vector.
Returns
double
The dot product.
Equals overloads
Equals Method
Check if two vectors are equal (bitwise).
public bool Equals(Avalonia.Vector other)
Parameters
other Avalonia.Vector
Returns
bool
Equals Method
public bool Equals(object obj)
Parameters
obj object
Returns
bool
GetHashCode Method
public int GetHashCode()
Returns
int
Max Method
Returns a vector whose elements are the maximum of each of the pairs of elements in two specified vectors
public Avalonia.Vector Max(Avalonia.Vector left, Avalonia.Vector right)
Parameters
left Avalonia.Vector
right Avalonia.Vector
Returns
Min Method
Returns a vector whose elements are the minimum of each of the pairs of elements in two specified vectors
public Avalonia.Vector Min(Avalonia.Vector left, Avalonia.Vector right)
Parameters
left Avalonia.Vector
right Avalonia.Vector
Returns
Multiply overloads
Multiply Method
Multiplies the first vector by the second.
public Avalonia.Vector Multiply(Avalonia.Vector a, Avalonia.Vector b)
Parameters
The first vector.
The second vector.
Returns
The scaled vector.
Multiply Method
Multiplies the vector by the given scalar.
public Avalonia.Vector Multiply(Avalonia.Vector vector, double scalar)
Parameters
vector Avalonia.Vector
The vector
scalar double
The scalar value
Returns
The scaled vector.
NearlyEquals Method
Check if two vectors are nearly equal (numerically).
public bool NearlyEquals(Avalonia.Vector other)
Parameters
other Avalonia.Vector
The other vector.
Returns
bool
True if vectors are nearly equal.
Negate overloads
Negate Method
Returns a negated version of this vector.
public Avalonia.Vector Negate()
Returns
The negated vector.
Negate Method
Negates the vector
public Avalonia.Vector Negate(Avalonia.Vector vector)
Parameters
vector Avalonia.Vector
The vector to negate.
Returns
The scaled vector.
Normalize overloads
Normalize Method
Returns a normalized version of this vector.
public Avalonia.Vector Normalize()
Returns
The normalized vector.
Normalize Method
Normalizes the given vector.
public Avalonia.Vector Normalize(Avalonia.Vector vector)
Parameters
vector Avalonia.Vector
The vector
Returns
The normalized vector.
Parse Method
Parses a Avalonia.Vector string.
public Avalonia.Vector Parse(string s)
Parameters
s string
The string.
Returns
The Avalonia.Vector.
Subtract Method
Subtracts the second from the first vector
public Avalonia.Vector Subtract(Avalonia.Vector a, Avalonia.Vector b)
Parameters
The first vector.
The second vector.
Returns
The difference vector.
ToString Method
Returns the string representation of the vector.
public string ToString()
Returns
string
The string representation of the vector.
WithX Method
Returns a new vector with the specified X component.
public Avalonia.Vector WithX(double x)
Parameters
x double
The X component.
Returns
The new vector.
WithY Method
Returns a new vector with the specified Y component.
public Avalonia.Vector WithY(double y)
Parameters
y double
The Y component.
Returns
The new vector.
Properties
| Name | Description |
|---|---|
| Length | Length of the vector. |
| One | Returns the vector (1.0, 1.0). |
| SquaredLength | Squared Length of the vector. |
| UnitX | Returns the vector (1.0, 0.0). |
| UnitY | Returns the vector (0.0, 1.0). |
| X | Gets the X component. |
| Y | Gets the Y component. |
| Zero | Returns the vector (0.0, 0.0). |
Length Property
Length of the vector.
public double Length { get; set; }
One Property
Returns the vector (1.0, 1.0).
public Avalonia.Vector One { get; set; }
SquaredLength Property
Squared Length of the vector.
public double SquaredLength { get; set; }
UnitX Property
Returns the vector (1.0, 0.0).
public Avalonia.Vector UnitX { get; set; }
UnitY Property
Returns the vector (0.0, 1.0).
public Avalonia.Vector UnitY { get; set; }
X Property
Gets the X component.
public double X { get; set; }
Y Property
Gets the Y component.
public double Y { get; set; }
Zero Property
Returns the vector (0.0, 0.0).
public Avalonia.Vector Zero { get; set; }