Convincing ClipperLib to use Slic3r's own Point type internally.

This commit is contained in:
Vojtech Bubnik 2021-04-21 20:15:49 +02:00
parent a15c16d40d
commit 8d0950ce12
14 changed files with 74 additions and 83 deletions

View file

@ -54,7 +54,7 @@ namespace Slic3r {
template<class Tout = double, class = FloatingOnly<Tout>, int...EigenArgs>
inline constexpr Eigen::Matrix<Tout, 2, EigenArgs...> unscaled(
const ClipperLib::IntPoint &v) noexcept
const Slic3r::ClipperLib::IntPoint &v) noexcept
{
return Eigen::Matrix<Tout, 2, EigenArgs...>{unscaled<Tout>(v.x()),
unscaled<Tout>(v.y())};
@ -616,7 +616,7 @@ void arrange(ArrangePolygons & arrangables,
const BedT & bed,
const ArrangeParams & params)
{
namespace clppr = ClipperLib;
namespace clppr = Slic3r::ClipperLib;
std::vector<Item> items, fixeditems;
items.reserve(arrangables.size());

View file

@ -23,6 +23,8 @@ add_library(libslic3r STATIC
BridgeDetector.hpp
Brim.cpp
Brim.hpp
clipper.cpp
clipper.hpp
ClipperUtils.cpp
ClipperUtils.hpp
Config.cpp

View file

@ -8,9 +8,9 @@
#include "Surface.hpp"
// import these wherever we're included
using ClipperLib::jtMiter;
using ClipperLib::jtRound;
using ClipperLib::jtSquare;
using Slic3r::ClipperLib::jtMiter;
using Slic3r::ClipperLib::jtRound;
using Slic3r::ClipperLib::jtSquare;
#define CLIPPERUTILS_UNSAFE_OFFSET

View file

@ -22,12 +22,14 @@
#pragma warning(pop)
#endif // _MSC_VER
namespace ClipperLib {
class PolyNode;
using PolyNodes = std::vector<PolyNode*>;
}
namespace Slic3r {
namespace Slic3r { namespace Geometry {
namespace ClipperLib {
class PolyNode;
using PolyNodes = std::vector<PolyNode*>;
}
namespace Geometry {
// Generic result of an orientation predicate.
enum Orientation
@ -530,6 +532,6 @@ inline bool is_rotation_ninety_degrees(const Vec3d &rotation)
return is_rotation_ninety_degrees(rotation.x()) && is_rotation_ninety_degrees(rotation.y()) && is_rotation_ninety_degrees(rotation.z());
}
} }
} } // namespace Slicer::Geometry
#endif

View file

@ -114,7 +114,7 @@
#include <cereal/types/base_class.hpp>
#include <clipper/clipper_z.hpp>
#include <clipper/clipper.hpp>
#include "clipper.hpp"
#include "BoundingBox.hpp"
#include "ClipperUtils.hpp"
#include "Config.hpp"
@ -129,8 +129,6 @@
#include "libslic3r.h"
#include "libslic3r_version.h"
#include "clipper.hpp"
#include <Shiny/Shiny.h>
#include <admesh/stl.h>