mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-01 06:42:05 +08:00
Added epsilon to Slic3r::Geometry; added _equiv for comparing two items that have operator- overloaded.
This commit is contained in:
parent
f29768ff8e
commit
3f3de067f8
@ -1,6 +1,7 @@
|
|||||||
#ifndef SLIC3R_TEST_DATA_HPP
|
#ifndef SLIC3R_TEST_DATA_HPP
|
||||||
#include "Point.hpp"
|
#include "Point.hpp"
|
||||||
#include "TriangleMesh.hpp"
|
#include "TriangleMesh.hpp"
|
||||||
|
#include "Geometry.hpp"
|
||||||
|
|
||||||
namespace Slic3r { namespace Test {
|
namespace Slic3r { namespace Test {
|
||||||
|
|
||||||
@ -24,12 +25,16 @@ enum class TestMesh {
|
|||||||
two_hollow_squares
|
two_hollow_squares
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Port of Slic3r::Test::Mesh
|
/// Port of Slic3r::Test::mesh
|
||||||
/// Basic cubes/boxes should call TriangleMesh::make_cube() directly and rescale it
|
/// Basic cubes/boxes should call TriangleMesh::make_cube() directly and rescale/translate it
|
||||||
TriangleMesh mesh(TestMesh m);
|
TriangleMesh mesh(TestMesh m);
|
||||||
|
|
||||||
TriangleMesh mesh(TestMesh m, Pointf3 translate, Pointf3 scale = Pointf3(1.0, 1.0, 1.0));
|
TriangleMesh mesh(TestMesh m, Pointf3 translate, Pointf3 scale = Pointf3(1.0, 1.0, 1.0));
|
||||||
|
|
||||||
|
/// Templated function to see if two values are equivalent (+/- epsilon)
|
||||||
|
template <typename T, typename U>
|
||||||
|
bool _equiv(T a, U b) { return abs(a - b) < Slic3r::Geometry::epsilon; }
|
||||||
|
|
||||||
} } // namespace Slic3r::Test
|
} } // namespace Slic3r::Test
|
||||||
|
|
||||||
#endif // SLIC3R_TEST_DATA_HPP
|
#endif // SLIC3R_TEST_DATA_HPP
|
||||||
|
@ -25,6 +25,10 @@ double rad2deg(double angle);
|
|||||||
double rad2deg_dir(double angle);
|
double rad2deg_dir(double angle);
|
||||||
double deg2rad(double angle);
|
double deg2rad(double angle);
|
||||||
|
|
||||||
|
/// Epsilon value
|
||||||
|
constexpr double epsilon { 1e-4 };
|
||||||
|
constexpr coord_t scaled_epsilon { static_cast<coord_t>(epsilon / SCALING_FACTOR) };
|
||||||
|
|
||||||
double linint(double value, double oldmin, double oldmax, double newmin, double newmax);
|
double linint(double value, double oldmin, double oldmax, double newmin, double newmax);
|
||||||
bool arrange(
|
bool arrange(
|
||||||
// input
|
// input
|
||||||
|
Loading…
x
Reference in New Issue
Block a user