Struct Point
Represents a point in a 2D coordinate system.
Implements
Inherited Members
Namespace: Evergine.Mathematics
Assembly: Evergine.Mathematics.dll
Syntax
public struct Point : IEquatable<Point>
Constructors
Point(int)
Initializes a new instance of the Point struct.
Declaration
public Point(int value)
Parameters
Type | Name | Description |
---|---|---|
int | value | The value used for both coordinates of the point. |
Point(int, int)
Initializes a new instance of the Point struct.
Declaration
public Point(int x, int y)
Parameters
Type | Name | Description |
---|---|---|
int | x | The x coordinate of the point. |
int | y | The y coordinate of the point. |
Fields
X
The x coordinate of this Point.
Declaration
public int X
Field Value
Type | Description |
---|---|
int |
Y
The y coordinate of this Point.
Declaration
public int Y
Field Value
Type | Description |
---|---|
int |
Properties
One
Gets a Point with components 1, 1.
Declaration
public static Point One { get; }
Property Value
Type | Description |
---|---|
Point |
UnitX
Gets a Point with components 1, 0.
Declaration
public static Point UnitX { get; }
Property Value
Type | Description |
---|---|
Point |
UnitY
Gets a Point with components 0, 1.
Declaration
public static Point UnitY { get; }
Property Value
Type | Description |
---|---|
Point |
Zero
Gets a Point with components 0, 0.
Declaration
public static Point Zero { get; }
Property Value
Type | Description |
---|---|
Point |
Methods
Equals(Point)
Declaration
public bool Equals(Point other)
Parameters
Type | Name | Description |
---|---|---|
Point | other |
Returns
Type | Description |
---|---|
bool |
Equals(ref Point)
Indicates whether this instance and a specified Point are equal.
Declaration
public bool Equals(ref Point other)
Parameters
Type | Name | Description |
---|---|---|
Point | other | The point to compare with the current instance. |
Returns
Type | Description |
---|---|
bool |
|
Equals(object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj |
Returns
Type | Description |
---|---|
bool |
Overrides
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int |
Overrides
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string |
Overrides
ToVector2()
Gets a Vector2 representation for this object.
Declaration
public Vector2 ToVector2()
Returns
Type | Description |
---|---|
Vector2 | A Vector2 representation for this object. |
Operators
operator +(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. |
operator ==(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 |
---|---|
bool |
|
operator !=(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 |
---|---|
bool |
|
operator *(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. |
operator *(Point, int)
Multiplies the components of point by a number.
Declaration
public static Point operator *(Point value, int scaleFactor)
Parameters
Type | Name | Description |
---|---|---|
Point | value | Source Point on the left of the mul sign. |
int | scaleFactor | Scalar value on the right of the mul sign. |
Returns
Type | Description |
---|---|
Point | Result of the multiplication. |
operator *(int, Point)
Multiplies the components of point by a number.
Declaration
public static Point operator *(int scaleFactor, Point value)
Parameters
Type | Name | Description |
---|---|---|
int | scaleFactor | Scalar value on the right of the mul sign. |
Point | value | Source Point on the left of the mul sign. |
Returns
Type | Description |
---|---|
Point | Result of the multiplication. |
operator -(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. |
operator -(Point)
Inverts values in the specified Point.
Declaration
public static Point operator -(Point value)
Parameters
Type | Name | Description |
---|---|---|
Point | value | Source Point on the right of the sub sign. |
Returns
Type | Description |
---|---|
Point | Result of the inversion. |