Struct RectPoint
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
Fields
DiagonalDirections
public static readonly PointList<RectPoint> DiagonalDirections
Field Value
East
public static readonly RectPoint East
Field Value
EdgeDirections
public static readonly IEnumerable<DiamondPoint> EdgeDirections
Field Value
EdgeFaceDirections
public static readonly IList<IEnumerable<DiamondPoint>> EdgeFaceDirections
Field Value
MainAndDiagonalDirections
public static readonly PointList<RectPoint> MainAndDiagonalDirections
Field Value
MainDirections
public static readonly PointList<RectPoint> MainDirections
Field Value
North
public static readonly RectPoint North
Field Value
NorthEast
public static readonly RectPoint NorthEast
Field Value
NorthWest
public static readonly RectPoint NorthWest
Field Value
South
public static readonly RectPoint South
Field Value
SouthEast
public static readonly RectPoint SouthEast
Field Value
SouthWest
public static readonly RectPoint SouthWest
Field Value
VertexDirections
public static readonly IEnumerable<RectPoint> VertexDirections
Field Value
VertexFaceDirections
public static readonly IEnumerable<RectPoint> VertexFaceDirections
Field Value
West
public static readonly RectPoint West
Field Value
Zero
The zero point (0, 0).
public static readonly RectPoint Zero
Field Value
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
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
SpliceIndex
For spliced grids, this is the index of the splice.
For Uniform grids, this is always 0.
public int SpliceIndex { get; }
Property Value
X
The x-coordinate of this point. This need to be in XML
public int X { get; }
Property Value
Y
The y-coordinate of this point.
public int Y { get; }
Property Value
Methods
DistanceFrom(RectPoint)
The lattice distance from this point to the other.
public int DistanceFrom(RectPoint other)
Parameters
other
RectPoint
Returns
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
Dot(RectPoint)
[Version(1, 7, 0)]
public int Dot(RectPoint other)
Parameters
other
RectPoint
Returns
Equals(RectPoint)
public bool Equals(RectPoint other)
Parameters
other
RectPoint
Returns
Equals(object)
public override bool Equals(object other)
Parameters
other
object
Returns
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
Returns
GetColor1_1()
public int GetColor1_1()
Returns
GetColor1_2()
public int GetColor1_2()
Returns
GetColor4()
public int GetColor4()
Returns
GetEdgeAnchor()
public DiamondPoint GetEdgeAnchor()
Returns
GetEdgeFaces()
Get the coordinates of the faces that corresponds to this point treated as an edge.
public IEnumerable<DiamondPoint> GetEdgeFaces()
Returns
GetEdges()
public IEnumerable<DiamondPoint> GetEdges()
Returns
GetHashCode()
public override int GetHashCode()
Returns
GetVertexAnchor()
public RectPoint GetVertexAnchor()
Returns
GetVertexFaces()
Get the coordinates of the faces that corresponds to this point treated as a vertex.
public IEnumerable<RectPoint> GetVertexFaces()
Returns
GetVertices()
Returns the vertices of the point in the dual grid.
public IEnumerable<RectPoint> GetVertices()
Returns
Magnitude()
public int Magnitude()
Returns
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
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
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
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
Negate()
Returns a new point with the vector component negated.
public RectPoint Negate()
Returns
Perp()
[Version(1, 10, 0)]
public RectPoint Perp()
Returns
PerpDot(RectPoint)
[Version(1, 7, 0)]
public int PerpDot(RectPoint other)
Parameters
other
RectPoint
Returns
ReflectAboutX()
public object ReflectAboutX()
Returns
ReflectAboutY()
public object ReflectAboutY()
Returns
Rotate180()
public object Rotate180()
Returns
Rotate270()
public object Rotate270()
Returns
Rotate90()
public RectPoint Rotate90()
Returns
ScaleDown(int)
Scales this vector by the given amount.
public RectPoint ScaleDown(int r)
Parameters
r
int
Returns
Examples
v.ScaleUp(1)
v.ScaleUp(n) == v.ScaleUp(n - 1).Translate(v)
ScaleUp(int)
public RectPoint ScaleUp(int r)
Parameters
r
int
Returns
Subtract(RectPoint)
Subtracts the other point from this point, and returns the result.
public RectPoint Subtract(RectPoint other)
Parameters
other
RectPoint
Returns
ToString()
public override string ToString()
Returns
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
__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
Returns
Operators
operator +(RectPoint, RectPoint)
public static RectPoint operator +(RectPoint point1, RectPoint point2)
Parameters
Returns
operator /(RectPoint, RectPoint)
public static RectPoint operator /(RectPoint point1, RectPoint point2)
Parameters
Returns
operator /(RectPoint, int)
public static RectPoint operator /(RectPoint point, int n)
Parameters
Returns
operator ==(RectPoint, RectPoint)
public static bool operator ==(RectPoint point1, RectPoint point2)
Parameters
Returns
operator !=(RectPoint, RectPoint)
public static bool operator !=(RectPoint point1, RectPoint point2)
Parameters
Returns
operator %(RectPoint, RectPoint)
public static RectPoint operator %(RectPoint point1, RectPoint point2)
Parameters
Returns
operator *(RectPoint, RectPoint)
public static RectPoint operator *(RectPoint point1, RectPoint point2)
Parameters
Returns
operator *(RectPoint, int)
public static RectPoint operator *(RectPoint point, int n)
Parameters
Returns
operator -(RectPoint, RectPoint)
public static RectPoint operator -(RectPoint point1, RectPoint point2)
Parameters
Returns
operator -(RectPoint)
public static RectPoint operator -(RectPoint point)
Parameters
point
RectPoint
Returns
operator +(RectPoint)
public static RectPoint operator +(RectPoint point)
Parameters
point
RectPoint