Generated by DocFX

Struct Hex

Hex Coordinate

Inherited Members
System.ValueType.Equals(System.Object)
System.ValueType.GetHashCode()
System.ValueType.ToString()
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: Ladybug
Assembly: ladybug.dll
Syntax
public struct Hex

Constructors

| Improve this Doc View Source

Hex(Int32, Int32, Int32)

Create a Hex coordinate

Declaration
public Hex(int q, int r, int s)
Parameters
Type Name Description
System.Int32 q
System.Int32 r
System.Int32 s

Fields

| Improve this Doc View Source

DEFAULT_OFFSET

Default grid offset method

Declaration
public const HexOffset DEFAULT_OFFSET = HexOffset.Odd
Field Value
Type Description
HexOffset
| Improve this Doc View Source

DEFAULT_ORIENTATION

Default hexagon orientation

Declaration
public const HexOrientation DEFAULT_ORIENTATION = HexOrientation.Point
Field Value
Type Description
HexOrientation
| Improve this Doc View Source

Diagonals

Diagonal coordinates

Declaration
public static readonly Hex[] Diagonals
Field Value
Type Description
Hex[]
| Improve this Doc View Source

Directions

Directional coordinates

Declaration
public static readonly Hex[] Directions
Field Value
Type Description
Hex[]

Properties

| Improve this Doc View Source

Length

Length of the Hex coordinate

Declaration
public readonly int Length { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

Q

Q axis coordinate value

Declaration
public readonly int Q { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

R

R axis coordinate value

Declaration
public readonly int R { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

S

S axis coordinate value

Declaration
public readonly int S { get; }
Property Value
Type Description
System.Int32

Methods

| Improve this Doc View Source

Add(Hex)

Sum two Hex coordinates

Declaration
public Hex Add(Hex other)
Parameters
Type Name Description
Hex other
Returns
Type Description
Hex
| Improve this Doc View Source

Distance(Hex)

Get the distance between Hex coordinates

Declaration
public int Distance(Hex hex)
Parameters
Type Name Description
Hex hex
Returns
Type Description
System.Int32
| Improve this Doc View Source

FromOffset(Point, HexOffset, HexOrientation)

Convert an offset coordinate to a Hex coordinate value

Declaration
public static Hex FromOffset(Point pos, HexOffset offset = HexOffset.Odd, HexOrientation orientation = HexOrientation.Point)
Parameters
Type Name Description
Microsoft.Xna.Framework.Point pos
HexOffset offset
HexOrientation orientation
Returns
Type Description
Hex
| Improve this Doc View Source

FromOffset(Vector2, HexOffset, HexOrientation)

Convert an offset coordinate to a Hex coordinate value

Declaration
public static Hex FromOffset(Vector2 pos, HexOffset offset = HexOffset.Odd, HexOrientation orientation = HexOrientation.Point)
Parameters
Type Name Description
Microsoft.Xna.Framework.Vector2 pos
HexOffset offset
HexOrientation orientation
Returns
Type Description
Hex
| Improve this Doc View Source

FromOffset(Int32, Int32, HexOffset, HexOrientation)

Convert an offset coordinate value to a Hex coordinate value

Declaration
public static Hex FromOffset(int x, int y, HexOffset offset = HexOffset.Odd, HexOrientation orientation = HexOrientation.Point)
Parameters
Type Name Description
System.Int32 x
System.Int32 y
HexOffset offset
HexOrientation orientation
Returns
Type Description
Hex
| Improve this Doc View Source

RotateLeft()

Rotate Hex coordinate values counter-clockwise

Declaration
public Hex RotateLeft()
Returns
Type Description
Hex
| Improve this Doc View Source

RotateRight()

Rotate Hex coordinate values clockwise

Declaration
public Hex RotateRight()
Returns
Type Description
Hex
| Improve this Doc View Source

Scale(Int32)

Scale the Hex coordinate

Declaration
public Hex Scale(int k)
Parameters
Type Name Description
System.Int32 k
Returns
Type Description
Hex
| Improve this Doc View Source

Subtract(Hex)

Subtract two Hex coordinates

Declaration
public Hex Subtract(Hex other)
Parameters
Type Name Description
Hex other
Returns
Type Description
Hex
| Improve this Doc View Source

ToOffset(HexOrientation, HexOffset)

Convert Hex coordinate to offset coordinate

Declaration
public Vector2 ToOffset(HexOrientation orientation = HexOrientation.Point, HexOffset offset = HexOffset.Odd)
Parameters
Type Name Description
HexOrientation orientation
HexOffset offset
Returns
Type Description
Microsoft.Xna.Framework.Vector2

Operators

| Improve this Doc View Source

Addition(Hex, Hex)

Sum Hex coordinates

Declaration
public static Hex operator +(Hex a, Hex b)
Parameters
Type Name Description
Hex a
Hex b
Returns
Type Description
Hex
| Improve this Doc View Source

Subtraction(Hex, Hex)

Subtract Hex coordinates

Declaration
public static Hex operator -(Hex a, Hex b)
Parameters
Type Name Description
Hex a
Hex b
Returns
Type Description
Hex