Struct Point
Represents a point in a 2D coordinate system.
Namespace: Evergine.Mathematics
Assembly: Evergine.Mathematics.dll
Syntax
public struct 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)
Indicates whether the current object is equal to another object of the same type.
Declaration
public bool Equals(Point other)
Parameters
Type | Name | Description |
---|---|---|
Point | other | An object to compare with this object. |
Returns
Type | Description |
---|---|
bool | true if the current object is equal to the |
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)
Indicates whether this instance and a specified object are equal.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to compare with the current instance. |
Returns
Type | Description |
---|---|
bool | true if |
Overrides
GetHashCode()
Returns the hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A 32-bit signed integer that is the hash code for this instance. |
Overrides
ToString()
Returns the fully qualified type name of this instance.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | The fully qualified type name. |
Overrides
ToVector2()
Gets a Vector2 representation of this object.
Declaration
public Vector2 ToVector2()
Returns
Type | Description |
---|---|
Vector2 | A Vector2 representation of 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 side of the equal sign. |
Point | b | Point instance on the right side 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 multiplication sign. |
Point | value2 | Source Point on the right of the multiplication sign. |
Returns
Type | Description |
---|---|
Point | Result of the multiplication. |
operator *(Point, int)
Multiplies the components of a 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 multiplication sign. |
int | scaleFactor | Scalar value on the right of the multiplication sign. |
Returns
Type | Description |
---|---|
Point | Result of the multiplication. |
operator *(int, Point)
Multiplies the components of a 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 multiplication sign. |
Point | value | Source Point on the left of the multiplication 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 subtraction sign. |
Point | value2 | Source Point on the right of the subtraction 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 side of the subtraction sign. |
Returns
Type | Description |
---|---|
Point | Result of the inversion. |