Merge branch 'master' into fs_emboss
# Conflicts: # src/libslic3r/CMakeLists.txt # src/libslic3r/Format/3mf.cpp # src/libslic3r/Model.hpp # src/libslic3r/Point.hpp # src/libslic3r/Technologies.hpp # src/slic3r/CMakeLists.txt # src/slic3r/GUI/GLCanvas3D.cpp # src/slic3r/GUI/GLSelectionRectangle.cpp # src/slic3r/GUI/GUI_Factories.hpp # src/slic3r/GUI/Gizmos/GLGizmoBase.cpp # src/slic3r/GUI/Gizmos/GLGizmoBase.hpp # src/slic3r/GUI/Gizmos/GLGizmoMove.cpp # src/slic3r/GUI/Gizmos/GLGizmoMove.hpp # src/slic3r/GUI/Gizmos/GLGizmoRotate.cpp # src/slic3r/GUI/Gizmos/GLGizmoRotate.hpp # src/slic3r/GUI/MeshUtils.cpp # src/slic3r/GUI/MeshUtils.hpp # src/slic3r/GUI/ObjectDataViewModel.cpp # src/slic3r/GUI/ObjectDataViewModel.hpp # src/slic3r/GUI/Selection.cpp
This commit is contained in:
commit
c549c6afbe
386 changed files with 39391 additions and 33206 deletions
|
@ -361,6 +361,25 @@ constexpr T NaN = std::numeric_limits<T>::quiet_NaN();
|
|||
constexpr float NaNf = NaN<float>;
|
||||
constexpr double NaNd = NaN<double>;
|
||||
|
||||
// Rounding up.
|
||||
// 1.5 is rounded to 2
|
||||
// 1.49 is rounded to 1
|
||||
// 0.5 is rounded to 1,
|
||||
// 0.49 is rounded to 0
|
||||
// -0.5 is rounded to 0,
|
||||
// -0.51 is rounded to -1,
|
||||
// -1.5 is rounded to -1.
|
||||
// -1.51 is rounded to -2.
|
||||
// If input is not a valid float (it is infinity NaN or if it does not fit)
|
||||
// the float to int conversion produces a max int on Intel and +-max int on ARM.
|
||||
template<typename I>
|
||||
inline IntegerOnly<I, I> fast_round_up(double a)
|
||||
{
|
||||
// Why does Java Math.round(0.49999999999999994) return 1?
|
||||
// https://stackoverflow.com/questions/9902968/why-does-math-round0-49999999999999994-return-1
|
||||
return a == 0.49999999999999994 ? I(0) : I(floor(a + 0.5));
|
||||
}
|
||||
|
||||
} // namespace Slic3r
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue