Table of Contents

Struct GridPoint2

Namespace
Gamelogic.Grids2
Assembly
Assembly-CSharp.dll

A discrete 2D vector, used to index into 2D grids.

public readonly struct GridPoint2 : IEquatable<GridPoint2>
Implements
Inherited Members
Extension Methods

Remarks

Grid points work like vectors, except their components are integers. Grid points can be used on their own, but they are frequently used with grids and shapes.

Constructors

GridPoint2(int, int)

Creates a new instance of the GridPoint2 struct.

Fields

One

The grid point with all coordinates equal to 1.

Zero

The zero grid point, also called the origin. All coordinates are 0.

Properties

X

The X coordinate of this point.

Y

The Y coordinate of this point.

Methods

Add(GridPoint2)

Adds an other grid point to this grid point and returns the result.

Div(GridPoint2)

Gives a new point that represents the first point divided by the second point component-wise.The division is integer division.

Div(int)
Dot(GridPoint2)

Calculates the dot product between this grid point and another.

Equals(GridPoint2)

Compares this grid point with another grid point for equality. Two grid points are equal if their respective coordinates are equal.

Equals(object)
FloorDiv(GridPoint2)

Gives a new point that represents the first point divided by the second point component-wise.The division is integer division.

FloorDiv(int)

Divides each coordinate with r, using integer floor division.

FloorMod(GridPoint2)

Gives a new point that represents the reminder when the first point is divided by the second point component-wise. The division is integer floor division.

GetColor(ColorFunction)

Gets the color index for this point for the given color function.

GetColor(int, int, int)

Gets the color index for this point for the given coloring parameters.

GetForwardVectorRays(IEnumerable<GridPoint2>)

Gets the maps that represent the forward vector rays through this point in the given list of directions.

GetHashCode()
GetReverseVectorRays(IEnumerable<GridPoint2>)

Gets the maps that represent the reverse vector lines through this point in the given list of directions.

GetVectorLine(GridPoint2)

Gets the map that represents a line through this point in the given direction.

GetVectorLines(IEnumerable<GridPoint2>)

Gets the maps that represent the vector lines through this point in the given list of directions.

GetVectorNeighbors(IEnumerable<GridPoint2>)

Gets the vector neighbors of this point in the given direction.

HadamardMul(GridPoint2, GridPoint2)
HexDot(GridPoint2)

Calculates the hex-grid equivalent for the dot product.

Max(GridPoint2, GridPoint2)

Calculates a new grid point with coordinates the maximum of the respective coordinates of two grid points.

Min(GridPoint2, GridPoint2)

Calculates a new grid point with coordinates the minimum of the respective coordinates of two grid points.

Mod(GridPoint2)

Gives a new point that represents the reminder when the first point is divided by the second point component-wise.The division is integer division.

Mul(GridPoint2)

Gives a new point that represents the first point multiplied by the second point component-wise.

Mul(int)

Multiplies each coordinate with the specified integer.

Negate()

Returns the point with each coordinate negated.

Perp()

Calculates the vector perpendicular to this vector (rotated counter-clockwise).

PerpDot(GridPoint2)

Calculates the perp dot product between this grid point and another.

Subtract(GridPoint2)

Subtracts the other point from this point, and returns the result.

To3DXY(int)

Converts this point to GridPoint 3.

To3DXZ(int)

Converts the point to GridPoint2.

ToString()
ToVector2()

Converts this grid point to a UnityEngine.Vector2.

TruncDiv(GridPoint2)

Gives a new point that represents the first point divided by the second point component-wise.The division is integer division.

TruncDiv(int)

Divides each coordinate with r, using integer trunc division.

TruncMod(GridPoint2)

Gives a new point that represents the reminder when the first point is divided by the second point component-wise. The division is integer trunc division.

Operators

operator +(GridPoint2, GridPoint2)

Adds two points by adding their corresponding coordinates.

operator /(GridPoint2, GridPoint2)

Divides corresponding coordinates using integer division.

operator /(GridPoint2, int)

Divides each coordinate by the integer using integer division.

operator ==(GridPoint2, GridPoint2)

Compares two points for equality.

implicit operator Vector2(GridPoint2)

Converts this grid point to a UnityEngine.Vector2.

operator !=(GridPoint2, GridPoint2)

Checks whether two points are not equal.

operator %(GridPoint2, GridPoint2)

Divides corresponding coordinates using integer division and return the remainders as a new grid point.

operator *(GridPoint2, GridPoint2)

Multiplies corresponding coordinates.

operator *(GridPoint2, int)

Multiplies each coordinate with the integer.

operator *(int, GridPoint2)

Multiplies each coordinate with the integer.

operator -(GridPoint2, GridPoint2)

Subtracts one point from another by subtracting corresponding coordinates.

operator -(GridPoint2)

Negates the given vector.

operator +(GridPoint2)

This operations does not affect the point.

See Also