Show / Hide Table of Contents

Struct Point

Universal type for a set of two-dimensional coordinates.

Implements
IVector
IEquatable<IVector>
IEquatable<Vector2>
IFormattable
IEquatable<Point>
Inherited Members
object.Equals(object, object)
object.GetType()
object.ReferenceEquals(object, object)
Namespace: TheXDS.MCART.Types
Assembly: MCART.dll
Syntax
public struct Point : IVector, IEquatable<IVector>, IEquatable<Vector2>, IFormattable, IEquatable<Point>

Constructors

| Edit this page View Source

Point()

Initializes a new instance of the Point structure.

Declaration
public Point()
| Edit this page View Source

Point(double, double)

Universal type for a set of two-dimensional coordinates.

Declaration
public Point(double x, double y)
Parameters
Type Name Description
double x

The x coordinate.

double y

The y coordinate.

Fields

| Edit this page View Source

Nowhere

Gets a point that does not represent any position. This field is read-only.

Declaration
public static readonly Point Nowhere
Field Value
Type Description
Point

A Point with its coordinates set to NaN.

| Edit this page View Source

Origin

Gets a point at the origin. This field is read-only.

Declaration
public static readonly Point Origin
Field Value
Type Description
Point

A Point with its coordinates at the origin.

Properties

| Edit this page View Source

X

X coordinate.

Declaration
public double X { readonly get; set; }
Property Value
Type Description
double
| Edit this page View Source

Y

Y coordinate.

Declaration
public double Y { readonly get; set; }
Property Value
Type Description
double

Methods

| Edit this page View Source

Angle()

Calculates the angle formed by the line connecting the origin and this Point with respect to the horizontal X axis.

Declaration
public readonly double Angle()
Returns
Type Description
double

The calculated angle.

| Edit this page View Source

Equals(object?)

Indicates whether this instance and a specified object are equal.

Declaration
public override readonly bool Equals(object? obj)
Parameters
Type Name Description
object obj

The object to compare with the current instance.

Returns
Type Description
bool

true if this instance and obj are equal; false otherwise.

Overrides
ValueType.Equals(object)
| Edit this page View Source

Equals(IVector?)

Compares the equality of the vectors.

Declaration
public readonly bool Equals(IVector? other)
Parameters
Type Name Description
IVector other

The IVector to compare against.

Returns
Type Description
bool

true if all vectors of both objects are equal; false otherwise.

| Edit this page View Source

Equals(Point)

Compares the equality of the point vectors.

Declaration
public readonly bool Equals(Point other)
Parameters
Type Name Description
Point other

The Point to compare against.

Returns
Type Description
bool

true if all vectors of both points are equal; otherwise, false.

| Edit this page View Source

GetHashCode()

Returns the hash code for this instance.

Declaration
public override readonly int GetHashCode()
Returns
Type Description
int

The hash code for this instance.

Overrides
ValueType.GetHashCode()
| Edit this page View Source

Magnitude()

Calculates the magnitude of the coordinates.

Declaration
public readonly double Magnitude()
Returns
Type Description
double

The resulting magnitude between the point and the origin.

| Edit this page View Source

Magnitude(double, double)

Calculates the magnitude of the coordinates from the specified coordinates.

Declaration
public readonly double Magnitude(double fromX, double fromY)
Parameters
Type Name Description
double fromX

X coordinate of the origin.

double fromY

Y coordinate of the origin.

Returns
Type Description
double

The resulting magnitude between the point and the specified coordinates.

| Edit this page View Source

Magnitude(Point)

Calculates the magnitude of the coordinates from the specified point.

Declaration
public readonly double Magnitude(Point fromPoint)
Parameters
Type Name Description
Point fromPoint

Reference point for calculating the magnitude.

Returns
Type Description
double

The resulting magnitude between both points.

| Edit this page View Source

Parse(string)

Creates a Point from a string.

Declaration
public static Point Parse(string value)
Parameters
Type Name Description
string value

The value from which to create a Point.

Returns
Type Description
Point

The created Point.

Exceptions
Type Condition
FormatException

Thrown if the conversion fails.

| Edit this page View Source

ToString()

Converts this object to its string representation.

Declaration
public override readonly string ToString()
Returns
Type Description
string

A string representation of this object.

Overrides
ValueType.ToString()
| Edit this page View Source

ToString(string?)

Converts this object to its string representation.

Declaration
public readonly string ToString(string? format)
Parameters
Type Name Description
string format

Format to use.

Returns
Type Description
string

A string representation of this object.

| Edit this page View Source

ToString(string?, IFormatProvider?)

Converts this object to its string representation.

Declaration
public readonly string ToString(string? format, IFormatProvider? formatProvider)
Parameters
Type Name Description
string format

Format to use.

IFormatProvider formatProvider

Optional parameter. Culture-specific format provider to use for formatting this object's string representation. If omitted, CurrentCulture will be used.

Returns
Type Description
string

A string representation of this object.

| Edit this page View Source

TryParse(string, out Point)

Attempts to create a Point from a string.

Declaration
public static bool TryParse(string value, out Point point)
Parameters
Type Name Description
string value

The value from which to create a Point.

Point point

The created Point.

Returns
Type Description
bool

true if the conversion was successful, false otherwise.

| Edit this page View Source

WithinBox(in double, in double, in double, in double)

Determines if the point is within the rectangle defined by the specified coordinates.

Declaration
public readonly bool WithinBox(in double x1, in double y1, in double x2, in double y2)
Parameters
Type Name Description
double x1

The first X coordinate.

double y1

The first Y coordinate.

double x2

The second X coordinate.

double y2

The second Y coordinate.

Returns
Type Description
bool

true if the point is within the rectangle; false otherwise.

| Edit this page View Source

WithinBox(in Point, in Point)

Determines if the point is within the rectangle formed by the specified points.

Declaration
public readonly bool WithinBox(in Point p1, in Point p2)
Parameters
Type Name Description
Point p1

Point 1.

Point p2

Point 2.

Returns
Type Description
bool

true if the point is within the rectangle; false otherwise.

| Edit this page View Source

WithinBox(in Range<double>, in Range<double>)

Determines if the point is within the rectangle defined by the specified ranges.

Declaration
public readonly bool WithinBox(in Range<double> x, in Range<double> y)
Parameters
Type Name Description
Range<double> x

Range of values for the X axis.

Range<double> y

Range of values for the Y axis.

Returns
Type Description
bool

true if the point is within the rectangle; false otherwise.

| Edit this page View Source

WithinBox(in Size)

Determines if the point is within the rectangle defined by the specified size.

Declaration
public readonly bool WithinBox(in Size size)
Parameters
Type Name Description
Size size

Size of the rectangle.

Returns
Type Description
bool

true if the point is within the rectangle; false otherwise.

| Edit this page View Source

WithinBox(in Size, in Point)

Determines if the point is within the rectangle defined by the specified coordinates.

Declaration
public readonly bool WithinBox(in Size size, in Point topLeft)
Parameters
Type Name Description
Size size

Size of the rectangle.

Point topLeft

Coordinates of the top-left corner.

Returns
Type Description
bool

true if the point is within the rectangle; false otherwise.

| Edit this page View Source

WithinCircle(in Point, in double)

Determines if the point is within the specified circle.

Declaration
public readonly bool WithinCircle(in Point center, in double radius)
Parameters
Type Name Description
Point center

Center point of the circle.

double radius

Radius of the circle.

Returns
Type Description
bool

true if the point is within the circle; false otherwise.

Operators

| Edit this page View Source

operator +(Point, double)

Performs addition on a point.

Declaration
public static Point operator +(Point l, double r)
Parameters
Type Name Description
Point l

Point 1.

double r

Addition operand.

Returns
Type Description
Point

A new Point whose vectors are the sum of the original vectors + r.

| Edit this page View Source

operator +(Point, IVector)

Performs addition on points.

Declaration
public static Point operator +(Point l, IVector r)
Parameters
Type Name Description
Point l

Point 1.

IVector r

Point 2.

Returns
Type Description
Point

The sum of the vectors of the points.

| Edit this page View Source

operator +(Point, Point)

Performs addition on points.

Declaration
public static Point operator +(Point l, Point r)
Parameters
Type Name Description
Point l

Point 1.

Point r

Point 2.

Returns
Type Description
Point

The sum of the vectors of the points.

| Edit this page View Source

operator --(Point)

Decrements the point's vectors by 1.

Declaration
public static Point operator --(Point p)
Parameters
Type Name Description
Point p

Point to decrement.

Returns
Type Description
Point

A point with its vectors decremented by 1.

| Edit this page View Source

operator /(Point, double)

Performs scalar division on the point.

Declaration
public static Point operator /(Point l, double r)
Parameters
Type Name Description
Point l

Point 1.

double r

Division operand.

Returns
Type Description
Point

A new Point with vectors being the quotient of original vectors / r.

| Edit this page View Source

operator /(Point, IVector)

Performs division operation on points.

Declaration
public static Point operator /(Point l, IVector r)
Parameters
Type Name Description
Point l

Point 1.

IVector r

Vector operand.

Returns
Type Description
Point

The quotient of the vectors of the point and vector.

| Edit this page View Source

operator /(Point, Point)

Performs division operation on points.

Declaration
public static Point operator /(Point l, Point r)
Parameters
Type Name Description
Point l

Point 1.

Point r

Point 2.

Returns
Type Description
Point

The quotient of the vectors of the points.

| Edit this page View Source

operator ==(Point, IVector)

Compares the equality of the point vectors with a 2D vector.

Declaration
public static bool operator ==(Point l, IVector r)
Parameters
Type Name Description
Point l

Point to compare.

IVector r

2D vector to compare against.

Returns
Type Description
bool

true if all vectors of both points are equal; otherwise, false.

| Edit this page View Source

operator ==(Point, Point)

Compares the equality of the point vectors.

Declaration
public static bool operator ==(Point l, Point r)
Parameters
Type Name Description
Point l

Object to compare.

Point r

Object to compare against.

Returns
Type Description
bool

true if both instances are equal, false otherwise.

| Edit this page View Source

implicit operator Point(Point)

Converts a Point to a Point.

Declaration
public static implicit operator Point(Point x)
Parameters
Type Name Description
Point x

The Point to convert.

Returns
Type Description
Point

A Point equivalent to the specified Point.

| Edit this page View Source

implicit operator Point(Vector2)

Implicitly converts a Vector2 to a Point.

Declaration
public static implicit operator Point(Vector2 p)
Parameters
Type Name Description
Vector2 p

Vector2 value to be converted.

Returns
Type Description
Point
| Edit this page View Source

implicit operator Point(Point)

Converts a Point to a Point.

Declaration
public static implicit operator Point(Point x)
Parameters
Type Name Description
Point x

The Point to convert.

Returns
Type Description
Point

A Point equivalent to the specified Point.

| Edit this page View Source

implicit operator Vector2(Point)

Implicitly converts a Point to a Vector2.

Declaration
public static implicit operator Vector2(Point p)
Parameters
Type Name Description
Point p

Point value to be converted.

Returns
Type Description
Vector2
| Edit this page View Source

operator ++(Point)

Increments the point's vectors by 1.

Declaration
public static Point operator ++(Point p)
Parameters
Type Name Description
Point p

Point to increment.

Returns
Type Description
Point

A point with its vectors incremented by 1.

| Edit this page View Source

operator !=(Point, IVector)

Compares the difference of the point vectors with a 2D vector.

Declaration
public static bool operator !=(Point l, IVector r)
Parameters
Type Name Description
Point l

Point to compare.

IVector r

2D vector to compare against.

Returns
Type Description
bool

true if the vectors of both points are different; otherwise, false.

| Edit this page View Source

operator !=(Point, Point)

Compares the difference of the point vectors.

Declaration
public static bool operator !=(Point l, Point r)
Parameters
Type Name Description
Point l

Point 1.

Point r

Point 2.

Returns
Type Description
bool

true if the vectors of both points are different; otherwise, false.

| Edit this page View Source

operator %(Point, double)

Performs a modulus operation on the point.

Declaration
public static Point operator %(Point l, double r)
Parameters
Type Name Description
Point l

Point 1.

double r

Modulus operand.

Returns
Type Description
Point

A new Point whose vectors are the modulus of the original vectors % r.

| Edit this page View Source

operator %(Point, IVector)

Performs modulus operation on points.

Declaration
public static Point operator %(Point l, IVector r)
Parameters
Type Name Description
Point l

Point 1.

IVector r

Vector operand.

Returns
Type Description
Point

The modulus of the vectors of the point and vector.

| Edit this page View Source

operator %(Point, Point)

Performs modulus operation on points.

Declaration
public static Point operator %(Point l, Point r)
Parameters
Type Name Description
Point l

Point 1.

Point r

Point 2.

Returns
Type Description
Point

The modulus of the vectors of the points.

| Edit this page View Source

operator *(Point, double)

Performs scalar multiplication on the point.

Declaration
public static Point operator *(Point l, double r)
Parameters
Type Name Description
Point l

Point 1.

double r

Multiplication operand.

Returns
Type Description
Point

A new Point with vectors being the product of original vectors * r.

| Edit this page View Source

operator *(Point, IVector)

Performs multiplication operation on points.

Declaration
public static Point operator *(Point l, IVector r)
Parameters
Type Name Description
Point l

Point 1.

IVector r

Vector operand.

Returns
Type Description
Point

The product of the vectors of the point and vector.

| Edit this page View Source

operator *(Point, Point)

Performs multiplication operation on points.

Declaration
public static Point operator *(Point l, Point r)
Parameters
Type Name Description
Point l

Point 1.

Point r

Point 2.

Returns
Type Description
Point

The product of the vectors of the points.

| Edit this page View Source

operator -(Point, double)

Performs subtraction operation on the point.

Declaration
public static Point operator -(Point l, double r)
Parameters
Type Name Description
Point l

Point 1.

double r

Subtraction operand.

Returns
Type Description
Point

A new Point with vectors being the difference of original vectors - r.

| Edit this page View Source

operator -(Point, IVector)

Performs subtraction on points.

Declaration
public static Point operator -(Point l, IVector r)
Parameters
Type Name Description
Point l

Point 1.

IVector r

Point 2.

Returns
Type Description
Point

The difference of the vectors of the points.

| Edit this page View Source

operator -(Point, Point)

Performs subtraction on points.

Declaration
public static Point operator -(Point l, Point r)
Parameters
Type Name Description
Point l

Point 1.

Point r

Point 2.

Returns
Type Description
Point

The difference of the vectors of the points.

| Edit this page View Source

operator -(Point)

Inverts the sign of the point's vectors.

Declaration
public static Point operator -(Point p)
Parameters
Type Name Description
Point p

Point to operate on.

Returns
Type Description
Point

A point with inverted vector signs.

| Edit this page View Source

operator +(Point)

Converts the point's vectors to positive values.

Declaration
public static Point operator +(Point p)
Parameters
Type Name Description
Point p

Point to operate on.

Returns
Type Description
Point

A point with positive vectors.

Implements

IVector
IEquatable<T>
IEquatable<T>
IFormattable
IEquatable<T>

Extension Methods

Objects.ShallowCopyTo(object, object, Type)
ObjectExtensions.FieldsOf<T>(object)
ObjectExtensions.GetAttribute<T>(object)
ObjectExtensions.GetAttributes<T>(object)
ObjectExtensions.HasAttrValue<TAttribute, TValue>(object, out TValue)
ObjectExtensions.HasAttribute<T>(object)
ObjectExtensions.HasAttribute<T>(object, out T?)
ObjectExtensions.HasAttributes<T>(object, out IEnumerable<T>?)
ObjectExtensions.Is(object?, object?)
ObjectExtensions.IsEither(object, IEnumerable)
ObjectExtensions.IsEither(object, params object[])
ObjectExtensions.IsNeither(object, IEnumerable)
ObjectExtensions.IsNeither(object, params object[])
ObjectExtensions.IsNot(object?, object?)
ObjectExtensions.PropertiesOf<T>(object)
ObjectExtensions.WhichAre(object, IEnumerable<object>)
ObjectExtensions.WhichAre(object, params object[])
Objects.Itself<T>(T)
Objects.ShallowClone<T>(T)
Objects.ShallowCopyTo<T>(T, T)
CollectionExtensions.PushInto<TItem, TCollection>(TItem, ICollection<TCollection>)
DictionaryExtensions.PushInto<TKey, TValue>(TValue, TKey, IDictionary<TKey, TValue>)
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX