Struct Point
A struct that defines a point in 2D space
Implements
Inherited Members
Namespace: RogueSharp
Assembly: RogueSharp.dll
Syntax
public struct Point : IEquatable<Point>
Constructors
| Improve this Doc View SourcePoint(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. |
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 SourceX
The x coordinate of this Point.
Declaration
public int X { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Y
The y coordinate of this Point.
Declaration
public int Y { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Zero
Returns the point (0,0)
Declaration
public static Point Zero { get; }
Property Value
Type | Description |
---|---|
Point |
Methods
| Improve this Doc View SourceAdd(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. |
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. |
Divide(Point, 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. |
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 |
|
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 |
|
Overrides
GetHashCode()
Gets the hash code of this Point.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | Hash code of this Point. |
Overrides
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. |
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. |
Subtract(Point, 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. |
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | System.String representation of this Point. |
Overrides
Operators
| Improve this Doc View SourceAddition(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. |
Division(Point, 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. |
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 |
|
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 |
|
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. |
Subtraction(Point, 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. |