Struct GridPoint3
A discrete 3D vector, used to index into 3D grids.
public readonly struct GridPoint3 : IEquatable<GridPoint3>
- Implements
- Inherited Members
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.
<xref href="Gamelogic.Grids2.GridPoint3" data-throw-if-not-resolved="false"></xref> was introduced before Unity's <xref href="UnityEngine.Vector3Int" data-throw-if-not-resolved="false"></xref>, and serve the same purpose. The
types are implicitly convertible.
Constructors
- GridPoint3(int, int, int)
Constructs a new instance of GridPoint3 with the given coordinates.
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.
- Z
The Z coordinate of this point.
Methods
- Add(GridPoint3)
Adds an other grid point to this grid point and returns the result.
- CrossProduct(GridPoint3)
Calculates the cross product of this vector with another.
- Div(GridPoint3)
Gives a new point that represents the first point divided by the second point component-wise.The division is integer division.
- Dot(GridPoint3)
Calculates the dot product between this grid point and another.
- FloorDiv(GridPoint3)
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(GridPoint3)
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.
- GetColor(int, int, int, int, int, int)
Gets the color index for this point for the given color function.
- GetForwardVectorRays(IEnumerable<GridPoint3>)
Gets the maps that represent the forward vector rays through this point in the given list of directions.
- GetReverseVectorRays(IEnumerable<GridPoint3>)
Gets the maps that represent the reverse vector lines through this point in the given list of directions.
- GetVectorLine(GridPoint3)
Gets the map that represents a line through this point in the given direction.
- GetVectorLines(IEnumerable<GridPoint3>)
Gets the maps that represent the vector lines through this point in the given list of directions.
- GetVectorNeighbors(IEnumerable<GridPoint3>)
Gets the vector neighbors of this point in the given direction.
- Max(GridPoint3, GridPoint3)
Calculates a new grid point with coordinates the maximum of the respective coordinates of two grid points.
- Min(GridPoint3, GridPoint3)
Calculates a new grid point with coordinates the minimum of the respective coordinates of two grid points.
- Mod(GridPoint3)
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(GridPoint3)
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.
- Subtract(GridPoint3)
Subtracts the other point from this point, and returns the result.
- TO2DXZ()
Convert this point to GridPoint2, keeping the x and z coordinates.
- To2DXY()
Convert this point to GridPoint2, keeping the x and y coordinates.
- ToVector3()
Converts a grid point to a Vector3 with the same coordinates (as floats).
- TruncDiv(GridPoint3)
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(GridPoint3)
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.
- __GetColor_Reference(int, int, int, int, int, int)
Gets the color index for this point for the given color function.
Operators
- operator +(GridPoint3, GridPoint3)
Adds two points by adding their corresponding coordinates.
- operator /(GridPoint3, GridPoint3)
Divides corresponding coordinates using integer division.
- operator /(GridPoint3, int)
Divides each coordinate by the integer using integer division.
- operator ==(GridPoint3, GridPoint3)
Compares two points for equality.
- explicit operator GridPoint3(Vector3)
Converts a Vector2 to a GridPoint2 by casting components to integers.
- implicit operator Vector3(GridPoint3)
Converts a grid point to a Vector3 with the same coordinates (as floats).
- implicit operator Vector3Int(GridPoint3)
Converts this grid point to a Vector2Int.
- implicit operator GridPoint3(Vector3Int)
Converts a Vector3Int to a GridPoint3.
- operator !=(GridPoint3, GridPoint3)
Checks whether two points are not equal.
- operator %(GridPoint3, GridPoint3)
Divides corresponding coordinates using integer division and return the remainders as a new grid point.
- operator *(GridPoint3, GridPoint3)
Multiplies corresponding coordinates.
- operator *(GridPoint3, int)
Multiplies corresponding coordinates.
- operator *(int, GridPoint3)
Multiplies each coordinate with the integer.
- operator -(GridPoint3, GridPoint3)
Subtracts one point from another by subtracting corresponding coordinates.
- operator -(GridPoint3)
Negates the given vector.
- operator +(GridPoint3)
This operations does not affect the point.