Nodes
Base module for the nodes of a polyhex
- class polyhex.objects.nodes.HexagonCentre(hexagon: Hexagon, feature: Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] = 'placeholder')
Bases:
NodeHexagonCentreclass which represents the centre of an hexagon It is created using:an hexagon (
polyhex.Hexagon), a feature (ArrayLike)- __init__(hexagon: Hexagon, feature: Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] = 'placeholder')
Constructor of the
HexagonCentreclassNotes
The constructor adds the following attributes to the Node class [x,y] : defined as the cartesian coordinates of the
HexagonCentrespatial_key : defined as the hex coordinates of theHexagonCentre- Parameters:
hexagon (
Hexagon) – Hexagon theHexagonCentreis the centre of.feature (
ArrayLike, optional) – Feature of theHexagonCentre
- distance(other, kwd='euclidian')
Method to compute the distance between two
HexagonCentre- Parameters:
other (
_type_) – otherHexagonCentrekwd (
str, optional) – Identifier of the distance. Defaults to “euclidian”.
- Raises:
NotImplementedError – This method is currently only implemented for the euclidian distance.
- Returns:
float distance value
- Return type:
np.ndarray
- class polyhex.objects.nodes.HexagonVertex(hexagon: Hexagon, index: int = 0, feature: str = 'placeholder')
Bases:
NodeHexagonVertexclass which represents the centre of an hexagon It is created using:an hexagon (
polyhex.Hexagon) the index of the vertex on the consideredHexagona feature (ArrayLike)It defines an extra feature_key attribute that combines the spatial and feature attributes of the HexagonVertex.
Note
Unlike
HexagonCentre, vertices can spatially coincide hence they need more information to be distinguished from one another.- __init__(hexagon: Hexagon, index: int = 0, feature: str = 'placeholder')
Constructor of the
HexagonVertexclassNotes
The constructor adds the following attributes to the Node class [x,y] : defined as the cartesian coordinates of the
HexagonVertexspatial_key : defined as the cartesian coordinates of theHexagonVertexfeature_key : combines the spatial and feature attributes of the HexagonVertex.- Parameters:
hexagon (
Hexagon) – Hexagon theHexagonVertexis part of.feature (
ArrayLike, optional) – Feature of theHexagonVertexindex (
int) – the index of the vertex in the considered Hexagon
- distance(other, kwd='euclidian')
Method to compute the distance between two
HexagonVertex- Parameters:
other (
_type_) – otherHexagonVertexkwd (
str, optional) – Identifier of the distance. Defaults to “euclidian”.
- Raises:
NotImplementedError – This is currently not implemented for any distance but the euclidian.
- Returns:
float distance value
- Return type:
np.ndarray