RogueSharp
Show / Hide Table of Contents

Struct Point

A struct that defines a point in 2D space

Implements
System.IEquatable<Point>
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: RogueSharp
Assembly: RogueSharp.dll
Syntax
public struct Point : IEquatable<Point>

Constructors

| Improve this Doc View Source

Point(Int32)

Constructs a point with X and Y set to the same value.

Declaration
public Point(int value)
Parameters
Type Name Description
System.Int32 value

The x and y coordinates in 2d-space.

| Improve this Doc View Source

Point(Int32, Int32)

Constructs a point with X and Y from two values.

Declaration
public Point(int x, int y)
Parameters
Type Name Description
System.Int32 x

The x coordinate in 2d-space.

System.Int32 y

The y coordinate in 2d-space.

Properties

| Improve this Doc View Source

X

The x coordinate of this Point.

Declaration
public int X { get; set; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

Y

The y coordinate of this Point.

Declaration
public int Y { get; set; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

Zero

Returns the point (0,0)

Declaration
public static Point Zero { get; }
Property Value
Type Description
Point

Methods

| Improve this Doc View Source

Add(Point, Point)

Adds two points.

Declaration
public static Point Add(Point value1, Point value2)
Parameters
Type Name Description
Point value1

Source Point on the left of the add sign.

Point value2

Source Point on the right of the add sign.

Returns
Type Description
Point

Sum of the points.

| Improve this Doc View Source

Distance(Point, Point)

Calculates the distance between two points.

Declaration
public static float Distance(Point value1, Point value2)
Parameters
Type Name Description
Point value1

Source vector.

Point value2

Source vector.

Returns
Type Description
System.Single

The distance between two points.

| Improve this Doc View Source

Divide(Point, Point)

Divides the components of a Point by the components of another Point.

Declaration
public static Point Divide(Point source, Point divisor)
Parameters
Type Name Description
Point source

Source Point on the left of the div sign.

Point divisor

Divisor Point on the right of the div sign.

Returns
Type Description
Point

The result of dividing the points.

| Improve this Doc View Source

Equals(Point)

Compares whether current instance is equal to specified Point.

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

The Point to compare.

Returns
Type Description
System.Boolean

true if the instances are equal; false otherwise.

| Improve this Doc View Source

Equals(Object)

Compares whether current instance is equal to specified System.Object.

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj

The System.Object to compare.

Returns
Type Description
System.Boolean

true if the instances are equal; false otherwise.

Overrides
System.ValueType.Equals(System.Object)
| Improve this Doc View Source

GetHashCode()

Gets the hash code of this Point.

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32

Hash code of this Point.

Overrides
System.ValueType.GetHashCode()
| Improve this Doc View Source

Multiply(Point, Point)

Multiplies the components of two points by each other.

Declaration
public static Point Multiply(Point value1, Point value2)
Parameters
Type Name Description
Point value1

Source Point on the left of the mul sign.

Point value2

Source Point on the right of the mul sign.

Returns
Type Description
Point

Result of the multiplication.

| Improve this Doc View Source

Negate(Point)

Creates a new Point that contains the specified vector inversion.

Declaration
public static Point Negate(Point value)
Parameters
Type Name Description
Point value

Source Point.

Returns
Type Description
Point

The result of the vector inversion.

| Improve this Doc View Source

Subtract(Point, Point)

Subtracts a Point from a Point.

Declaration
public static Point Subtract(Point value1, Point value2)
Parameters
Type Name Description
Point value1

Source Point on the left of the sub sign.

Point value2

Source Point on the right of the sub sign.

Returns
Type Description
Point

Result of the subtraction.

| Improve this Doc View Source

ToString()

Returns a System.String representation of this Point in the format: {X:[X] Y:[Y]}

Declaration
public override string ToString()
Returns
Type Description
System.String

System.String representation of this Point.

Overrides
System.ValueType.ToString()

Operators

| Improve this Doc View Source

Addition(Point, Point)

Adds two points.

Declaration
public static Point operator +(Point value1, Point value2)
Parameters
Type Name Description
Point value1

Source Point on the left of the add sign.

Point value2

Source Point on the right of the add sign.

Returns
Type Description
Point

Sum of the points.

| Improve this Doc View Source

Division(Point, Point)

Divides the components of a Point by the components of another Point.

Declaration
public static Point operator /(Point source, Point divisor)
Parameters
Type Name Description
Point source

Source Point on the left of the div sign.

Point divisor

Divisor Point on the right of the div sign.

Returns
Type Description
Point

The result of dividing the points.

| Improve this Doc View Source

Equality(Point, Point)

Compares whether two Point instances are equal.

Declaration
public static bool operator ==(Point a, Point b)
Parameters
Type Name Description
Point a

Point instance on the left of the equal sign.

Point b

Point instance on the right of the equal sign.

Returns
Type Description
System.Boolean

true if the instances are equal; false otherwise.

| Improve this Doc View Source

Inequality(Point, Point)

Compares whether two Point instances are not equal.

Declaration
public static bool operator !=(Point a, Point b)
Parameters
Type Name Description
Point a

Point instance on the left of the not equal sign.

Point b

Point instance on the right of the not equal sign.

Returns
Type Description
System.Boolean

true if the instances are not equal; false otherwise.

| Improve this Doc View Source

Multiply(Point, Point)

Multiplies the components of two points by each other.

Declaration
public static Point operator *(Point value1, Point value2)
Parameters
Type Name Description
Point value1

Source Point on the left of the mul sign.

Point value2

Source Point on the right of the mul sign.

Returns
Type Description
Point

Result of the multiplication.

| Improve this Doc View Source

Subtraction(Point, Point)

Subtracts a Point from a Point.

Declaration
public static Point operator -(Point value1, Point value2)
Parameters
Type Name Description
Point value1

Source Point on the left of the sub sign.

Point value2

Source Point on the right of the sub sign.

Returns
Type Description
Point

Result of the subtraction.

Implements

System.IEquatable<T>
  • Improve this Doc
  • View Source
RogueSharp © 2014-2020 Faron Bracy
Back to top