clipper.hpp | clipper.hpp | |||
---|---|---|---|---|
/************************************************************************** ***** | /************************************************************************** ***** | |||
* * | * * | |||
* Author : Angus Johnson * | * Author : Angus Johnson * | |||
* Version : 6.1.2 | * Version : 6.1.3 | |||
* | * | |||
* Date : 15 December 2013 | * Date : 19 January 2014 | |||
* | * | |||
* Website : http://www.angusj.com * | * Website : http://www.angusj.com * | |||
* Copyright : Angus Johnson 2010-2013 * | * Copyright : Angus Johnson 2010-2014 * | |||
* * | * * | |||
* License: * | * License: * | |||
* Use, modification & distribution is subject to Boost Software License Ver 1. * | * Use, modification & distribution is subject to Boost Software License Ver 1. * | |||
* http://www.boost.org/LICENSE_1_0.txt * | * http://www.boost.org/LICENSE_1_0.txt * | |||
* * | * * | |||
* Attributions: * | * Attributions: * | |||
* The code in this library is an extension of Bala Vatti's clipping algorit hm: * | * The code in this library is an extension of Bala Vatti's clipping algorit hm: * | |||
* "A generic solution to polygon clipping" * | * "A generic solution to polygon clipping" * | |||
* Communications of the ACM, Vol 35, Issue 7 (July 1992) pp 56-63. * | * Communications of the ACM, Vol 35, Issue 7 (July 1992) pp 56-63. * | |||
* http://portal.acm.org/citation.cfm?id=129906 * | * http://portal.acm.org/citation.cfm?id=129906 * | |||
skipping to change at line 37 | skipping to change at line 37 | |||
* ASME 2005 International Design Engineering Technical Conferences * | * ASME 2005 International Design Engineering Technical Conferences * | |||
* and Computers and Information in Engineering Conference (IDETC/CIE2005) * | * and Computers and Information in Engineering Conference (IDETC/CIE2005) * | |||
* September 24-28, 2005 , Long Beach, California, USA * | * September 24-28, 2005 , Long Beach, California, USA * | |||
* http://www.me.berkeley.edu/~mcmains/pubs/DAC05OffsetPolygon.pdf * | * http://www.me.berkeley.edu/~mcmains/pubs/DAC05OffsetPolygon.pdf * | |||
* * | * * | |||
*************************************************************************** ****/ | *************************************************************************** ****/ | |||
#ifndef clipper_hpp | #ifndef clipper_hpp | |||
#define clipper_hpp | #define clipper_hpp | |||
#define CLIPPER_VERSION "6.1.2" | #define CLIPPER_VERSION "6.1.3" | |||
//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 +/- 46 340 | //improve performance but coordinate values are limited to the range +/- 46 340 | |||
//#define use_int32 | //#define use_int32 | |||
//use_xyz: adds a Z member to IntPoint. Adds a minor cost to perfomance. | //use_xyz: adds a Z member to IntPoint. Adds a minor cost to perfomance. | |||
//#define use_xyz | //#define use_xyz | |||
//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 | |||
skipping to change at line 169 | skipping to change at line 169 | |||
PolyNode* GetFirst() const; | PolyNode* GetFirst() const; | |||
void Clear(); | void Clear(); | |||
int Total() const; | int Total() const; | |||
private: | private: | |||
PolyNodes AllNodes; | PolyNodes AllNodes; | |||
friend class Clipper; //to access AllNodes | friend class Clipper; //to access AllNodes | |||
}; | }; | |||
bool Orientation(const Path &poly); | bool Orientation(const Path &poly); | |||
double Area(const Path &poly); | double Area(const Path &poly); | |||
int PointInPolygon(const IntPoint &pt, const Path &path); | ||||
#ifdef use_deprecated | #ifdef use_deprecated | |||
void OffsetPaths(const Paths &in_polys, Paths &out_polys, | void OffsetPaths(const Paths &in_polys, Paths &out_polys, | |||
double delta, JoinType jointype, EndType_ endtype, double limit = 0); | double delta, JoinType jointype, EndType_ endtype, double limit = 0); | |||
#endif | #endif | |||
void SimplifyPolygon(const Path &in_poly, Paths &out_polys, PolyFillType fi llType = pftEvenOdd); | void SimplifyPolygon(const Path &in_poly, Paths &out_polys, PolyFillType fi llType = 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); | |||
void CleanPolygon(const Path& in_poly, Path& out_poly, double distance = 1. 415); | void CleanPolygon(const Path& in_poly, Path& out_poly, double distance = 1. 415); | |||
void CleanPolygon(Path& poly, double distance = 1.415); | void CleanPolygon(Path& poly, double distance = 1.415); | |||
void CleanPolygons(const Paths& in_polys, Paths& out_polys, double distance = 1.415); | void CleanPolygons(const Paths& in_polys, Paths& out_polys, double distance = 1.415); | |||
void CleanPolygons(Paths& polys, double distance = 1.415); | void CleanPolygons(Paths& polys, double distance = 1.415); | |||
void MinkowskiSum(const Path& poly, const Path& path, Paths& solution, bool | void MinkowskiSum(const Path& pattern, const Path& path, Paths& solution, b | |||
isClosed); | ool pathIsClosed); | |||
void MinkowskiDiff(const Path& poly, const Path& path, Paths& solution, boo | void MinkowskiSum(const Path& pattern, const Paths& paths, | |||
l isClosed); | Paths& solution, PolyFillType pathFillType, bool pathIsClosed); | |||
void MinkowskiDiff(const Path& poly1, const Path& poly2, Paths& solution); | ||||
void PolyTreeToPaths(const PolyTree& polytree, Paths& paths); | void PolyTreeToPaths(const PolyTree& polytree, Paths& paths); | |||
void ClosedPathsFromPolyTree(const PolyTree& polytree, Paths& paths); | void ClosedPathsFromPolyTree(const PolyTree& polytree, Paths& paths); | |||
void OpenPathsFromPolyTree(PolyTree& polytree, Paths& paths); | void OpenPathsFromPolyTree(PolyTree& polytree, Paths& paths); | |||
void ReversePath(Path& p); | void ReversePath(Path& p); | |||
void ReversePaths(Paths& p); | void ReversePaths(Paths& p); | |||
struct IntRect { cInt left; cInt top; cInt right; cInt bottom; }; | struct IntRect { cInt left; cInt top; cInt right; cInt bottom; }; | |||
skipping to change at line 261 | skipping to change at line 264 | |||
Clipper(int initOptions = 0); | Clipper(int initOptions = 0); | |||
~Clipper(); | ~Clipper(); | |||
bool Execute(ClipType clipType, | bool Execute(ClipType clipType, | |||
Paths &solution, | Paths &solution, | |||
PolyFillType subjFillType = pftEvenOdd, | PolyFillType subjFillType = pftEvenOdd, | |||
PolyFillType clipFillType = pftEvenOdd); | PolyFillType clipFillType = pftEvenOdd); | |||
bool Execute(ClipType clipType, | bool Execute(ClipType clipType, | |||
PolyTree &polytree, | PolyTree &polytree, | |||
PolyFillType subjFillType = pftEvenOdd, | PolyFillType subjFillType = pftEvenOdd, | |||
PolyFillType clipFillType = pftEvenOdd); | PolyFillType clipFillType = pftEvenOdd); | |||
void Clear(); | ||||
bool ReverseSolution() {return m_ReverseOutput;}; | bool ReverseSolution() {return m_ReverseOutput;}; | |||
void ReverseSolution(bool value) {m_ReverseOutput = value;}; | void ReverseSolution(bool value) {m_ReverseOutput = value;}; | |||
bool StrictlySimple() {return m_StrictSimple;}; | bool StrictlySimple() {return m_StrictSimple;}; | |||
void StrictlySimple(bool value) {m_StrictSimple = value;}; | void StrictlySimple(bool value) {m_StrictSimple = value;}; | |||
//set the callback function for z value filling on intersections (otherwi se Z is 0) | //set the callback function for z value filling on intersections (otherwi se Z is 0) | |||
#ifdef use_xyz | #ifdef use_xyz | |||
void ZFillFunction(TZFillCallback zFillFunc); | void ZFillFunction(TZFillCallback zFillFunc); | |||
#endif | #endif | |||
protected: | protected: | |||
void Reset(); | void Reset(); | |||
End of changes. 6 change blocks. | ||||
11 lines changed or deleted | 12 lines changed or added | |||