25template <
int Dimension,
int MaxDimension>
31 [[nodiscard]]
static constexpr Eigen::Index
39 operator==(LeafExtent
const &, LeafExtent
const &) =
default;
43template <
int MaxDimension>
44class LeafExtent<Eigen::Dynamic, MaxDimension>
49 [[nodiscard]] Eigen::Index
50 valueDimension()
const
57 resize(Eigen::Index n)
60 n >= 0 && (MaxDimension == Eigen::Dynamic || n <= MaxDimension) &&
"the dimension does not fit the space"
67 operator==(LeafExtent
const &, LeafExtent
const &) =
default;
71 Eigen::Index m_size = 0;
85template <
int Dimension_ = 1,
int MaxDimension_ = Dimension_>
86struct Linear : internal::LeafExtent<Dimension_, MaxDimension_>
88 static_assert(Dimension_ == Eigen::Dynamic || Dimension_ >= 0);
89 static_assert(Dimension_ == Eigen::Dynamic || MaxDimension_ == Dimension_,
"a fixed size is its own maximum");
91 Dimension_ == Eigen::Dynamic ? 0 : Dimension_;
93 Dimension_ == Eigen::Dynamic ? 1 : 0;
100 requires(Dimension_ == Eigen::Dynamic)
124 double lower = std::numeric_limits<double>::quiet_NaN();
125 double upper = std::numeric_limits<double>::quiet_NaN();
142template <PeriodicInterval Interval,
int Dimension_ = 1,
int MaxDimension_ = Dimension_>
143class Periodic :
public internal::LeafExtent<Dimension_, MaxDimension_>
147 static_assert(Dimension_ == Eigen::Dynamic || Dimension_ >= 1);
148 static_assert(Dimension_ == Eigen::Dynamic || MaxDimension_ == Dimension_,
"a fixed size is its own maximum");
149 static_assert(Interval.lower == Interval.lower,
"the lower end must be given");
150 static_assert(Interval.upper == Interval.upper,
"the upper end must be given");
151 static_assert(Interval.lower < Interval.upper,
"the upper end must be above the lower");
154 Interval.upper - Interval.lower < std::numeric_limits<double>::infinity(),
155 "the period must be finite"
159 Dimension_ == Eigen::Dynamic ? 0 : Dimension_;
161 Dimension_ == Eigen::Dynamic ? 1 : 0;
164 Periodic() =
default;
168 requires(Dimension_ == Eigen::Dynamic)
174 [[nodiscard]]
static consteval double
177 return Interval.lower;
181 [[nodiscard]]
static consteval double
184 return Interval.upper;
188 [[nodiscard]]
static consteval double
191 return Interval.upper - Interval.lower;
197 template <
typename Derived>
202 return internal::wrapValue<lower(), period()>(x);
212 if constexpr (Dimension_ == Eigen::Dynamic)
214 return Difference{this->valueDimension()};
230template <
int Dimension = 1,
int MaxDimension = Dimension>
237template <
int Dimension = 1,
int MaxDimension = Dimension>
243template <
int Dimension = 1,
int MaxDimension = Dimension>
249template <
int Dimension = 1,
int MaxDimension = Dimension>
The macros every header includes first.
The Space concept and what every continuous space shares (decisions.md [sizes-and-dimensions]): the t...
Dimension_ coordinates that wrap with a common period, such as angles or DFT bins.
Definition Coordinates.h:144
static constexpr int ValueDimensionStep
Definition Coordinates.h:160
static consteval double period()
Definition Coordinates.h:189
static consteval double upper()
Definition Coordinates.h:182
static constexpr int FixedValueDimension
Definition Coordinates.h:158
void normalize(Eigen::MatrixBase< Derived > const &block) const
Wraps every value in block into [lower(), upper()), writing through the const reference (see writable...
Definition Coordinates.h:199
friend bool operator==(Periodic const &, Periodic const &)=default
Equal when every stored parameter and size is; a fixed-size Periodic is always equal.
static constexpr int MaxValueDimension
Definition Coordinates.h:162
Periodic(Eigen::Index n)
n coordinates of a resizable Periodic.
Definition Coordinates.h:167
auto difference() const
The Periodic on [-period()/2, period()/2), with the same size.
Definition Coordinates.h:208
static consteval double lower()
Definition Coordinates.h:175
Eigen::MatrixBase< Derived > & writable(Eigen::MatrixBase< Derived > const &block)
block, writable: Eigen's idiom for a function that writes through an expression passed as const&.
Definition Space.h:389
auto block(Space auto const &space, X &&x)
Definition TagPath.h:979
Periodic< PeriodicInterval{.lower=0.0,.upper=360.0}, Dimension, MaxDimension > Degrees360
Dimension angles in degrees, in [0, 360), such as a compass heading.
Definition Coordinates.h:250
Periodic< PeriodicInterval{.lower=-std::numbers::pi,.upper=std::numbers::pi}, Dimension, MaxDimension > RadiansPi
Dimension angles in radians, in [-π, π).
Definition Coordinates.h:231
Periodic< PeriodicInterval{.lower=-180.0,.upper=180.0}, Dimension, MaxDimension > Degrees180
Dimension angles in degrees, in [-180, 180).
Definition Coordinates.h:244
Periodic< PeriodicInterval{.lower=0.0,.upper=2 *std::numbers::pi}, Dimension, MaxDimension > Radians2Pi
Dimension angles in radians, in [0, 2π).
Definition Coordinates.h:238
Dimension_ plain coordinates, or a resizable run of at most MaxDimension_ of them if Dimension_ is Ei...
Definition Coordinates.h:87
Linear difference() const
The Linear of the same sizes, which a tag derived from this one does not carry.
Definition Coordinates.h:107
static constexpr int ValueDimensionStep
Definition Coordinates.h:92
static constexpr int MaxValueDimension
Definition Coordinates.h:94
Linear(Eigen::Index n)
n coordinates of a resizable Linear.
Definition Coordinates.h:99
friend bool operator==(Linear const &, Linear const &)=default
Equal when every stored parameter and size is; a fixed-size Linear is always equal.
static constexpr int FixedValueDimension
Definition Coordinates.h:90
Where a Periodic coordinate's values lie: the half-open interval [lower, upper), whose width is the p...
Definition Coordinates.h:123
double upper
the excluded upper end, lower + period
Definition Coordinates.h:125
double lower
the included lower end
Definition Coordinates.h:124