Struct PixelVector
- Namespace
- Avalonia
- Assembly
- Avalonia.Base.dll
Defines a vector.
public readonly struct PixelVector
- Inherited Members
Constructors
PixelVector(int, int)
Initializes a new instance of the PixelVector structure.
public PixelVector(int x, int y)
Parameters
Properties
Length
Length of the vector
public double Length { get; }
Property Value
X
Gets the X vector.
public int X { get; }
Property Value
Y
Gets the Y vector.
public int Y { get; }
Property Value
Methods
Equals(PixelVector)
Check if two vectors are equal (bitwise).
public bool Equals(PixelVector other)
Parameters
other
PixelVector
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
obj
object
Returns
GetHashCode()
public override int GetHashCode()
Returns
NearlyEquals(PixelVector)
Check if two vectors are nearly equal (numerically).
public bool NearlyEquals(PixelVector other)
Parameters
other
PixelVectorThe other vector.
Returns
- bool
True if vectors are nearly equal.
ToString()
Returns the string representation of the point.
public override string ToString()
Returns
- string
The string representation of the point.
WithX(int)
Returns a new vector with the specified X coordinate.
public PixelVector WithX(int x)
Parameters
x
intThe X coordinate.
Returns
- PixelVector
The new vector.
WithY(int)
Returns a new vector with the specified Y coordinate.
public PixelVector WithY(int y)
Parameters
y
intThe Y coordinate.
Returns
- PixelVector
The new vector.
Operators
operator +(PixelVector, PixelVector)
Adds two vectors.
public static PixelVector operator +(PixelVector a, PixelVector b)
Parameters
a
PixelVectorThe first vector.
b
PixelVectorThe second vector.
Returns
- PixelVector
A vector that is the result of the addition.
operator /(PixelVector, int)
Scales a vector.
public static PixelVector operator /(PixelVector vector, int scale)
Parameters
vector
PixelVectorThe vector
scale
intThe divisor.
Returns
- PixelVector
The scaled vector.
operator ==(PixelVector, PixelVector)
public static bool operator ==(PixelVector left, PixelVector right)
Parameters
left
PixelVectorright
PixelVector
Returns
explicit operator PixelPoint(PixelVector)
Converts the PixelVector to a PixelPoint.
public static explicit operator PixelPoint(PixelVector a)
Parameters
a
PixelVectorThe vector.
Returns
operator !=(PixelVector, PixelVector)
public static bool operator !=(PixelVector left, PixelVector right)
Parameters
left
PixelVectorright
PixelVector
Returns
operator *(PixelVector, PixelVector)
Calculates the dot product of two vectors
public static int operator *(PixelVector a, PixelVector b)
Parameters
a
PixelVectorFirst vector
b
PixelVectorSecond vector
Returns
- int
The dot product
operator *(PixelVector, int)
Scales a vector.
public static PixelVector operator *(PixelVector vector, int scale)
Parameters
vector
PixelVectorThe vector
scale
intThe scaling factor.
Returns
- PixelVector
The scaled vector.
operator -(PixelVector, PixelVector)
Subtracts two vectors.
public static PixelVector operator -(PixelVector a, PixelVector b)
Parameters
a
PixelVectorThe first vector.
b
PixelVectorThe second vector.
Returns
- PixelVector
A vector that is the result of the subtraction.
operator -(PixelVector)
Negates a vector.
public static PixelVector operator -(PixelVector a)
Parameters
a
PixelVectorThe vector.
Returns
- PixelVector
The negated vector.