Show / Hide Table of Contents

Class PointExtensions

Contains set of operators that match ones defined by other packages for interoperability, so syntax may be uniform. Functionality is similar to the corresponding actual operators for Point.

Inheritance
object
PointExtensions
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: SadRogue.Primitives
Assembly: TheSadRogue.Primitives.dll
Syntax
public static class PointExtensions

Methods

View Source

Add(Point, Direction)

Translates the current position by one unit in the given direction.

Declaration
public static Point Add(this Point self, Direction dir)
Parameters
Type Name Description
Point self
Direction dir
Returns
Type Description
Point

Position (self.X + dir.DeltaX, self.Y + dir.DeltaY)

View Source

Add(Point, Point)

Adds the given Point's x/y values to the current Point's x/y values.

Declaration
public static Point Add(this Point self, Point other)
Parameters
Type Name Description
Point self
Point other
Returns
Type Description
Point

Position (self.X + other.X, self.Y + other.Y).

View Source

Add(Point, int)

Adds the given scalar to the current Point's x/y values.

Declaration
public static Point Add(this Point self, int i)
Parameters
Type Name Description
Point self
int i
Returns
Type Description
Point

Position (self.X + i, self.Y + i).

View Source

Divide(Point, Point)

Divides the current Point's x/y values by the given Point's x/y values, rounding to the nearest integer.

Declaration
public static Point Divide(this Point self, Point other)
Parameters
Type Name Description
Point self
Point other
Returns
Type Description
Point

Position (self.X / other.X, self.Y / other.Y), with each value rounded to the nearest integer.

View Source

Divide(Point, double)

Divides the current Point's x/y values by the given scalar, rounding to the nearest integer.

Declaration
public static Point Divide(this Point self, double d)
Parameters
Type Name Description
Point self
double d
Returns
Type Description
Point

Position(self.X / d, self.Y / d), with each value rounded to the nearest integer.

View Source

Divide(Point, int)

Divides the current Point's x/y values by the given scalar, rounding to the nearest integer.

Declaration
public static Point Divide(this Point self, int i)
Parameters
Type Name Description
Point self
int i
Returns
Type Description
Point

Position(self.X / i, self.Y / i), with each value rounded to the nearest integer.

View Source

Matches(Point, Point)

Compares the two points for equality; equivalent to Matches(Point).

Declaration
public static bool Matches(this Point self, Point other)
Parameters
Type Name Description
Point self
Point other
Returns
Type Description
bool

True if the two points are equal; false otherwise.

View Source

Multiply(Point, Point)

Multiplies the current Point's x/y values by the given Point's x/y values.

Declaration
public static Point Multiply(this Point self, Point other)
Parameters
Type Name Description
Point self
Point other
Returns
Type Description
Point

Position (self.X * other.X, self.Y * other.Y).

View Source

Multiply(Point, double)

Multiplies the current Point's x/y values by the given scalar, rounding to the nearest integer.

Declaration
public static Point Multiply(this Point self, double d)
Parameters
Type Name Description
Point self
double d
Returns
Type Description
Point

Position (self.X * d, self.Y * d), with each value rounded to the nearest integer.

View Source

Multiply(Point, int)

Multiplies the current Point's x/y values by the given scalar.

Declaration
public static Point Multiply(this Point self, int i)
Parameters
Type Name Description
Point self
int i
Returns
Type Description
Point

Position (self.X * i, self.Y * i).

View Source

Subtract(Point, Direction)

Translates the current position by one unit in the opposite of the given direction.

Declaration
public static Point Subtract(this Point self, Direction dir)
Parameters
Type Name Description
Point self
Direction dir
Returns
Type Description
Point

Position (self.X - dir.DeltaX, self.Y - dir.DeltaY)

View Source

Subtract(Point, Point)

Subtracts the given Point's x/y values from the current Point's x/y values.

Declaration
public static Point Subtract(this Point self, Point other)
Parameters
Type Name Description
Point self
Point other
Returns
Type Description
Point

Position (self.X - other.X, self.Y - other.Y).

View Source

Subtract(Point, int)

Subtracts the given scalar from the current Point's x/y values.

Declaration
public static Point Subtract(this Point self, int i)
Parameters
Type Name Description
Point self
int i
Returns
Type Description
Point

Position (self.X - i, self.Y - i).

  • View Source
In this article
Back to top Generated by DocFX