hex Derived Type

type, public :: hex

cubic coordinates for hexagonal tiles


Components

Type Visibility Attributes Name Initial
integer, public :: q

constrained by q+r+s==0

integer, public :: r

constrained by q+r+s==0

integer, public :: s

constrained by q+r+s==0


Constructor

public interface hex

constructor override

  • private pure function new_hex_cubic(q, r, s) result(H)

    Safe cubic constructor for the hex type featuring an assertion on input coordinates before the initialization of the object

    Arguments

    Type IntentOptional Attributes Name
    integer, intent(in) :: q
    integer, intent(in) :: r
    integer, intent(in) :: s

    Return Value type(hex)

  • private pure function new_hex_axial(q, r) result(H)

    Axial cubic constructor for the hex type [s would be computed internally]

    Arguments

    Type IntentOptional Attributes Name
    integer, intent(in) :: q
    integer, intent(in) :: r

    Return Value type(hex)