Table of Contents

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

x double

The X position.

y double

The Y position.

Properties

X

Gets the X position.

public double X { get; }

Property Value

double

Y

Gets the Y position.

public double Y { get; }

Property Value

double

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

x double

The X coordinate.

y double

The Y coordinate.

Distance(Point, Point)

Computes the Euclidean distance between the two given points.

public static double Distance(Point value1, Point value2)

Parameters

value1 Point

The first point.

value2 Point

The second point.

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 Point

The 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 object

The 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 Point

The 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 string

The string.

Returns

Point

The Point.

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 Matrix

The transform.

Returns

Point

The transformed point.

WithX(double)

Returns a new point with the specified X coordinate.

public Point WithX(double x)

Parameters

x double

The 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 double

The Y coordinate.

Returns

Point

The new point.

Operators

operator +(Point, Point)

Adds two points.

public static Point operator +(Point a, Point b)

Parameters

a Point

The first point.

b Point

The second point.

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

a Point

The point.

b Vector

The vector.

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

p Point

Point to divide by

k double

Factor

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

left Point

The first point.

right Point

The second point.

Returns

bool

True if the points are equal; otherwise false.

implicit operator Vector(Point)

Converts the Point to a Vector.

public static implicit operator Vector(Point p)

Parameters

p Point

The point.

Returns

Vector

operator !=(Point, Point)

Checks for inequality between two Points.

public static bool operator !=(Point left, Point right)

Parameters

left Point

The first point.

right Point

The second point.

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

point Point

The point.

matrix Matrix

The matrix.

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

p Point

Point to multiply

k double

Factor

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

k double

Factor

p Point

Point to multiply

Returns

Point

Points having its coordinates multiplied

operator -(Point, Point)

Subtracts two points.

public static Point operator -(Point a, Point b)

Parameters

a Point

The first point.

b Point

The second point.

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

a Point

The point.

b Vector

The vector.

Returns

Point

A point that is the result of the subtraction.

operator -(Point)

Negates a point.

public static Point operator -(Point a)

Parameters

a Point

The point.

Returns

Point

The negated point.