mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-17 10:32:20 +00:00
Fix issue that Geometry::deg2rad() do calculation in the same type as the parameter, which means if the parameter is int then you lose all the precision
This commit is contained in:
@@ -298,7 +298,11 @@ bool directions_perpendicular(double angle1, double angle2, double max_diff = 0)
|
||||
template<class T> bool contains(const std::vector<T> &vector, const Point &point);
|
||||
template<typename T> T rad2deg(T angle) { return T(180.0) * angle / T(PI); }
|
||||
double rad2deg_dir(double angle);
|
||||
template<typename T> constexpr T deg2rad(const T angle) { return T(PI) * angle / T(180.0); }
|
||||
template<typename T> constexpr T deg2rad(const T angle)
|
||||
{
|
||||
static_assert(std::is_floating_point<T>::value, "Why do you want to calculate angle in integer?");
|
||||
return T(PI) * angle / T(180.0);
|
||||
}
|
||||
template<typename T> T angle_to_0_2PI(T angle)
|
||||
{
|
||||
static const T TWO_PI = T(2) * T(PI);
|
||||
|
||||
@@ -2399,7 +2399,7 @@ private:
|
||||
return line.distance(p);
|
||||
}
|
||||
};
|
||||
const double TriangleCursor::facet_angle_limit = cos(Geometry::deg2rad(5));
|
||||
const double TriangleCursor::facet_angle_limit = cos(Geometry::deg2rad(5.0));
|
||||
|
||||
|
||||
// Remap painting data from source mesh to target mesh using spatial mapping.
|
||||
|
||||
Reference in New Issue
Block a user