Table of Contents

Class Point

Namespace
LMKit.Graphics.Geometry
Assembly
LM-Kit.NET.dll

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, Manhattan distance calculation, and tuple deconstruction.

public sealed class Point : IPoint, IEquatable<Point>, IFormattable
Inheritance
Point
Implements
Inherited Members

Constructors

Point(double, double)

Initializes a new instance of the Point class with the specified coordinates.

Properties

ManhattanLength

Gets the Manhattan length (L1 norm) of this point treated as a vector from the origin.

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

Angle(Point)

Returns the polar angle of the vector represented by this point, in radians.

AngleBetween(Point, Point)

Computes the smallest angle between two vectors (points), in radians.

CrossZ(Point, Point)

Computes the scalar Z-component of the 2D cross product (a.x * b.y - a.y * b.x).

Deconstruct(out double, out double)

Deconstructs the point into its X and Y coordinates. Enables tuple-style deconstruction: var (x, y) = point;

Distance(IPoint, IPoint)

Calculates the Euclidean distance between two points provided via IPoint.

Distance(Point, Point)

Calculates the Euclidean distance between two points.

Distance(double, double, double, double)

Calculates the Euclidean distance between two 2D points provided as raw coordinate pairs.

DistanceSquared(IPoint, IPoint)

Calculates the squared distance between two points provided via IPoint.

DistanceSquared(Point, Point)

Calculates the squared distance between two points. Faster than Euclidean distance since no square root is taken.

DistanceSquared(double, double, double, double)

Calculates the squared Euclidean distance between two 2D points provided as raw coordinate pairs.

Dot(Point, Point)

Computes the dot product between two points treated as vectors from the origin.

Equals(Point)
Equals(object)
FromVector2(Vector2)

Creates a Point from a Vector2.

GetHashCode()
Lerp(Point, Point, double)

Linearly interpolates between two points.

ManhattanDistance(IPoint, IPoint)

Calculates the Manhattan distance (L1 norm) between two points provided via IPoint.

ManhattanDistance(Point, Point)

Calculates the Manhattan distance (L1 norm) between two points.

ManhattanDistance(double, double, double, double)

Calculates the Manhattan distance (L1 norm) between two 2D points provided as raw coordinate pairs.

ManhattanDistanceTo(IPoint)

Calculates the Manhattan distance (L1 norm) from this point to another point provided via IPoint.

ManhattanDistanceTo(Point)

Calculates the Manhattan distance (L1 norm) from this point to another point.

Midpoint(Point, Point)

Computes the midpoint between two points.

NearlyEquals(Point, Point, double)

Determines whether two points are equal within a specified tolerance.

Parse(string, IFormatProvider)

Parses a string into a Point. Accepted forms include "x,y", "x y", and "(x, y)".

Rotate(Point, Point, double)

Rotates a point around the specified center by the given angle in radians.

Rotate(Point, double)

Rotates a point around the origin by the specified angle in radians.

Scale(IPoint)

Returns a new point scaled by the given vector of factors.

Scale(double)

Returns a new point uniformly scaled by a single factor.

Scale(double, double)

Returns a new point scaled by the specified factors along the X and Y axes.

ToString()
ToString(string, IFormatProvider)

Returns a culture-aware string representation of the point using the specified format.

ToVector2()

Returns a Vector2 representation of this point.

Translate(IPoint)

Returns a new point translated by the specified vector.

Translate(double, double)

Returns a new point translated by the specified amounts along the X and Y axes.

TryParse(string, out Point, IFormatProvider)

Attempts to parse a string into a Point.

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.

explicit operator Vector2(Point)

Converts a Point to Vector2.

explicit operator Point(Vector2)

Converts a Vector2 to Point.

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.