Table of Contents

Struct RectPoint

Namespace
Gamelogic.Grids
Assembly
Assembly-CSharp.dll

The point to be used with rectangular grids.

[Version(1, 0, 0)]
[Serializable]
public struct RectPoint : IGridPoint<RectPoint>, IEquatable<RectPoint>, IGridPoint, IVectorPoint<RectPoint>, ISplicedVectorPoint<RectPoint, RectPoint>, ISupportsVertices<RectPoint>, ISupportsEdges<DiamondPoint>, IVertex<RectPoint>, IEdge<DiamondPoint>
Implements
Inherited Members
Extension Methods

Constructors

RectPoint(int, int)

Constructs a new RectPoint with the given coordinates.

public RectPoint(int x, int y)

Parameters

x int
y int

Fields

DiagonalDirections

public static readonly PointList<RectPoint> DiagonalDirections

Field Value

PointList<RectPoint>

East

public static readonly RectPoint East

Field Value

RectPoint

EdgeDirections

public static readonly IEnumerable<DiamondPoint> EdgeDirections

Field Value

IEnumerable<DiamondPoint>

EdgeFaceDirections

public static readonly IList<IEnumerable<DiamondPoint>> EdgeFaceDirections

Field Value

IList<IEnumerable<DiamondPoint>>

MainAndDiagonalDirections

public static readonly PointList<RectPoint> MainAndDiagonalDirections

Field Value

PointList<RectPoint>

MainDirections

public static readonly PointList<RectPoint> MainDirections

Field Value

PointList<RectPoint>

North

public static readonly RectPoint North

Field Value

RectPoint

NorthEast

public static readonly RectPoint NorthEast

Field Value

RectPoint

NorthWest

public static readonly RectPoint NorthWest

Field Value

RectPoint

South

public static readonly RectPoint South

Field Value

RectPoint

SouthEast

public static readonly RectPoint SouthEast

Field Value

RectPoint

SouthWest

public static readonly RectPoint SouthWest

Field Value

RectPoint

VertexDirections

public static readonly IEnumerable<RectPoint> VertexDirections

Field Value

IEnumerable<RectPoint>

VertexFaceDirections

public static readonly IEnumerable<RectPoint> VertexFaceDirections

Field Value

IEnumerable<RectPoint>

West

public static readonly RectPoint West

Field Value

RectPoint

Zero

The zero point (0, 0).

public static readonly RectPoint Zero

Field Value

RectPoint

Properties

BasePoint

A Uniform point's base point is simply the point itself. Makes it easier to implement generic algorithms. Since version 1.1

public RectPoint BasePoint { get; }

Property Value

RectPoint

SpliceCount

For spliced grids, this is the number of slices for all points.

For Uniform grids, this is always 1.

public int SpliceCount { get; }

Property Value

int

SpliceIndex

For spliced grids, this is the index of the splice.

For Uniform grids, this is always 0.

public int SpliceIndex { get; }

Property Value

int

X

The x-coordinate of this point. This need to be in XML

public int X { get; }

Property Value

int

Y

The y-coordinate of this point.

public int Y { get; }

Property Value

int

Methods

DistanceFrom(RectPoint)

The lattice distance from this point to the other.

public int DistanceFrom(RectPoint other)

Parameters

other RectPoint

Returns

int

Div(RectPoint)

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

Since version 1.6 (Rect) Since version 1.7 (other)

public RectPoint Div(RectPoint otherPoint)

Parameters

otherPoint RectPoint

Returns

RectPoint

Dot(RectPoint)

[Version(1, 7, 0)]
public int Dot(RectPoint other)

Parameters

other RectPoint

Returns

int

Equals(RectPoint)

public bool Equals(RectPoint other)

Parameters

other RectPoint

Returns

bool

Equals(object)

public override bool Equals(object other)

Parameters

other object

Returns

bool

GetColor(int, int, int)

Gives a coloring of the grid such that if a point p has color k, then all points p + m[ux, 0] + n[vx, vy] have the same color for any integers a and b.

More information anout grid colorings: http://gamelogic.co.za/2013/12/18/what-are-grid-colorings/

Since version 1.7

public int GetColor(int ux, int vx, int vy)

Parameters

ux int
vx int
vy int

Returns

int

GetColor1_1()

public int GetColor1_1()

Returns

int

GetColor1_2()

public int GetColor1_2()

Returns

int

GetColor4()

public int GetColor4()

Returns

int

GetEdgeAnchor()

public DiamondPoint GetEdgeAnchor()

Returns

DiamondPoint

GetEdgeFaces()

Get the coordinates of the faces that corresponds to this point treated as an edge.

public IEnumerable<DiamondPoint> GetEdgeFaces()

Returns

IEnumerable<DiamondPoint>

GetEdges()

public IEnumerable<DiamondPoint> GetEdges()

Returns

IEnumerable<DiamondPoint>

GetHashCode()

public override int GetHashCode()

Returns

int

GetVertexAnchor()

public RectPoint GetVertexAnchor()

Returns

RectPoint

GetVertexFaces()

Get the coordinates of the faces that corresponds to this point treated as a vertex.

public IEnumerable<RectPoint> GetVertexFaces()

Returns

IEnumerable<RectPoint>

GetVertices()

Returns the vertices of the point in the dual grid.

public IEnumerable<RectPoint> GetVertices()

Returns

IEnumerable<RectPoint>

Magnitude()

public int Magnitude()

Returns

int

Mod(RectPoint)

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.

Since version 1.6 (Rect) Since version 1.7 (other)

public RectPoint Mod(RectPoint otherPoint)

Parameters

otherPoint RectPoint

Returns

RectPoint

MoveBackBy(RectPoint)

If a spliced vectors u and v has base vector B and index I

public RectPoint MoveBackBy(RectPoint translation)

Parameters

translation RectPoint

Returns

RectPoint

Remarks

new SplicedVector(u.B.Subtract(v.B), (SpliceCount + u.I - v.I) % SpliceCount))

MoveBy(RectPoint)

If a spliced vectors u and v has base vector B and index I,

public RectPoint MoveBy(RectPoint translation)

Parameters

translation RectPoint

Returns

RectPoint

Remarks

This operation is the same as

new SplicedVector(u.B.Translate(v.B), (u.I + v.I) % SpliceCount))

Mul(RectPoint)

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

Since version 1.6 (Rect) Since version 1.7 (other)

public RectPoint Mul(RectPoint otherPoint)

Parameters

otherPoint RectPoint

Returns

RectPoint

Negate()

Returns a new point with the vector component negated.

public RectPoint Negate()

Returns

RectPoint

Perp()

[Version(1, 10, 0)]
public RectPoint Perp()

Returns

RectPoint

PerpDot(RectPoint)

[Version(1, 7, 0)]
public int PerpDot(RectPoint other)

Parameters

other RectPoint

Returns

int

ReflectAboutX()

public object ReflectAboutX()

Returns

object

ReflectAboutY()

public object ReflectAboutY()

Returns

object

Rotate180()

public object Rotate180()

Returns

object

Rotate270()

public object Rotate270()

Returns

object

Rotate90()

public RectPoint Rotate90()

Returns

RectPoint

ScaleDown(int)

Scales this vector by the given amount.

public RectPoint ScaleDown(int r)

Parameters

r int

Returns

RectPoint

Examples

v.ScaleUp(1)
v.ScaleUp(n) ==  v.ScaleUp(n - 1).Translate(v)

ScaleUp(int)

public RectPoint ScaleUp(int r)

Parameters

r int

Returns

RectPoint

Subtract(RectPoint)

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

public RectPoint Subtract(RectPoint other)

Parameters

other RectPoint

Returns

RectPoint

ToString()

public override string ToString()

Returns

string

Translate(RectPoint)

This is a norm defined on the point, such that p1.Difference(p2).Abs() is equal to p1.DistanceFrom(p2).

public RectPoint Translate(RectPoint translation)

Parameters

translation RectPoint

Returns

RectPoint

__GetColor__ReferenceImplementation(int, int, int)

Gives a coloring of the grid such that if a point p has color k, then all points p + m[ux, 0] + n[vx, vy] have the same color for any integers a and b.

More information anout grid colorings: http://gamelogic.co.za/2013/12/18/what-are-grid-colorings/

Since version 1.7

public int __GetColor__ReferenceImplementation(int ux, int vx, int vy)

Parameters

ux int
vx int
vy int

Returns

int

Operators

operator +(RectPoint, RectPoint)

public static RectPoint operator +(RectPoint point1, RectPoint point2)

Parameters

point1 RectPoint
point2 RectPoint

Returns

RectPoint

operator /(RectPoint, RectPoint)

public static RectPoint operator /(RectPoint point1, RectPoint point2)

Parameters

point1 RectPoint
point2 RectPoint

Returns

RectPoint

operator /(RectPoint, int)

public static RectPoint operator /(RectPoint point, int n)

Parameters

point RectPoint
n int

Returns

RectPoint

operator ==(RectPoint, RectPoint)

public static bool operator ==(RectPoint point1, RectPoint point2)

Parameters

point1 RectPoint
point2 RectPoint

Returns

bool

operator !=(RectPoint, RectPoint)

public static bool operator !=(RectPoint point1, RectPoint point2)

Parameters

point1 RectPoint
point2 RectPoint

Returns

bool

operator %(RectPoint, RectPoint)

public static RectPoint operator %(RectPoint point1, RectPoint point2)

Parameters

point1 RectPoint
point2 RectPoint

Returns

RectPoint

operator *(RectPoint, RectPoint)

public static RectPoint operator *(RectPoint point1, RectPoint point2)

Parameters

point1 RectPoint
point2 RectPoint

Returns

RectPoint

operator *(RectPoint, int)

public static RectPoint operator *(RectPoint point, int n)

Parameters

point RectPoint
n int

Returns

RectPoint

operator -(RectPoint, RectPoint)

public static RectPoint operator -(RectPoint point1, RectPoint point2)

Parameters

point1 RectPoint
point2 RectPoint

Returns

RectPoint

operator -(RectPoint)

public static RectPoint operator -(RectPoint point)

Parameters

point RectPoint

Returns

RectPoint

operator +(RectPoint)

public static RectPoint operator +(RectPoint point)

Parameters

point RectPoint

Returns

RectPoint