Vector Struct

Summary

Defines a vector.
Namespace
Avalonia
Interfaces
Base Types
  • object
  • ValueType
graph BT Type-->Base0["ValueType"] Base0-->Base1["object"] Type-.->Interface0["IEquatable<Vector>"] Type["Vector"] class Type type-node

Syntax

public readonly struct Vector : ValueType, IEquatable<Vector>

Constructors

Name Summary
Vector(double, double) 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, Vector) Vector
Adds the second to the first vector
static
Cross(Vector, Vector) double
Returns the cross product of two vectors.
static
Deconstruct(double, double) void
Deconstructs the vector into its X and Y components.
Divide(Vector, double) Vector
Divides the vector by the given scalar.
static
Divide(Vector, Vector) Vector
Divides the first vector by the second.
static
Dot(Vector, Vector) double
Returns the dot product of two vectors.
static
Equals(object) bool
Equals(Vector) bool
Check if two vectors are equal (bitwise).
GetHashCode() int
Multiply(Vector, double) Vector
Multiplies the vector by the given scalar.
static
Multiply(Vector, Vector) Vector
Multiplies the first vector by the second.
static
NearlyEquals(Vector) bool
Check if two vectors are nearly equal (numerically).
Negate() Vector
Returns a negated version of this vector.
Negate(Vector) Vector
Negates the vector
static
Normalize() Vector
Returns a normalized version of this vector.
Normalize(Vector) Vector
Normalizes the given vector.
static
Parse(string) Vector
Parses a Vector string.
static
Subtract(Vector, Vector) Vector
Subtracts the second from the first vector
static
ToString() string
Returns the string representation of the vector.
WithX(double) Vector
Returns a new vector with the specified X component.
WithY(double) Vector
Returns a new vector with the specified Y component.

Operators

Name Value Summary
explicit operator Point(Vector) Point
operator !=(Vector, Vector) bool
operator -(Vector) Vector
operator -(Vector, Vector) Vector
operator *(double, Vector) Vector
operator *(Vector, double) Vector
operator *(Vector, Vector) double
operator /(Vector, double) Vector
operator +(Vector, Vector) Vector
operator ==(Vector, Vector) bool