FireSTARR
Loading...
Searching...
No Matches
InnerPos.h
1/* Copyright (c) Queen's Printer for Ontario, 2020. */
2/* Copyright (c) His Majesty the King in Right of Canada as represented by the Minister of Natural Resources, 2025. */
3
4/* SPDX-License-Identifier: AGPL-3.0-or-later */
5
6#pragma once
7#include "stdafx.h"
8#include "Cell.h"
9
10namespace fs
11{
13using topo::Location;
14template <class S, int XMin, int XMax, int YMin, int YMax>
16 : public pair<S, S>
17{
18protected:
20 static constexpr auto INVALID_X = XMin - 1;
21 static constexpr auto INVALID_Y = YMin - 1;
22public:
23 using pair<S, S>::pair;
24 constexpr BoundedPoint() noexcept
25 : BoundedPoint(XMin - 1, YMin - 1)
26 {
27 }
31 template <class T, class O>
32 [[nodiscard]] constexpr T add(const O& o) const noexcept
33 {
34 return static_cast<T>(class_type(this->first + o.first, this->second + o.second));
35 }
36};
40class Offset
41 : public BoundedPoint<DistanceSize, -1, 1, -1, 1>
42{
43public:
47 using BoundedPoint<DistanceSize, -1, 1, -1, 1>::BoundedPoint;
48};
49using ROSOffset = std::tuple<Offset>;
50using OffsetSet = vector<ROSOffset>;
51}
52namespace fs::sim
53{
58 : public BoundedPoint<InnerSize, 0, 1, 0, 1>
59{
60 using BoundedPoint<InnerSize, 0, 1, 0, 1>::BoundedPoint;
61};
65class XYPos
66 : public BoundedPoint<XYSize, 0, MAX_COLUMNS, 0, MAX_ROWS>
67{
68public:
69 using BoundedPoint<XYSize, 0, MAX_COLUMNS, 0, MAX_ROWS>::BoundedPoint;
70 CONSTEXPR Location location() const
71 {
72 // HACK: Location is (row, column) and this is (x, y)
73 return {static_cast<Idx>(second), static_cast<Idx>(first)};
74 }
75};
80 : public BoundedPoint<Idx, 0, MAX_COLUMNS, 0, MAX_ROWS>
81{
82public:
83 using BoundedPoint<Idx, 0, MAX_COLUMNS, 0, MAX_ROWS>::BoundedPoint;
84 CONSTEXPR Location location() const
85 {
86 // HACK: Location is (row, column) and this is (x, y)
87 return {static_cast<Idx>(second), static_cast<Idx>(first)};
88 }
89};
90}
Definition InnerPos.h:17
constexpr T add(const O &o) const noexcept
Add offset to position and return result.
Definition InnerPos.h:32
Offset from a position.
Definition InnerPos.h:42
The position within the Environment that a spreading point has.
Definition InnerPos.h:81
The position within a Cell that a spreading point has.
Definition InnerPos.h:59
The position within the Environment that a spreading point has.
Definition InnerPos.h:67
Definition Location.h:229
Direction with access to degrees or radians.
Definition Weather.h:64