mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-16 04:35:58 +08:00
Fix arrange tests on raspberry pi
There were indeed floating point divisions with zero
This commit is contained in:
parent
9da03dfc9f
commit
3fe051b0ad
@ -30,6 +30,9 @@ void EdgeCache::sample_contour(double accuracy, std::vector<ContourLocation> &sa
|
||||
const auto N = m_contour.distances.size();
|
||||
const auto S = stride(N, accuracy);
|
||||
|
||||
if (N == 0 || S == 0)
|
||||
return;
|
||||
|
||||
samples.reserve(N / S + 1);
|
||||
for(size_t i = 0; i < N; i += S) {
|
||||
samples.emplace_back(
|
||||
@ -41,6 +44,10 @@ void EdgeCache::sample_contour(double accuracy, std::vector<ContourLocation> &sa
|
||||
|
||||
const auto NH = hc.distances.size();
|
||||
const auto SH = stride(NH, accuracy);
|
||||
|
||||
if (NH == 0 || SH == 0)
|
||||
continue;
|
||||
|
||||
samples.reserve(samples.size() + NH / SH + 1);
|
||||
for (size_t i = 0; i < NH; i += SH) {
|
||||
samples.emplace_back(
|
||||
|
@ -48,8 +48,9 @@ public:
|
||||
// when fetching corners.
|
||||
static inline size_t stride(const size_t N, double accuracy)
|
||||
{
|
||||
size_t n = std::max(size_t{1}, N);
|
||||
return static_cast<coord_t>(
|
||||
std::round(N / std::pow(N, std::pow(accuracy, 1./3.)))
|
||||
std::round(N / std::pow(n, std::pow(accuracy, 1./3.)))
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user