Class Point
Represents a 2D point with X and Y coordinates. Immutable: all operations return new instances. Provides methods and operators for creation, translation, scaling, comparison, distance calculation, and tuple deconstruction.
public sealed class Point : IPoint, IEquatable<Point>
- Inheritance
-
Point
- Implements
- Inherited Members
Constructors
- Point(double, double)
Initializes a new instance of the Point class with the specified coordinates.
Properties
- Origin
Gets a point at the origin (0, 0).
- X
Gets the X-coordinate of the point.
- Y
Gets the Y-coordinate of the point.
Methods
- Deconstruct(out double, out double)
Deconstructs the point into its X and Y coordinates. Enables tuple-style deconstruction:
var (x, y) = point;
- Distance(Point, Point)
Calculates the Euclidean distance between two points.
- DistanceSquared(Point, Point)
Calculates the squared distance between two points. Faster than Euclidean distance since no square root is taken.
- Scale(double, double)
Returns a new point scaled by the specified factors along the X and Y axes.
- Translate(double, double)
Returns a new point translated by the specified amounts along the X and Y axes.
Operators
- operator +(Point, Point)
Adds the coordinates of two points.
- operator /(Point, double)
Divides the coordinates of a point by a scalar.
- operator ==(Point, Point)
Determines whether two points have the same coordinates.
- operator !=(Point, Point)
Determines whether two points have different coordinates.
- operator *(Point, double)
Multiplies the coordinates of a point by a scalar.
- operator *(double, Point)
Multiplies the coordinates of a point by a scalar.
- operator -(Point, Point)
Subtracts the coordinates of one point from another.