diff --git a/internal/core/axis.cpp b/internal/core/axis.cpp index 3acd1b6b..3320e144 100644 --- a/internal/core/axis.cpp +++ b/internal/core/axis.cpp @@ -9,8 +9,8 @@ Axis::Axis( - OpenVDS::VolumeDataLayout const * const layout, - int const dimension + OpenVDS::VolumeDataLayout const* const layout, + int const dimension ) : m_dimension(dimension), m_axis_descriptor(layout->GetAxisDescriptor(dimension)) {} @@ -44,69 +44,15 @@ std::string Axis::name() const noexcept(true) { } bool Axis::inrange(float coordinate) const noexcept(true) { - return this->min() <= coordinate && this->max() >= coordinate; + return this->min() <= coordinate && this->max() >= coordinate; } bool Axis::inrange_with_margin(float coordinate) const noexcept(true) { return (this->min() - 0.5 * this->stepsize()) <= coordinate && - (this->max() + 0.5 * this->stepsize()) > coordinate; + (this->max() + 0.5 * this->stepsize()) > coordinate; } float Axis::to_sample_position(float coordinate) noexcept(false) { return this->m_axis_descriptor.CoordinateToSamplePosition(coordinate); } -void Axis::assert_equal(Axis const& other) noexcept(false) { - - if (this->nsamples() != other.nsamples()) { - throw detail::bad_request( - "Axis: " + this->name() + - ": Mismatch in number of samples: " + - utils::to_string_with_precision(this->nsamples()) + - " != " + utils::to_string_with_precision(other.nsamples())); - } - - if (this->min() != other.min()) { - throw detail::bad_request( - "Axis: " + this->name() + - ": Mismatch in min value: " + - utils::to_string_with_precision(this->min()) + - " != " + utils::to_string_with_precision(other.min())); - } - - if (this->max() != other.max()) { - throw detail::bad_request( - "Axis: " + this->name() + - ": Mismatch in max value: " + - utils::to_string_with_precision(this->max()) + - " != " + utils::to_string_with_precision(other.max())); - } - - // Stepsize is a data integrity check. - // If min,max and nsamples are equal stepsize is equal for consistent data. - if (this->stepsize() != other.stepsize()) { - throw detail::bad_request( - "Axis: " + this->name() + - ": Mismatch in stepsize: " + - std::to_string(this->stepsize()) + - " != " + std::to_string(other.stepsize())); - } - - if (this->unit() != other.unit()) { - throw detail::bad_request( - "Axis: " + this->name() + - ": Mismatch in unit: " + - this->unit() + - " != " + other.unit()); - } - - // Ignore order of dimensions - - if (this->name() != other.name()) { - throw detail::bad_request( - "Axis: " + this->name() + - ": Mismatch in name: " + - this->name() + - " != " + other.name()); - } -} diff --git a/internal/core/axis.hpp b/internal/core/axis.hpp index b667e3f7..cc3f04cb 100644 --- a/internal/core/axis.hpp +++ b/internal/core/axis.hpp @@ -9,7 +9,7 @@ class Axis { public: Axis( - OpenVDS::VolumeDataLayout const * const layout, + OpenVDS::VolumeDataLayout const* const layout, int const dimension ); @@ -39,8 +39,6 @@ class Axis { bool inrange_with_margin(float coordinate) const noexcept(true); float to_sample_position(float coordinate) noexcept(false); - void assert_equal(Axis const& other) noexcept(false); - private: int const m_dimension; OpenVDS::VolumeDataAxisDescriptor m_axis_descriptor;