Struct Point
- Namespace
- Avalonia
- Assembly
- Avalonia.Base.dll
Defines a point.
public readonly struct Point : IEquatable<Point>
- Implements
- Inherited Members
Constructors
Point(double, double)
Initializes a new instance of the Point structure.
public Point(double x, double y)
Parameters
Properties
X
Gets the X position.
public double X { get; }
Property Value
Y
Gets the Y position.
public double Y { get; }
Property Value
Methods
Deconstruct(out double, out double)
Deconstructs the point into its X and Y coordinates.
public void Deconstruct(out double x, out double y)
Parameters
Distance(Point, Point)
Computes the Euclidean distance between the two given points.
public static double Distance(Point value1, Point value2)
Parameters
Returns
- double
The Euclidean distance.
Equals(Point)
Returns a boolean indicating whether the point is equal to the other given point (bitwise).
public bool Equals(Point other)
Parameters
other
PointThe other point to test equality against.
Returns
- bool
True if this point is equal to other; False otherwise.
Equals(object?)
Checks for equality between a point and an object.
public override bool Equals(object? obj)
Parameters
obj
objectThe object.
Returns
- bool
True if
obj
is a point that equals the current point.
GetHashCode()
Returns a hash code for a Point.
public override int GetHashCode()
Returns
- int
The hash code.
NearlyEquals(Point)
Returns a boolean indicating whether the point is equal to the other given point (numerically).
public bool NearlyEquals(Point other)
Parameters
other
PointThe other point to test equality against.
Returns
- bool
True if this point is equal to other; False otherwise.
Parse(string)
Parses a Point string.
public static Point Parse(string s)
Parameters
s
stringThe string.
Returns
ToString()
Returns the string representation of the point.
public override string ToString()
Returns
- string
The string representation of the point.
Transform(Matrix)
Transforms the point by a matrix.
public Point Transform(Matrix transform)
Parameters
transform
MatrixThe transform.
Returns
- Point
The transformed point.
WithX(double)
Returns a new point with the specified X coordinate.
public Point WithX(double x)
Parameters
x
doubleThe X coordinate.
Returns
- Point
The new point.
WithY(double)
Returns a new point with the specified Y coordinate.
public Point WithY(double y)
Parameters
y
doubleThe Y coordinate.
Returns
- Point
The new point.
Operators
operator +(Point, Point)
Adds two points.
public static Point operator +(Point a, Point b)
Parameters
Returns
- Point
A point that is the result of the addition.
operator +(Point, Vector)
Adds a vector to a point.
public static Point operator +(Point a, Vector b)
Parameters
Returns
- Point
A point that is the result of the addition.
operator /(Point, double)
Divides a point by a factor coordinate-wise
public static Point operator /(Point p, double k)
Parameters
Returns
- Point
Points having its coordinates divided
operator ==(Point, Point)
Checks for equality between two Points.
public static bool operator ==(Point left, Point right)
Parameters
Returns
- bool
True if the points are equal; otherwise false.
implicit operator Vector(Point)
public static implicit operator Vector(Point p)
Parameters
p
PointThe point.
Returns
operator !=(Point, Point)
Checks for inequality between two Points.
public static bool operator !=(Point left, Point right)
Parameters
Returns
- bool
True if the points are unequal; otherwise false.
operator *(Point, Matrix)
Applies a matrix to a point.
public static Point operator *(Point point, Matrix matrix)
Parameters
Returns
- Point
The resulting point.
operator *(Point, double)
Multiplies a point by a factor coordinate-wise
public static Point operator *(Point p, double k)
Parameters
Returns
- Point
Points having its coordinates multiplied
operator *(double, Point)
Multiplies a point by a factor coordinate-wise
public static Point operator *(double k, Point p)
Parameters
Returns
- Point
Points having its coordinates multiplied
operator -(Point, Point)
Subtracts two points.
public static Point operator -(Point a, Point b)
Parameters
Returns
- Point
A point that is the result of the subtraction.
operator -(Point, Vector)
Subtracts a vector from a point.
public static Point operator -(Point a, Vector b)
Parameters
Returns
- Point
A point that is the result of the subtraction.
operator -(Point)
Negates a point.
public static Point operator -(Point a)
Parameters
a
PointThe point.
Returns
- Point
The negated point.