mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-30 12:11:15 -06:00
Introduction of ClipperLib_Z: The Clipper library compiled with support
of the Z coordinate, compiled in the ClipperLib_Z namespace. Update of Lukas's new brim clipping: All the brim contours are now clipped by the ClipperLib_Z library in one shot.
This commit is contained in:
parent
bb896b4c13
commit
ea8b6262cf
7 changed files with 148 additions and 46 deletions
|
|
@ -4,4 +4,6 @@ cmake_minimum_required(VERSION 2.6)
|
|||
add_library(clipper STATIC
|
||||
clipper.cpp
|
||||
clipper.hpp
|
||||
clipper_z.cpp
|
||||
clipper_z.hpp
|
||||
)
|
||||
|
|
|
|||
|
|
@ -51,7 +51,11 @@
|
|||
#include <Shiny/Shiny.h>
|
||||
#include <libslic3r/Int128.hpp>
|
||||
|
||||
#ifdef use_xyz
|
||||
namespace ClipperLib_Z {
|
||||
#else /* use_xyz */
|
||||
namespace ClipperLib {
|
||||
#endif /* use_xyz */
|
||||
|
||||
static double const pi = 3.141592653589793238;
|
||||
static double const two_pi = pi *2;
|
||||
|
|
@ -1616,7 +1620,7 @@ void Clipper::SetZ(IntPoint& pt, TEdge& e1, TEdge& e2)
|
|||
else if (pt == e1.Top) pt.Z = e1.Top.Z;
|
||||
else if (pt == e2.Bot) pt.Z = e2.Bot.Z;
|
||||
else if (pt == e2.Top) pt.Z = e2.Top.Z;
|
||||
else (*m_ZFill)(e1.Bot, e1.Top, e2.Bot, e2.Top, pt);
|
||||
else m_ZFill(e1.Bot, e1.Top, e2.Bot, e2.Top, pt);
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
#define clipper_hpp
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <functional>
|
||||
|
||||
#define CLIPPER_VERSION "6.2.6"
|
||||
|
||||
|
|
@ -56,7 +57,11 @@
|
|||
#include <functional>
|
||||
#include <queue>
|
||||
|
||||
#ifdef use_xyz
|
||||
namespace ClipperLib_Z {
|
||||
#else /* use_xyz */
|
||||
namespace ClipperLib {
|
||||
#endif /* use_xyz */
|
||||
|
||||
enum ClipType { ctIntersection, ctUnion, ctDifference, ctXor };
|
||||
enum PolyType { ptSubject, ptClip };
|
||||
|
|
@ -114,7 +119,7 @@ struct DoublePoint
|
|||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifdef use_xyz
|
||||
typedef void (*ZFillCallback)(IntPoint& e1bot, IntPoint& e1top, IntPoint& e2bot, IntPoint& e2top, IntPoint& pt);
|
||||
typedef std::function<void(const IntPoint& e1bot, const IntPoint& e1top, const IntPoint& e2bot, const IntPoint& e2top, IntPoint& pt)> ZFillCallback;
|
||||
#endif
|
||||
|
||||
enum InitOptions {ioReverseSolution = 1, ioStrictlySimple = 2, ioPreserveCollinear = 4};
|
||||
|
|
|
|||
7
src/clipper/clipper_z.cpp
Normal file
7
src/clipper/clipper_z.cpp
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
// Hackish wrapper around the ClipperLib library to compile the Clipper library with the Z support.
|
||||
|
||||
// Enable the Z coordinate support.
|
||||
#define use_xyz
|
||||
|
||||
// and let it compile
|
||||
#include "clipper.cpp"
|
||||
18
src/clipper/clipper_z.hpp
Normal file
18
src/clipper/clipper_z.hpp
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// Hackish wrapper around the ClipperLib library to compile the Clipper library with the Z support.
|
||||
|
||||
#ifndef clipper_z_hpp
|
||||
#ifdef clipper_hpp
|
||||
#error "You should include the clipper_z.hpp first"
|
||||
#endif
|
||||
|
||||
#define clipper_z_hpp
|
||||
|
||||
// Enable the Z coordinate support.
|
||||
#define use_xyz
|
||||
|
||||
#include "clipper.hpp"
|
||||
|
||||
#undef clipper_hpp
|
||||
#undef use_xyz
|
||||
|
||||
#endif clipper_z_hpp
|
||||
Loading…
Add table
Add a link
Reference in a new issue