mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-12 17:58:59 +08:00
Added an equality operator for floating point types config options that returns for close to slic3r::epsilon
This commit is contained in:
parent
dbc216e078
commit
6ef77fea5c
@ -13,6 +13,7 @@
|
||||
#include "libslic3r.h"
|
||||
#include "utils.hpp"
|
||||
#include "Point.hpp"
|
||||
#include "Geometry.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
@ -119,6 +120,10 @@ class ConfigOptionFloat : public ConfigOptionSingle<double>
|
||||
iss >> this->value;
|
||||
return !iss.fail();
|
||||
};
|
||||
|
||||
/// Floating point values we conpare within some small value for equality.
|
||||
template<typename Y>
|
||||
bool operator==(const Y& other) { return std::abs(value - other) < Slic3r::Geometry::epsilon; }
|
||||
};
|
||||
|
||||
/// Vector form of template specialization for floating point numbers.
|
||||
|
Loading…
x
Reference in New Issue
Block a user