Really fix build for msvc
This commit is contained in:
parent
c74e6513d9
commit
aff1863aed
2 changed files with 25 additions and 22 deletions
|
@ -46,11 +46,12 @@ template<class S> struct NfpImpl<S, NfpLevel::CONVEX_ONLY>
|
|||
|
||||
namespace Slic3r {
|
||||
|
||||
template<class Tout = double, class = FloatingOnly<Tout>>
|
||||
inline SLIC3R_CONSTEXPR EigenVec<Tout, 2> unscaled(
|
||||
template<class Tout = double, class = FloatingOnly<Tout>, int...EigenArgs>
|
||||
inline SLIC3R_CONSTEXPR Eigen::Matrix<Tout, 2, EigenArgs...> unscaled(
|
||||
const ClipperLib::IntPoint &v) SLIC3R_NOEXCEPT
|
||||
{
|
||||
return EigenVec<Tout, 2>{unscaled<Tout>(v.X), unscaled<Tout>(v.Y)};
|
||||
return Eigen::Matrix<Tout, 2, EigenArgs...>{unscaled<Tout>(v.X),
|
||||
unscaled<Tout>(v.Y)};
|
||||
}
|
||||
|
||||
namespace arrangement {
|
||||
|
@ -139,7 +140,7 @@ protected:
|
|||
ItemGroup m_remaining; // Remaining items (m_items at the beginning)
|
||||
ItemGroup m_items; // The items to be packed
|
||||
|
||||
template<class T, class = ArithmeticOnly<T>> double norm(T val)
|
||||
template<class T> ArithmeticOnly<T, double> norm(T val)
|
||||
{
|
||||
return double(val) / m_norm;
|
||||
}
|
||||
|
|
|
@ -260,18 +260,14 @@ template<class I> struct is_scaled_coord
|
|||
};
|
||||
|
||||
// Meta predicates for floating, 'scaled coord' and generic arithmetic types
|
||||
template<class T>
|
||||
using FloatingOnly = enable_if_t<std::is_floating_point<T>::value, T>;
|
||||
template<class T, class O = T>
|
||||
using FloatingOnly = enable_if_t<std::is_floating_point<T>::value, O>;
|
||||
|
||||
template<class T>
|
||||
using ScaledCoordOnly = enable_if_t<is_scaled_coord<T>::value, T>;
|
||||
template<class T, class O = T>
|
||||
using ScaledCoordOnly = enable_if_t<is_scaled_coord<T>::value, O>;
|
||||
|
||||
template<class T>
|
||||
using ArithmeticOnly = enable_if_t<std::is_arithmetic<T>::value, T>;
|
||||
|
||||
// A shorter form for a generic Eigen vector which is widely used in PrusaSlicer
|
||||
template<class T, int N>
|
||||
using EigenVec = Eigen::Matrix<T, N, 1, Eigen::DontAlign>;
|
||||
template<class T, class O = T>
|
||||
using ArithmeticOnly = enable_if_t<std::is_arithmetic<T>::value, O>;
|
||||
|
||||
// Semantics are the following:
|
||||
// Upscaling (scaled()): only from floating point types (or Vec) to either
|
||||
|
@ -282,7 +278,7 @@ using EigenVec = Eigen::Matrix<T, N, 1, Eigen::DontAlign>;
|
|||
template<class Tout,
|
||||
class Tin,
|
||||
class = FloatingOnly<Tin>>
|
||||
inline SLIC3R_CONSTEXPR FloatingOnly<Tout> scaled(const Tin &v) SLIC3R_NOEXCEPT
|
||||
inline constexpr FloatingOnly<Tout> scaled(const Tin &v) noexcept
|
||||
{
|
||||
return Tout(v / Tin(SCALING_FACTOR));
|
||||
}
|
||||
|
@ -292,15 +288,20 @@ inline SLIC3R_CONSTEXPR FloatingOnly<Tout> scaled(const Tin &v) SLIC3R_NOEXCEPT
|
|||
// it can be different for integers but it does not have to be. Using
|
||||
// std::round means loosing noexcept and constexpr modifiers
|
||||
template<class Tout = coord_t, class Tin, class = FloatingOnly<Tin>>
|
||||
inline SLIC3R_CONSTEXPR ScaledCoordOnly<Tout> scaled(const Tin &v) SLIC3R_NOEXCEPT
|
||||
inline constexpr ScaledCoordOnly<Tout> scaled(const Tin &v) noexcept
|
||||
{
|
||||
//return static_cast<Tout>(std::round(v / SCALING_FACTOR));
|
||||
return Tout(v / Tin(SCALING_FACTOR));
|
||||
}
|
||||
|
||||
// Conversion for Eigen vectors (N dimensional points)
|
||||
template<class Tout = coord_t, class Tin, int N, class = FloatingOnly<Tin>>
|
||||
inline EigenVec<ArithmeticOnly<Tout>, N> scaled(const EigenVec<Tin, N> &v)
|
||||
template<class Tout = coord_t,
|
||||
class Tin,
|
||||
int N,
|
||||
class = FloatingOnly<Tin>,
|
||||
int...EigenArgs>
|
||||
inline Eigen::Matrix<ArithmeticOnly<Tout>, N, EigenArgs...>
|
||||
scaled(const Eigen::Matrix<Tin, N, EigenArgs...> &v)
|
||||
{
|
||||
return (v / SCALING_FACTOR).template cast<Tout>();
|
||||
}
|
||||
|
@ -310,7 +311,7 @@ template<class Tout = double,
|
|||
class Tin,
|
||||
class = ArithmeticOnly<Tin>,
|
||||
class = FloatingOnly<Tout>>
|
||||
inline SLIC3R_CONSTEXPR Tout unscaled(const Tin &v) SLIC3R_NOEXCEPT
|
||||
inline constexpr Tout unscaled(const Tin &v) noexcept
|
||||
{
|
||||
return Tout(v * Tout(SCALING_FACTOR));
|
||||
}
|
||||
|
@ -321,9 +322,10 @@ template<class Tout = double,
|
|||
class Tin,
|
||||
int N,
|
||||
class = ArithmeticOnly<Tin>,
|
||||
class = FloatingOnly<Tout>>
|
||||
inline SLIC3R_CONSTEXPR EigenVec<Tout, N> unscaled(
|
||||
const EigenVec<Tin, N> &v) SLIC3R_NOEXCEPT
|
||||
class = FloatingOnly<Tout>,
|
||||
int...EigenArgs>
|
||||
inline constexpr Eigen::Matrix<Tout, N, EigenArgs...>
|
||||
unscaled(const Eigen::Matrix<Tin, N, EigenArgs...> &v) noexcept
|
||||
{
|
||||
return v.template cast<Tout>() * SCALING_FACTOR;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue