Commit 8da93abc authored by jean-pierre charras's avatar jean-pierre charras

Polygon tools: update Clipper lib to 6.2.1

Minor doc update.
parent b411b240
...@@ -130,10 +130,10 @@ In order to have a working Kicad installtion, you need ...@@ -130,10 +130,10 @@ In order to have a working Kicad installtion, you need
- documentation and translations (they are not included in sources) - documentation and translations (they are not included in sources)
product branch: product branch:
bzr branch lp:kicad kicad_src bzr branch https://code.launchpad.net/~kicad-product-committers/kicad kicad_src
Stable branch: Stable branch:
bzr branch lp:kicad/stable kicad_src bzr branch https://code.launchpad.net/~kicad-product-committers/kicad/stable kicad_src
Components and Footprints libraries Components and Footprints libraries
all (schematic libs, 3D shapes ...) but new footprints libraries (use Download zip tool) all (schematic libs, 3D shapes ...) but new footprints libraries (use Download zip tool)
......
...@@ -14,7 +14,7 @@ boost libraries will be downloaded the first time you build Kicad. ...@@ -14,7 +14,7 @@ boost libraries will be downloaded the first time you build Kicad.
CMake CMake
===== =====
KiCad uses CMake to generate the build files specific for the target platform KiCad uses CMake (version 2.12 or later) to generate the build files specific for the target platform
specified by the developer. This document attempts to define some of the more specified by the developer. This document attempts to define some of the more
common CMake and KiCad build configuration settings. You can use CMake either common CMake and KiCad build configuration settings. You can use CMake either
by the command CMake on or the graphical version ccmake. This document only by the command CMake on or the graphical version ccmake. This document only
...@@ -78,24 +78,6 @@ the wxWidgets library. If you wish to use a custom built wxWidgets library, ...@@ -78,24 +78,6 @@ the wxWidgets library. If you wish to use a custom built wxWidgets library,
set wxWidgets_ROOT_DIR to the correct path. set wxWidgets_ROOT_DIR to the correct path.
wxWidgets_USE_DEBUG (ON/OFF)
----------------------------
Default: OFF
When creating a debug build of KiCad, it is often useful to link against the
debug build of the wxWidgets. To use the debug build of wxWidgets, set
wxWidgets_USE_DEBUG to ON.
wxWidgets_USE_UNICODE (ON/OFF)
------------------------------
Default: ON (wxWidgets 2.9 or later), OFF (older versions)
If your platform supports Unicode and you wish to build KiCad with Unicode
support, set wxWidgets_USE_UNICODE to ON. Please note as of the 2.9 branch
this option is not required.
KiCad Specific Options KiCad Specific Options
====================== ======================
...@@ -114,17 +96,6 @@ WARNING: The KiCad developers strongly advise you to build the bundled copy of ...@@ -114,17 +96,6 @@ WARNING: The KiCad developers strongly advise you to build the bundled copy of
the Boost library, as it is known to work with KiCad. Other versions may the Boost library, as it is known to work with KiCad. Other versions may
contain bugs that may result in KiCad errors. contain bugs that may result in KiCad errors.
USE_WX_GRAPHICS_CONTEXT (ON/OFF)
--------------------------------
Default: OFF
This option is *Experimental*. It enables advanced drawing library code using
wxGraphicsContext and should only be used for testing purposes. Under Windows,
a very recent version of mingw is needed. It also requires wxWidgets to be
built with the --enable-graphics_ctx configuration switch.
USE_IMAGES_IN_MENUS (ON/OFF) USE_IMAGES_IN_MENUS (ON/OFF)
---------------------------- ----------------------------
Default: OFF for OSX, ON for other platforms. Default: OFF for OSX, ON for other platforms.
...@@ -147,20 +118,11 @@ to avoid download and building the dependencies multiple times. ...@@ -147,20 +118,11 @@ to avoid download and building the dependencies multiple times.
KICAD_USER_CONFIG_DIR (PATH) KICAD_USER_CONFIG_DIR (PATH)
---------------------------- ----------------------------
Default: Home directory (Unix-based systems), Application data directory (Windows) Default: ~/.config (Unix-based systems), Application data directory (Windows)
This option specifies where to store user-specific configuration information. This option specifies where to store user-specific configuration information.
KICAD_KEEPCASE (ON/OFF)
-----------------------
Default: ON
If this is OFF, component names are automatically converted to uppercase meaning
they are case insensitive. If it is ON, component names are not changed and
are therefore case sensitive.
USE_WX_OVERLAY (ON/OFF) USE_WX_OVERLAY (ON/OFF)
----------------------- -----------------------
Default: ON for OSX, OFF for other platforms. Default: ON for OSX, OFF for other platforms.
...@@ -192,7 +154,7 @@ KICAD_SCRIPTING_WXPYTHON (ON/OFF) ...@@ -192,7 +154,7 @@ KICAD_SCRIPTING_WXPYTHON (ON/OFF)
Default: OFF Default: OFF
This option enables or disables building wxPython support into the KiCad This option enables or disables building wxPython support into the KiCad
scripting support. Currently only Pcbnew is supported. This option requires scripting support. Currently only Pcbnew has scripting support. This option requires
SWIG, Python, and wxPython to be installed on the system. SWIG, Python, and wxPython to be installed on the system.
......
...@@ -103,16 +103,16 @@ install the wxWidgets library into MinGW then enter the following commands: ...@@ -103,16 +103,16 @@ install the wxWidgets library into MinGW then enter the following commands:
#mkdir Release #mkdir Release
#cd Release #cd Release
#../configure --with-opengl #../configure --enable-monolithic=no --enable-shared=yes --with-opengl
#make #make
If you want to install wxWidgets in MinGW then enter the following commands: If you want to install wxWidgets in MinGW then enter the following commands:
#mkdir Release #mkdir Release
#cd Release #cd Release
#../configure --prefix=/mingw --enable-monolithic=no --disable-shared --with-opengl #../configure --prefix=/mingw --enable-monolithic=no --enable-shared=yes --with-opengl
#make && make install #make && make install
wxWidgets will be statically linked to Kicad, which avoid issus with wxWidgets dlls wxWidgets cannot be statically linked to Kicad.
Download the KiCad Source Code Download the KiCad Source Code
------------------------------ ------------------------------
...@@ -126,16 +126,19 @@ Launchpad repository has two branches for KiCad sources: ...@@ -126,16 +126,19 @@ Launchpad repository has two branches for KiCad sources:
near a stable state) near a stable state)
To download the testing branch: To download the testing branch:
#bzr branch lp:kicad kicad_testing #bzr branch https://code.launchpad.net/~kicad-product-committers/kicad kicad_testing
To download the stable branch: To download the stable branch:
#bzr branch lp:kicad/stable kicad_stable #bzr branch https://code.launchpad.net/~kicad-product-committers/kicad/stable kicad_stable
To download the component and footprint libraries To download the component and footprint libraries:
#bzr branch lp:~kicad-lib-committers/kicad/library kicad_libraries (This branch is a bzr/launchpad import of the Git repository
at https://github.com/KiCad/kicad-library.git.
It has schematic parts and 3D models in it.)
#bzr branch https://code.launchpad.net/~kicad-product-committers/kicad/library kicad_libraries
To download the documentation and translation files: To download the documentation and translation files:
#bzr branch lp:~kicad-developers/kicad/doc kicad_doc #bzr branch https://code.launchpad.net/~kicad-developers/kicad/doc kicad_doc
Create Makefiles with CMake Create Makefiles with CMake
--------------------------- ---------------------------
...@@ -219,7 +222,7 @@ Building the Developer Documentation ...@@ -219,7 +222,7 @@ Building the Developer Documentation
------------------------------------ ------------------------------------
To build the HTML developer documentation, run the following commands: To build the HTML developer documentation, run the following commands:
#cd <kicadSource>/build/debug #cd <kicadSource>/build/release
#make doxygen-docs #make doxygen-docs
The documentation will be created in the <kicadSouce>/Documentation/html The documentation will be created in the <kicadSouce>/Documentation/html
......
This diff is collapsed.
/******************************************************************************* /*******************************************************************************
* * * *
* Author : Angus Johnson * * Author : Angus Johnson *
* Version : 6.1.3a * * Version : 6.2.1 *
* Date : 22 January 2014 * * Date : 31 October 2014 *
* Website : http://www.angusj.com * * Website : http://www.angusj.com *
* Copyright : Angus Johnson 2010-2014 * * Copyright : Angus Johnson 2010-2014 *
* * * *
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#ifndef clipper_hpp #ifndef clipper_hpp
#define clipper_hpp #define clipper_hpp
#define CLIPPER_VERSION "6.1.3" #define CLIPPER_VERSION "6.2.0"
//use_int32: When enabled 32bit ints are used instead of 64bit ints. This //use_int32: When enabled 32bit ints are used instead of 64bit ints. This
//improve performance but coordinate values are limited to the range +/- 46340 //improve performance but coordinate values are limited to the range +/- 46340
...@@ -46,9 +46,8 @@ ...@@ -46,9 +46,8 @@
//use_lines: Enables line clipping. Adds a very minor cost to performance. //use_lines: Enables line clipping. Adds a very minor cost to performance.
//#define use_lines //#define use_lines
//use_deprecated: Enables support for the obsolete OffsetPaths() function //use_deprecated: Enables temporary support for the obsolete functions
//which has been replace with the ClipperOffset class. //#define use_deprecated
#define use_deprecated
#include <vector> #include <vector>
#include <set> #include <set>
...@@ -57,6 +56,7 @@ ...@@ -57,6 +56,7 @@
#include <cstdlib> #include <cstdlib>
#include <ostream> #include <ostream>
#include <functional> #include <functional>
#include <queue>
namespace ClipperLib { namespace ClipperLib {
...@@ -69,11 +69,16 @@ enum PolyType { ptSubject, ptClip }; ...@@ -69,11 +69,16 @@ enum PolyType { ptSubject, ptClip };
enum PolyFillType { pftEvenOdd, pftNonZero, pftPositive, pftNegative }; enum PolyFillType { pftEvenOdd, pftNonZero, pftPositive, pftNegative };
#ifdef use_int32 #ifdef use_int32
typedef int cInt; typedef int cInt;
typedef unsigned int cUInt; static cInt const loRange = 0x7FFF;
static cInt const hiRange = 0x7FFF;
#else #else
typedef signed long long cInt; typedef signed long long cInt;
typedef unsigned long long cUInt; static cInt const loRange = 0x3FFFFFFF;
static cInt const hiRange = 0x3FFFFFFFFFFFFFFFLL;
typedef signed long long long64; //used by Int128 class
typedef unsigned long long ulong64;
#endif #endif
struct IntPoint { struct IntPoint {
...@@ -117,15 +122,12 @@ struct DoublePoint ...@@ -117,15 +122,12 @@ struct DoublePoint
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#ifdef use_xyz #ifdef use_xyz
typedef void (*TZFillCallback)(IntPoint& z1, IntPoint& z2, IntPoint& pt); typedef void (*ZFillCallback)(IntPoint& e1bot, IntPoint& e1top, IntPoint& e2bot, IntPoint& e2top, IntPoint& pt);
#endif #endif
enum InitOptions {ioReverseSolution = 1, ioStrictlySimple = 2, ioPreserveCollinear = 4}; enum InitOptions {ioReverseSolution = 1, ioStrictlySimple = 2, ioPreserveCollinear = 4};
enum JoinType {jtSquare, jtRound, jtMiter}; enum JoinType {jtSquare, jtRound, jtMiter};
enum EndType {etClosedPolygon, etClosedLine, etOpenButt, etOpenSquare, etOpenRound}; enum EndType {etClosedPolygon, etClosedLine, etOpenButt, etOpenSquare, etOpenRound};
#ifdef use_deprecated
enum EndType_ {etClosed, etButt = 2, etSquare, etRound};
#endif
class PolyNode; class PolyNode;
typedef std::vector< PolyNode* > PolyNodes; typedef std::vector< PolyNode* > PolyNodes;
...@@ -134,6 +136,7 @@ class PolyNode ...@@ -134,6 +136,7 @@ class PolyNode
{ {
public: public:
PolyNode(); PolyNode();
virtual ~PolyNode(){};
Path Contour; Path Contour;
PolyNodes Childs; PolyNodes Childs;
PolyNode* Parent; PolyNode* Parent;
...@@ -168,11 +171,6 @@ bool Orientation(const Path &poly); ...@@ -168,11 +171,6 @@ bool Orientation(const Path &poly);
double Area(const Path &poly); double Area(const Path &poly);
int PointInPolygon(const IntPoint &pt, const Path &path); int PointInPolygon(const IntPoint &pt, const Path &path);
#ifdef use_deprecated
void OffsetPaths(const Paths &in_polys, Paths &out_polys,
double delta, JoinType jointype, EndType_ endtype, double limit = 0);
#endif
void SimplifyPolygon(const Path &in_poly, Paths &out_polys, PolyFillType fillType = pftEvenOdd); void SimplifyPolygon(const Path &in_poly, Paths &out_polys, PolyFillType fillType = pftEvenOdd);
void SimplifyPolygons(const Paths &in_polys, Paths &out_polys, PolyFillType fillType = pftEvenOdd); void SimplifyPolygons(const Paths &in_polys, Paths &out_polys, PolyFillType fillType = pftEvenOdd);
void SimplifyPolygons(Paths &polys, PolyFillType fillType = pftEvenOdd); void SimplifyPolygons(Paths &polys, PolyFillType fillType = pftEvenOdd);
...@@ -183,8 +181,7 @@ void CleanPolygons(const Paths& in_polys, Paths& out_polys, double distance = 1. ...@@ -183,8 +181,7 @@ void CleanPolygons(const Paths& in_polys, Paths& out_polys, double distance = 1.
void CleanPolygons(Paths& polys, double distance = 1.415); void CleanPolygons(Paths& polys, double distance = 1.415);
void MinkowskiSum(const Path& pattern, const Path& path, Paths& solution, bool pathIsClosed); void MinkowskiSum(const Path& pattern, const Path& path, Paths& solution, bool pathIsClosed);
void MinkowskiSum(const Path& pattern, const Paths& paths, void MinkowskiSum(const Path& pattern, const Paths& paths, Paths& solution, bool pathIsClosed);
Paths& solution, PolyFillType pathFillType, bool pathIsClosed);
void MinkowskiDiff(const Path& poly1, const Path& poly2, Paths& solution); void MinkowskiDiff(const Path& poly1, const Path& poly2, Paths& solution);
void PolyTreeToPaths(const PolyTree& polytree, Paths& paths); void PolyTreeToPaths(const PolyTree& polytree, Paths& paths);
...@@ -202,7 +199,7 @@ enum EdgeSide { esLeft = 1, esRight = 2}; ...@@ -202,7 +199,7 @@ enum EdgeSide { esLeft = 1, esRight = 2};
//forward declarations (for stuff used internally) ... //forward declarations (for stuff used internally) ...
struct TEdge; struct TEdge;
struct IntersectNode; struct IntersectNode;
struct LocalMinima; struct LocalMinimum;
struct Scanbeam; struct Scanbeam;
struct OutPt; struct OutPt;
struct OutRec; struct OutRec;
...@@ -213,7 +210,6 @@ typedef std::vector < TEdge* > EdgeList; ...@@ -213,7 +210,6 @@ typedef std::vector < TEdge* > EdgeList;
typedef std::vector < Join* > JoinList; typedef std::vector < Join* > JoinList;
typedef std::vector < IntersectNode* > IntersectList; typedef std::vector < IntersectNode* > IntersectList;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
//ClipperBase is the ancestor to the Clipper class. It should not be //ClipperBase is the ancestor to the Clipper class. It should not be
...@@ -236,12 +232,14 @@ protected: ...@@ -236,12 +232,14 @@ protected:
void PopLocalMinima(); void PopLocalMinima();
virtual void Reset(); virtual void Reset();
TEdge* ProcessBound(TEdge* E, bool IsClockwise); TEdge* ProcessBound(TEdge* E, bool IsClockwise);
void InsertLocalMinima(LocalMinima *newLm);
void DoMinimaLML(TEdge* E1, TEdge* E2, bool IsClosed); void DoMinimaLML(TEdge* E1, TEdge* E2, bool IsClosed);
TEdge* DescendToMin(TEdge *&E); TEdge* DescendToMin(TEdge *&E);
void AscendToMax(TEdge *&E, bool Appending, bool IsClosed); void AscendToMax(TEdge *&E, bool Appending, bool IsClosed);
LocalMinima *m_CurrentLM;
LocalMinima *m_MinimaList; typedef std::vector<LocalMinimum> MinimaList;
MinimaList::iterator m_CurrentLM;
MinimaList m_MinimaList;
bool m_UseFullRange; bool m_UseFullRange;
EdgeList m_edges; EdgeList m_edges;
bool m_PreserveCollinear; bool m_PreserveCollinear;
...@@ -268,7 +266,7 @@ public: ...@@ -268,7 +266,7 @@ public:
void StrictlySimple(bool value) {m_StrictSimple = value;}; void StrictlySimple(bool value) {m_StrictSimple = value;};
//set the callback function for z value filling on intersections (otherwise Z is 0) //set the callback function for z value filling on intersections (otherwise Z is 0)
#ifdef use_xyz #ifdef use_xyz
void ZFillFunction(TZFillCallback zFillFunc); void ZFillFunction(ZFillCallback zFillFunc);
#endif #endif
protected: protected:
void Reset(); void Reset();
...@@ -279,7 +277,8 @@ private: ...@@ -279,7 +277,8 @@ private:
JoinList m_GhostJoins; JoinList m_GhostJoins;
IntersectList m_IntersectList; IntersectList m_IntersectList;
ClipType m_ClipType; ClipType m_ClipType;
std::set< cInt, std::greater<cInt> > m_Scanbeam; typedef std::priority_queue<cInt> ScanbeamList;
ScanbeamList m_Scanbeam;
TEdge *m_ActiveEdges; TEdge *m_ActiveEdges;
TEdge *m_SortedEdges; TEdge *m_SortedEdges;
bool m_ExecuteLocked; bool m_ExecuteLocked;
...@@ -289,7 +288,7 @@ private: ...@@ -289,7 +288,7 @@ private:
bool m_UsingPolyTree; bool m_UsingPolyTree;
bool m_StrictSimple; bool m_StrictSimple;
#ifdef use_xyz #ifdef use_xyz
TZFillCallback m_ZFill; //custom callback ZFillCallback m_ZFill; //custom callback
#endif #endif
void SetWindingCount(TEdge& edge); void SetWindingCount(TEdge& edge);
bool IsEvenOddFillType(const TEdge& edge) const; bool IsEvenOddFillType(const TEdge& edge) const;
...@@ -308,21 +307,19 @@ private: ...@@ -308,21 +307,19 @@ private:
bool IsTopHorz(const cInt XPos); bool IsTopHorz(const cInt XPos);
void SwapPositionsInAEL(TEdge *edge1, TEdge *edge2); void SwapPositionsInAEL(TEdge *edge1, TEdge *edge2);
void DoMaxima(TEdge *e); void DoMaxima(TEdge *e);
void PrepareHorzJoins(TEdge* horzEdge, bool isTopOfScanbeam);
void ProcessHorizontals(bool IsTopOfScanbeam); void ProcessHorizontals(bool IsTopOfScanbeam);
void ProcessHorizontal(TEdge *horzEdge, bool isTopOfScanbeam); void ProcessHorizontal(TEdge *horzEdge, bool isTopOfScanbeam);
void AddLocalMaxPoly(TEdge *e1, TEdge *e2, const IntPoint &pt); void AddLocalMaxPoly(TEdge *e1, TEdge *e2, const IntPoint &pt);
OutPt* AddLocalMinPoly(TEdge *e1, TEdge *e2, const IntPoint &pt); OutPt* AddLocalMinPoly(TEdge *e1, TEdge *e2, const IntPoint &pt);
OutRec* GetOutRec(int idx); OutRec* GetOutRec(int idx);
void AppendPolygon(TEdge *e1, TEdge *e2); void AppendPolygon(TEdge *e1, TEdge *e2);
void IntersectEdges(TEdge *e1, TEdge *e2, void IntersectEdges(TEdge *e1, TEdge *e2, IntPoint &pt);
const IntPoint &pt, bool protect = false);
OutRec* CreateOutRec(); OutRec* CreateOutRec();
OutPt* AddOutPt(TEdge *e, const IntPoint &pt); OutPt* AddOutPt(TEdge *e, const IntPoint &pt);
void DisposeAllOutRecs(); void DisposeAllOutRecs();
void DisposeOutRec(PolyOutList::size_type index); void DisposeOutRec(PolyOutList::size_type index);
bool ProcessIntersections(const cInt botY, const cInt topY); bool ProcessIntersections(const cInt topY);
void BuildIntersectList(const cInt botY, const cInt topY); void BuildIntersectList(const cInt topY);
void ProcessIntersectList(); void ProcessIntersectList();
void ProcessEdgesAtTopOfScanbeam(const cInt topY); void ProcessEdgesAtTopOfScanbeam(const cInt topY);
void BuildResult(Paths& polys); void BuildResult(Paths& polys);
...@@ -344,7 +341,7 @@ private: ...@@ -344,7 +341,7 @@ private:
void FixupFirstLefts1(OutRec* OldOutRec, OutRec* NewOutRec); void FixupFirstLefts1(OutRec* OldOutRec, OutRec* NewOutRec);
void FixupFirstLefts2(OutRec* OldOutRec, OutRec* NewOutRec); void FixupFirstLefts2(OutRec* OldOutRec, OutRec* NewOutRec);
#ifdef use_xyz #ifdef use_xyz
void SetZ(IntPoint& pt, TEdge& e); void SetZ(IntPoint& pt, TEdge& e1, TEdge& e2);
#endif #endif
}; };
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment