载入中...
搜索中...
未找到
HexCoordinates.h
浏览该文件的文档.
29 constexpr HexCoordinates(std::int32_t xValue, std::int32_t zValue) noexcept : x(xValue), z(zValue) {}
38 [[nodiscard]] constexpr bool operator!=(const HexCoordinates& other) const noexcept { return !(*this == other); }
45 [[nodiscard]] constexpr HexCoordinates step(HexDirection direction, std::int32_t distance = 1) const noexcept {
73 [[nodiscard]] constexpr float hexZ() const noexcept { return static_cast<float>(z) * HexMetrics::kOuterToInner; }
81 [[nodiscard]] constexpr std::int32_t chunkRow() const noexcept { return z / HexMetrics::kChunkSizeZ; }
84 [[nodiscard]] static constexpr HexCoordinates fromOffset(std::int32_t offsetX, std::int32_t offsetZ) noexcept {
108 return HexVec3{fx * diameter, 0.f, static_cast<float>(coordinates.z) * HexMetrics::rowSpacing()};
Pointy-top hex metrics, directions and vertex helpers.
Definition HexCell.h:9
Definition Container.h:602
static HexVec3 toWorldPosition(HexCoordinates coordinates) noexcept
World-space centre of a cell before elevation and perturbation.
Definition HexCoordinates.h:105
constexpr std::int32_t chunkRow() const noexcept
Chunk row this cell belongs to.
Definition HexCoordinates.h:81
constexpr bool operator!=(const HexCoordinates &other) const noexcept
Operator !=.
Definition HexCoordinates.h:38
static constexpr HexCoordinates fromOffset(std::int32_t offsetX, std::int32_t offsetZ) noexcept
Converts an odd-row offset pair into axial coordinates.
Definition HexCoordinates.h:84
constexpr std::int32_t offsetZ() const noexcept
Offset Z (row) of this cell inside the rectangular grid.
Definition HexCoordinates.h:92
constexpr std::int32_t distanceTo(const HexCoordinates &other) const noexcept
Cube distance to another cell (wrapping is not supported).
Definition HexCoordinates.h:58
constexpr float hexX() const noexcept
Hex-space X: east-west neighbour spacing is 1.
Definition HexCoordinates.h:67
constexpr std::int32_t offsetX() const noexcept
Offset X of this cell inside the rectangular grid.
Definition HexCoordinates.h:89
constexpr bool operator==(const HexCoordinates &other) const noexcept
Definition HexCoordinates.h:34
constexpr HexCoordinates step(HexDirection direction, std::int32_t distance=1) const noexcept
Returns the neighbouring coordinates one step in direction.
Definition HexCoordinates.h:45
constexpr float hexZ() const noexcept
Hex-space Z: row spacing is outerToInner.
Definition HexCoordinates.h:73
constexpr HexCoordinates() noexcept=default
Hex coordinates.
constexpr std::int32_t chunkColumn() const noexcept
Chunk column this cell belongs to.
Definition HexCoordinates.h:76
Minimal 3-component float vector used by the hex mesh builders.
Definition HexMetrics.h:18