Change std::nan("") to proper nan constants
This commit is contained in:
parent
12a54251c9
commit
fed317f27b
@ -772,7 +772,7 @@ inline bool is_any_triangle_in_radius(
|
|||||||
{ vertices, faces, tree, point };
|
{ vertices, faces, tree, point };
|
||||||
|
|
||||||
size_t hit_idx;
|
size_t hit_idx;
|
||||||
VectorType hit_point = VectorType::Ones() * (std::nan(""));
|
VectorType hit_point = VectorType::Ones() * (NaN<typename VectorType::Scalar>);
|
||||||
|
|
||||||
if(tree.empty())
|
if(tree.empty())
|
||||||
{
|
{
|
||||||
|
@ -15,7 +15,7 @@ class CircleBed {
|
|||||||
double radius_;
|
double radius_;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
inline CircleBed(): center_(0, 0), radius_(std::nan("")) {}
|
inline CircleBed(): center_(0, 0), radius_(NaNd) {}
|
||||||
explicit inline CircleBed(const Point& c, double r): center_(c), radius_(r) {}
|
explicit inline CircleBed(const Point& c, double r): center_(c), radius_(r) {}
|
||||||
|
|
||||||
inline double radius() const { return radius_; }
|
inline double radius() const { return radius_; }
|
||||||
|
@ -41,13 +41,13 @@ template<size_t N> using Bounds = std::array<Bound, N>;
|
|||||||
class StopCriteria {
|
class StopCriteria {
|
||||||
|
|
||||||
// If the absolute value difference between two scores.
|
// If the absolute value difference between two scores.
|
||||||
double m_abs_score_diff = std::nan("");
|
double m_abs_score_diff = NaNd;
|
||||||
|
|
||||||
// If the relative value difference between two scores.
|
// If the relative value difference between two scores.
|
||||||
double m_rel_score_diff = std::nan("");
|
double m_rel_score_diff = NaNd;
|
||||||
|
|
||||||
// Stop if this value or better is found.
|
// Stop if this value or better is found.
|
||||||
double m_stop_score = std::nan("");
|
double m_stop_score = NaNd;
|
||||||
|
|
||||||
// A predicate that if evaluates to true, the optimization should terminate
|
// A predicate that if evaluates to true, the optimization should terminate
|
||||||
// and the best result found prior to termination should be returned.
|
// and the best result found prior to termination should be returned.
|
||||||
|
@ -76,7 +76,7 @@ struct Facestats {
|
|||||||
// Try to guess the number of support points needed to support a mesh
|
// Try to guess the number of support points needed to support a mesh
|
||||||
double get_misalginment_score(const TriangleMesh &mesh, const Transform3f &tr)
|
double get_misalginment_score(const TriangleMesh &mesh, const Transform3f &tr)
|
||||||
{
|
{
|
||||||
if (mesh.its.vertices.empty()) return std::nan("");
|
if (mesh.its.vertices.empty()) return NaNd;
|
||||||
|
|
||||||
auto accessfn = [&mesh, &tr](size_t fi) {
|
auto accessfn = [&mesh, &tr](size_t fi) {
|
||||||
Facestats fc{get_transformed_triangle(mesh, tr, fi)};
|
Facestats fc{get_transformed_triangle(mesh, tr, fi)};
|
||||||
@ -117,7 +117,7 @@ inline double get_supportedness_score(const Facestats &fc)
|
|||||||
// Try to guess the number of support points needed to support a mesh
|
// Try to guess the number of support points needed to support a mesh
|
||||||
double get_supportedness_score(const TriangleMesh &mesh, const Transform3f &tr)
|
double get_supportedness_score(const TriangleMesh &mesh, const Transform3f &tr)
|
||||||
{
|
{
|
||||||
if (mesh.its.vertices.empty()) return std::nan("");
|
if (mesh.its.vertices.empty()) return NaNd;
|
||||||
|
|
||||||
auto accessfn = [&mesh, &tr](size_t fi) {
|
auto accessfn = [&mesh, &tr](size_t fi) {
|
||||||
Facestats fc{get_transformed_triangle(mesh, tr, fi)};
|
Facestats fc{get_transformed_triangle(mesh, tr, fi)};
|
||||||
@ -149,10 +149,10 @@ float find_ground_level(const TriangleMesh &mesh,
|
|||||||
return execution::reduce(ex_tbb, size_t(0), vsize, zmin, minfn, accessfn, granularity);
|
return execution::reduce(ex_tbb, size_t(0), vsize, zmin, minfn, accessfn, granularity);
|
||||||
}
|
}
|
||||||
|
|
||||||
float get_supportedness_onfloor_score(const TriangleMesh &mesh,
|
double get_supportedness_onfloor_score(const TriangleMesh &mesh,
|
||||||
const Transform3f &tr)
|
const Transform3f &tr)
|
||||||
{
|
{
|
||||||
if (mesh.its.vertices.empty()) return std::nan("");
|
if (mesh.its.vertices.empty()) return NaNd;
|
||||||
|
|
||||||
size_t Nthreads = std::thread::hardware_concurrency();
|
size_t Nthreads = std::thread::hardware_concurrency();
|
||||||
|
|
||||||
|
@ -654,7 +654,7 @@ void SupportTreeBuildsteps::filter()
|
|||||||
for (const SupportPoint &sp : m_support_pts) {
|
for (const SupportPoint &sp : m_support_pts) {
|
||||||
m_thr();
|
m_thr();
|
||||||
heads.emplace_back(
|
heads.emplace_back(
|
||||||
std::nan(""),
|
NaNd,
|
||||||
sp.head_front_radius,
|
sp.head_front_radius,
|
||||||
0.,
|
0.,
|
||||||
m_cfg.head_penetration_mm,
|
m_cfg.head_penetration_mm,
|
||||||
|
@ -1036,7 +1036,7 @@ void SLAPrint::Steps::merge_slices_and_eval_stats() {
|
|||||||
// Estimated printing time
|
// Estimated printing time
|
||||||
// A layers count o the highest object
|
// A layers count o the highest object
|
||||||
if (printer_input.size() == 0)
|
if (printer_input.size() == 0)
|
||||||
print_statistics.estimated_print_time = std::nan("");
|
print_statistics.estimated_print_time = NaNd;
|
||||||
else {
|
else {
|
||||||
print_statistics.estimated_print_time = estim_time;
|
print_statistics.estimated_print_time = estim_time;
|
||||||
print_statistics.layers_times = layers_times;
|
print_statistics.layers_times = layers_times;
|
||||||
|
@ -331,6 +331,12 @@ public:
|
|||||||
inline bool empty() const { return size() == 0; }
|
inline bool empty() const { return size() == 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<class T, class = FloatingOnly<T>>
|
||||||
|
constexpr T NaN = std::numeric_limits<T>::quiet_NaN();
|
||||||
|
|
||||||
|
constexpr float NaNf = NaN<float>;
|
||||||
|
constexpr double NaNd = NaN<double>;
|
||||||
|
|
||||||
} // namespace Slic3r
|
} // namespace Slic3r
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1163,7 +1163,7 @@ void Control::draw_ruler(wxDC& dc)
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
double short_tick = std::nan("");
|
double short_tick = NaNd;
|
||||||
int tick = 0;
|
int tick = 0;
|
||||||
double value = 0.0;
|
double value = 0.0;
|
||||||
size_t sequence = 0;
|
size_t sequence = 0;
|
||||||
|
@ -822,7 +822,7 @@ public:
|
|||||||
|
|
||||||
class WipeTowerInfo {
|
class WipeTowerInfo {
|
||||||
protected:
|
protected:
|
||||||
Vec2d m_pos = {std::nan(""), std::nan("")};
|
Vec2d m_pos = {NaNd, NaNd};
|
||||||
double m_rotation = 0.;
|
double m_rotation = 0.;
|
||||||
BoundingBoxf m_bb;
|
BoundingBoxf m_bb;
|
||||||
friend class GLCanvas3D;
|
friend class GLCanvas3D;
|
||||||
|
@ -386,7 +386,7 @@ long raster_pxsum(const sla::RasterGrayscaleAA &raster)
|
|||||||
|
|
||||||
double raster_white_area(const sla::RasterGrayscaleAA &raster)
|
double raster_white_area(const sla::RasterGrayscaleAA &raster)
|
||||||
{
|
{
|
||||||
if (raster.resolution().pixels() == 0) return std::nan("");
|
if (raster.resolution().pixels() == 0) return NaNd;
|
||||||
|
|
||||||
auto res = raster.resolution();
|
auto res = raster.resolution();
|
||||||
double a = 0;
|
double a = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user