Ritchie's Abstractions 0.2
Platform abstractions that make Toolbox work
Loading...
Searching...
No Matches
Point Struct Reference

Structure representing a point in 2D space, usually expressed as pixel values. More...

Inheritance diagram for Point:

Public Member Functions

 Point (int x, int y)
 Creates a new Point value with the specified coordinates.
 
override bool Equals ([NotNullWhen(true)] object? obj)
 
override int GetHashCode ()
 
override string ToString ()
 
bool Equals (Point other)
 

Static Public Member Functions

static Point operator- (Point positive)
 Negate a point.
 
static bool operator> (Point a, Point b)
 Compare two points to see if one is greater than the other.
 
static bool operator< (Point a, Point b)
 Compare two points to see if one is less than the other.
 
static bool operator>= (Point a, Point b)
 Compare two points to see if one is greater than or equal to the other.
 
static bool operator<= (Point a, Point b)
 Compare two points to see if one is less than or equal the other.
 
static Point operator* (Point left, int right)
 Multiply a point by the given value.
 
static Point operator/ (Point left, int right)
 Divide one point by the given value.
 
static implicit operator Vector2 (Point point)
 Implicit conversion from a Point to a Vector2.
 
static implicit operator Point (Vector2 vector)
 Implicit conversion from a Vector2 to a Point. Floating-point values are truncated.
 
static bool operator== (Point a, Point b)
 Checks if two Point values are equal.
 
static bool operator!= (Point a, Point b)
 Checks if two Point values are not equal.
 
static Point operator+ (Point a, Point b)
 Add two Point values together.
 
static Point operator- (Point a, Point b)
 Subtract one point from another.
 
static Point operator* (Point a, Point b)
 Multiply two points together.
 
static Point operator/ (Point a, Point b)
 Divide one point by another.
 

Public Attributes

int X
 The horizontal component of this point.
 
int Y
 The vertical component of this point.
 

Static Public Attributes

static readonly Point Zero = new Point(0, 0)
 A Point value representing zero.
 

Properties

float Length [get]
 Gets the magnitude of the vector represented by this Point.
 

Detailed Description

Structure representing a point in 2D space, usually expressed as pixel values.

Constructor & Destructor Documentation

◆ Point()

Point ( int x,
int y )
inline

Creates a new Point value with the specified coordinates.

Parameters
xThe horizontal coordinate of the point
yThe vertical component of the point

Member Function Documentation

◆ operator Point()

static implicit operator Point ( Vector2 vector)
inlinestatic

Implicit conversion from a Vector2 to a Point. Floating-point values are truncated.

Parameters
vectorThe Vector2 to convert.
Returns
A Point representing the same coordinates.

◆ operator Vector2()

static implicit operator Vector2 ( Point point)
inlinestatic

Implicit conversion from a Point to a Vector2.

Parameters
pointThe Point to convert.
Returns
A Vector2 representing the same coordinates.

◆ operator!=()

static bool operator!= ( Point a,
Point b )
inlinestatic

Checks if two Point values are not equal.

Parameters
aLeft side of the operation
bRight side of the operation
Returns
False if equal, true otherwise

◆ operator*() [1/2]

static Point operator* ( Point a,
Point b )
inlinestatic

Multiply two points together.

Parameters
aLeft side of the operation
bRight side of the operation
Returns
A value representing the result of the multiplication.

◆ operator*() [2/2]

static Point operator* ( Point left,
int right )
inlinestatic

Multiply a point by the given value.

Parameters
leftLeft side of the operation
rightRight side of the operation
Returns
A value representing the result of the multiplication.

◆ operator+()

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

Add two Point values together.

Parameters
aLeft side of the operation
bRight side of the operation
Returns
The result of the addition.

◆ operator-() [1/2]

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

Subtract one point from another.

Parameters
aLeft side of the operation
bRight side of the operation
Returns
The result of the subtraction.

◆ operator-() [2/2]

static Point operator- ( Point positive)
inlinestatic

Negate a point.

Parameters
positiveThe point value to negate
Returns
A point representing the negative of the given point

◆ operator/() [1/2]

static Point operator/ ( Point a,
Point b )
inlinestatic

Divide one point by another.

Parameters
aLeft side of the operation
bRight side of the operation
Returns
A value representing the result of the division.

◆ operator/() [2/2]

static Point operator/ ( Point left,
int right )
inlinestatic

Divide one point by the given value.

Parameters
leftLeft side of the operation
rightRight side of the operation
Returns
A value representing the result of the division.

◆ operator<()

static bool operator< ( Point a,
Point b )
inlinestatic

Compare two points to see if one is less than the other.

Parameters
aLeft side of the operation
bRight side of the operation
Returns
True if a is less than b.

◆ operator<=()

static bool operator<= ( Point a,
Point b )
inlinestatic

Compare two points to see if one is less than or equal the other.

Parameters
aLeft side of the operation
bRight side of the operation
Returns
True if a is less than or equal to b.

◆ operator==()

static bool operator== ( Point a,
Point b )
inlinestatic

Checks if two Point values are equal.

Parameters
aLeft side of the operation
bRight side of the operation
Returns
True if equal, false otherwise

◆ operator>()

static bool operator> ( Point a,
Point b )
inlinestatic

Compare two points to see if one is greater than the other.

Parameters
aLeft side of the operation
bRight side of the operation
Returns
True if a is greater than b.

◆ operator>=()

static bool operator>= ( Point a,
Point b )
inlinestatic

Compare two points to see if one is greater than or equal to the other.

Parameters
aLeft side of the operation
bRight side of the operation
Returns
True if a is greater than or equal to b.

The documentation for this struct was generated from the following file: