Files
Renderive/render_2D/axis/Abs_Axis.cpp
T
2026-08-12 00:06:44 +08:00

24 lines
574 B
C++

#include "Abs_Axis.h"
#include <algorithm>
#include <cmath>
namespace renderive {
Abs_Axis::Abs_Axis(Plot_Core& plot) : Renderable(plot, true) {}
Abs_Axis::~Abs_Axis() = default;
int Abs_Axis::pixel_sample_count(Range range) const {
const Axis_Transform value = transform();
const double first = value.coord_to_pixel(range.origin);
const double last = value.coord_to_pixel(range.target);
return std::max(0, static_cast<int>(std::abs(last - first)) + 1);
}
int Abs_Axis::sub_tick_count(double) const noexcept {
return 4;
}
} // namespace renderive