Struct PointyRhombPoint
A struct that represents a point of a PointyRhombPoint.
[Version(1, 0, 0)]
[Serializable]
public struct PointyRhombPoint : IEdge<PointyHexPoint>, IEdge<FlatTriPoint>, ISplicedPoint<PointyRhombPoint, PointyHexPoint>, IGridPoint<PointyRhombPoint>, IEquatable<PointyRhombPoint>, IGridPoint, ISplicedVectorPoint<PointyRhombPoint, PointyHexPoint>
- Implements
- Inherited Members
- Extension Methods
Constructors
PointyRhombPoint(int, int, int)
public PointyRhombPoint(int x, int y, int index)
Parameters
Fields
HexEdgeFaceDirections
public static readonly IList<IEnumerable<PointyHexPoint>> HexEdgeFaceDirections
Field Value
MainDirections
public static readonly IEnumerable<PointyRhombPoint>[] MainDirections
Field Value
SpliceCount
public const int SpliceCount = 3
Field Value
TriEdgeFaceDirections
public static readonly List<IEnumerable<FlatTriPoint>> TriEdgeFaceDirections
Field Value
Zero
public static readonly PointyRhombPoint Zero
Field Value
Properties
BasePoint
Why is this public? - Convenience - Algorithm Design Otherwise the user will just make a new basepoint in any case, and perhaps make a mistake.
public PointyHexPoint BasePoint { get; }
Property Value
I
Returns the splice idnex for this point.
public int I { 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
Returns the X-coordinate of this point.
public int X { get; }
Property Value
Y
Returns the Y-coordinate of this point.
public int Y { get; }
Property Value
Methods
DecIndex(int)
public PointyRhombPoint DecIndex(int n)
Parameters
n
int
Returns
DistanceFrom(PointyRhombPoint)
The lattice distance between two points.
Two points should have a distance of 1 if and only if they are neighbors.
public int DistanceFrom(PointyRhombPoint other)
Parameters
other
PointyRhombPoint
Returns
Equals(PointyRhombPoint)
public bool Equals(PointyRhombPoint other)
Parameters
other
PointyRhombPoint
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 | 0] + n[vx, vy | 0] have the same color for any integers a and b.
Since version 1.7
public int GetColor(int ux, int vx, int vy)
Parameters
Returns
GetColor12()
public int GetColor12()
Returns
GetHashCode()
public override int GetHashCode()
Returns
IncIndex(int)
public PointyRhombPoint IncIndex(int n)
Parameters
n
int
Returns
InvertIndex()
public PointyRhombPoint InvertIndex()
Returns
MoveBackBy(PointyRhombPoint)
If a spliced vectors u and v has base vector B and index I
public PointyRhombPoint MoveBackBy(PointyRhombPoint other)
Parameters
other
PointyRhombPoint
Returns
Remarks
new SplicedVector(u.B.Subtract(v.B), (SpliceCount + u.I - v.I) % SpliceCount))
MoveBy(PointyRhombPoint)
If a spliced vectors u and v has base vector B and index I,
public PointyRhombPoint MoveBy(PointyRhombPoint other)
Parameters
other
PointyRhombPoint
Returns
Remarks
This operation is the same as
new SplicedVector(u.B.Translate(v.B), (u.I + v.I) % SpliceCount))
Negate()
Returns a new point with the vector component negated.
public PointyRhombPoint Negate()
Returns
ScaleDown(int)
public PointyRhombPoint ScaleDown(int r)
Parameters
r
int
Returns
ScaleUp(int)
public PointyRhombPoint ScaleUp(int r)
Parameters
r
int
Returns
Subtract(PointyHexPoint)
Translates this point by the negation of the given vector.
public PointyRhombPoint Subtract(PointyHexPoint other)
Parameters
other
PointyHexPoint
Returns
ToString()
public override string ToString()
Returns
Translate(PointyHexPoint)
Translate this point by the given vector.
public PointyRhombPoint Translate(PointyHexPoint other)
Parameters
other
PointyHexPoint
Returns
Operators
operator +(PointyRhombPoint, PointyHexPoint)
public static PointyRhombPoint operator +(PointyRhombPoint point1, PointyHexPoint point2)
Parameters
point1
PointyRhombPointpoint2
PointyHexPoint
Returns
operator /(PointyRhombPoint, int)
public static PointyRhombPoint operator /(PointyRhombPoint point, int n)
Parameters
point
PointyRhombPointn
int
Returns
operator ==(PointyRhombPoint, PointyRhombPoint)
public static bool operator ==(PointyRhombPoint point1, PointyRhombPoint point2)
Parameters
point1
PointyRhombPointpoint2
PointyRhombPoint
Returns
operator !=(PointyRhombPoint, PointyRhombPoint)
public static bool operator !=(PointyRhombPoint point1, PointyRhombPoint point2)
Parameters
point1
PointyRhombPointpoint2
PointyRhombPoint
Returns
operator *(PointyRhombPoint, int)
public static PointyRhombPoint operator *(PointyRhombPoint point, int n)
Parameters
point
PointyRhombPointn
int
Returns
operator -(PointyRhombPoint, PointyHexPoint)
public static PointyRhombPoint operator -(PointyRhombPoint point1, PointyHexPoint point2)
Parameters
point1
PointyRhombPointpoint2
PointyHexPoint
Returns
operator -(PointyRhombPoint)
public static PointyRhombPoint operator -(PointyRhombPoint point)
Parameters
point
PointyRhombPoint
Returns
operator +(PointyRhombPoint)
public static PointyRhombPoint operator +(PointyRhombPoint point)
Parameters
point
PointyRhombPoint