3#include <wmtk/Types.hpp>
29template <
class VecR,
class VecD>
35 : m_p(o.m_p ? std::make_unique<VecR>(*o.m_p) :
nullptr)
39 if (
this == &o)
return *
this;
45 m_p = std::make_unique<VecR>(*o.m_p);
51 VecR
value(
const VecD& posf)
const {
return m_p ? *m_p : to_rational(posf); }
56 return m_p ? (*m_p)[k] == r :
Rational(posf[k]) == r;
65 m_p = std::make_unique<VecR>(p);
72 bool stored()
const {
return static_cast<bool>(m_p); }
75 std::unique_ptr<VecR> m_p;
A vertex's exact (rational) position, stored only while it differs from the vertex's double position.
Definition ExactPosition.hpp:31
bool coord_equals(int k, const VecD &posf, const Rational &r) const
Whether coordinate k equals r, without materialising the whole position.
Definition ExactPosition.hpp:54
void store(const VecR &p)
Store an exact position that may differ from the double one.
Definition ExactPosition.hpp:60
VecR value(const VecD &posf) const
The exact position of a vertex whose double position is posf.
Definition ExactPosition.hpp:51
void clear()
The exact position is the double one: drop the stored copy.
Definition ExactPosition.hpp:70
Definition Rational.hpp:10