python-libnest2d 0.1.0__cp39-cp39-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,406 @@
1
+ /*******************************************************************************
2
+ * *
3
+ * Author : Angus Johnson *
4
+ * Version : 6.4.2 *
5
+ * Date : 27 February 2017 *
6
+ * Website : http://www.angusj.com *
7
+ * Copyright : Angus Johnson 2010-2017 *
8
+ * *
9
+ * License: *
10
+ * Use, modification & distribution is subject to Boost Software License Ver 1. *
11
+ * http://www.boost.org/LICENSE_1_0.txt *
12
+ * *
13
+ * Attributions: *
14
+ * The code in this library is an extension of Bala Vatti's clipping algorithm: *
15
+ * "A generic solution to polygon clipping" *
16
+ * Communications of the ACM, Vol 35, Issue 7 (July 1992) pp 56-63. *
17
+ * http://portal.acm.org/citation.cfm?id=129906 *
18
+ * *
19
+ * Computer graphics and geometric modeling: implementation and algorithms *
20
+ * By Max K. Agoston *
21
+ * Springer; 1 edition (January 4, 2005) *
22
+ * http://books.google.com/books?q=vatti+clipping+agoston *
23
+ * *
24
+ * See also: *
25
+ * "Polygon Offsetting by Computing Winding Numbers" *
26
+ * Paper no. DETC2005-85513 pp. 565-575 *
27
+ * ASME 2005 International Design Engineering Technical Conferences *
28
+ * and Computers and Information in Engineering Conference (IDETC/CIE2005) *
29
+ * September 24-28, 2005 , Long Beach, California, USA *
30
+ * http://www.me.berkeley.edu/~mcmains/pubs/DAC05OffsetPolygon.pdf *
31
+ * *
32
+ *******************************************************************************/
33
+
34
+ #ifndef clipper_hpp
35
+ #define clipper_hpp
36
+
37
+ #define CLIPPER_VERSION "6.4.2"
38
+
39
+ //use_int32: When enabled 32bit ints are used instead of 64bit ints. This
40
+ //improve performance but coordinate values are limited to the range +/- 46340
41
+ //#define use_int32
42
+
43
+ //use_xyz: adds a Z member to IntPoint. Adds a minor cost to perfomance.
44
+ //#define use_xyz
45
+
46
+ //use_lines: Enables line clipping. Adds a very minor cost to performance.
47
+ #define use_lines
48
+
49
+ //use_deprecated: Enables temporary support for the obsolete functions
50
+ //#define use_deprecated
51
+
52
+ #include <vector>
53
+ #include <list>
54
+ #include <set>
55
+ #include <stdexcept>
56
+ #include <cstring>
57
+ #include <cstdlib>
58
+ #include <ostream>
59
+ #include <functional>
60
+ #include <queue>
61
+
62
+ namespace ClipperLib {
63
+
64
+ enum ClipType { ctIntersection, ctUnion, ctDifference, ctXor };
65
+ enum PolyType { ptSubject, ptClip };
66
+ //By far the most widely used winding rules for polygon filling are
67
+ //EvenOdd & NonZero (GDI, GDI+, XLib, OpenGL, Cairo, AGG, Quartz, SVG, Gr32)
68
+ //Others rules include Positive, Negative and ABS_GTR_EQ_TWO (only in OpenGL)
69
+ //see http://glprogramming.com/red/chapter11.html
70
+ enum PolyFillType { pftEvenOdd, pftNonZero, pftPositive, pftNegative };
71
+
72
+ #ifdef use_int32
73
+ typedef int cInt;
74
+ static cInt const loRange = 0x7FFF;
75
+ static cInt const hiRange = 0x7FFF;
76
+ #else
77
+ typedef signed long long cInt;
78
+ static cInt const loRange = 0x3FFFFFFF;
79
+ static cInt const hiRange = 0x3FFFFFFFFFFFFFFFLL;
80
+ typedef signed long long long64; //used by Int128 class
81
+ typedef unsigned long long ulong64;
82
+
83
+ #endif
84
+
85
+ struct IntPoint {
86
+ cInt X;
87
+ cInt Y;
88
+ #ifdef use_xyz
89
+ cInt Z;
90
+ IntPoint(cInt x = 0, cInt y = 0, cInt z = 0): X(x), Y(y), Z(z) {};
91
+ #else
92
+ IntPoint(cInt x = 0, cInt y = 0): X(x), Y(y) {};
93
+ #endif
94
+
95
+ friend inline bool operator== (const IntPoint& a, const IntPoint& b)
96
+ {
97
+ return a.X == b.X && a.Y == b.Y;
98
+ }
99
+ friend inline bool operator!= (const IntPoint& a, const IntPoint& b)
100
+ {
101
+ return a.X != b.X || a.Y != b.Y;
102
+ }
103
+ };
104
+ //------------------------------------------------------------------------------
105
+
106
+ typedef std::vector< IntPoint > Path;
107
+ typedef std::vector< Path > Paths;
108
+
109
+ inline Path& operator <<(Path& poly, const IntPoint& p) {poly.push_back(p); return poly;}
110
+ inline Paths& operator <<(Paths& polys, const Path& p) {polys.push_back(p); return polys;}
111
+
112
+ std::ostream& operator <<(std::ostream &s, const IntPoint &p);
113
+ std::ostream& operator <<(std::ostream &s, const Path &p);
114
+ std::ostream& operator <<(std::ostream &s, const Paths &p);
115
+
116
+ struct DoublePoint
117
+ {
118
+ double X;
119
+ double Y;
120
+ DoublePoint(double x = 0, double y = 0) : X(x), Y(y) {}
121
+ DoublePoint(IntPoint ip) : X((double)ip.X), Y((double)ip.Y) {}
122
+ };
123
+ //------------------------------------------------------------------------------
124
+
125
+ #ifdef use_xyz
126
+ typedef void (*ZFillCallback)(IntPoint& e1bot, IntPoint& e1top, IntPoint& e2bot, IntPoint& e2top, IntPoint& pt);
127
+ #endif
128
+
129
+ enum InitOptions {ioReverseSolution = 1, ioStrictlySimple = 2, ioPreserveCollinear = 4};
130
+ enum JoinType {jtSquare, jtRound, jtMiter};
131
+ enum EndType {etClosedPolygon, etClosedLine, etOpenButt, etOpenSquare, etOpenRound};
132
+
133
+ class PolyNode;
134
+ typedef std::vector< PolyNode* > PolyNodes;
135
+
136
+ class PolyNode
137
+ {
138
+ public:
139
+ PolyNode();
140
+ virtual ~PolyNode(){};
141
+ Path Contour;
142
+ PolyNodes Childs;
143
+ PolyNode* Parent;
144
+ PolyNode* GetNext() const;
145
+ bool IsHole() const;
146
+ bool IsOpen() const;
147
+ int ChildCount() const;
148
+ private:
149
+ //PolyNode& operator =(PolyNode& other);
150
+ unsigned Index; //node index in Parent.Childs
151
+ bool m_IsOpen;
152
+ JoinType m_jointype;
153
+ EndType m_endtype;
154
+ PolyNode* GetNextSiblingUp() const;
155
+ void AddChild(PolyNode& child);
156
+ friend class Clipper; //to access Index
157
+ friend class ClipperOffset;
158
+ };
159
+
160
+ class PolyTree: public PolyNode
161
+ {
162
+ public:
163
+ ~PolyTree(){ Clear(); };
164
+ PolyNode* GetFirst() const;
165
+ void Clear();
166
+ int Total() const;
167
+ private:
168
+ //PolyTree& operator =(PolyTree& other);
169
+ PolyNodes AllNodes;
170
+ friend class Clipper; //to access AllNodes
171
+ };
172
+
173
+ bool Orientation(const Path &poly);
174
+ double Area(const Path &poly);
175
+ int PointInPolygon(const IntPoint &pt, const Path &path);
176
+
177
+ void SimplifyPolygon(const Path &in_poly, Paths &out_polys, PolyFillType fillType = pftEvenOdd);
178
+ void SimplifyPolygons(const Paths &in_polys, Paths &out_polys, PolyFillType fillType = pftEvenOdd);
179
+ void SimplifyPolygons(Paths &polys, PolyFillType fillType = pftEvenOdd);
180
+
181
+ void CleanPolygon(const Path& in_poly, Path& out_poly, double distance = 1.415);
182
+ void CleanPolygon(Path& poly, double distance = 1.415);
183
+ void CleanPolygons(const Paths& in_polys, Paths& out_polys, double distance = 1.415);
184
+ void CleanPolygons(Paths& polys, double distance = 1.415);
185
+
186
+ void MinkowskiSum(const Path& pattern, const Path& path, Paths& solution, bool pathIsClosed);
187
+ void MinkowskiSum(const Path& pattern, const Paths& paths, Paths& solution, bool pathIsClosed);
188
+ void MinkowskiDiff(const Path& poly1, const Path& poly2, Paths& solution);
189
+
190
+ void PolyTreeToPaths(const PolyTree& polytree, Paths& paths);
191
+ void ClosedPathsFromPolyTree(const PolyTree& polytree, Paths& paths);
192
+ void OpenPathsFromPolyTree(PolyTree& polytree, Paths& paths);
193
+
194
+ void ReversePath(Path& p);
195
+ void ReversePaths(Paths& p);
196
+
197
+ struct IntRect { cInt left; cInt top; cInt right; cInt bottom; };
198
+
199
+ //enums that are used internally ...
200
+ enum EdgeSide { esLeft = 1, esRight = 2};
201
+
202
+ //forward declarations (for stuff used internally) ...
203
+ struct TEdge;
204
+ struct IntersectNode;
205
+ struct LocalMinimum;
206
+ struct OutPt;
207
+ struct OutRec;
208
+ struct Join;
209
+
210
+ typedef std::vector < OutRec* > PolyOutList;
211
+ typedef std::vector < TEdge* > EdgeList;
212
+ typedef std::vector < Join* > JoinList;
213
+ typedef std::vector < IntersectNode* > IntersectList;
214
+
215
+ //------------------------------------------------------------------------------
216
+
217
+ //ClipperBase is the ancestor to the Clipper class. It should not be
218
+ //instantiated directly. This class simply abstracts the conversion of sets of
219
+ //polygon coordinates into edge objects that are stored in a LocalMinima list.
220
+ class ClipperBase
221
+ {
222
+ public:
223
+ ClipperBase();
224
+ virtual ~ClipperBase();
225
+ virtual bool AddPath(const Path &pg, PolyType PolyTyp, bool Closed);
226
+ bool AddPaths(const Paths &ppg, PolyType PolyTyp, bool Closed);
227
+ virtual void Clear();
228
+ IntRect GetBounds();
229
+ bool PreserveCollinear() {return m_PreserveCollinear;};
230
+ void PreserveCollinear(bool value) {m_PreserveCollinear = value;};
231
+ protected:
232
+ void DisposeLocalMinimaList();
233
+ TEdge* AddBoundsToLML(TEdge *e, bool IsClosed);
234
+ virtual void Reset();
235
+ TEdge* ProcessBound(TEdge* E, bool IsClockwise);
236
+ void InsertScanbeam(const cInt Y);
237
+ bool PopScanbeam(cInt &Y);
238
+ bool LocalMinimaPending();
239
+ bool PopLocalMinima(cInt Y, const LocalMinimum *&locMin);
240
+ OutRec* CreateOutRec();
241
+ void DisposeAllOutRecs();
242
+ void DisposeOutRec(PolyOutList::size_type index);
243
+ void SwapPositionsInAEL(TEdge *edge1, TEdge *edge2);
244
+ void DeleteFromAEL(TEdge *e);
245
+ void UpdateEdgeIntoAEL(TEdge *&e);
246
+
247
+ typedef std::vector<LocalMinimum> MinimaList;
248
+ MinimaList::iterator m_CurrentLM;
249
+ MinimaList m_MinimaList;
250
+
251
+ bool m_UseFullRange;
252
+ EdgeList m_edges;
253
+ bool m_PreserveCollinear;
254
+ bool m_HasOpenPaths;
255
+ PolyOutList m_PolyOuts;
256
+ TEdge *m_ActiveEdges;
257
+
258
+ typedef std::priority_queue<cInt> ScanbeamList;
259
+ ScanbeamList m_Scanbeam;
260
+ };
261
+ //------------------------------------------------------------------------------
262
+
263
+ class Clipper : public virtual ClipperBase
264
+ {
265
+ public:
266
+ Clipper(int initOptions = 0);
267
+ bool Execute(ClipType clipType,
268
+ Paths &solution,
269
+ PolyFillType fillType = pftEvenOdd);
270
+ bool Execute(ClipType clipType,
271
+ Paths &solution,
272
+ PolyFillType subjFillType,
273
+ PolyFillType clipFillType);
274
+ bool Execute(ClipType clipType,
275
+ PolyTree &polytree,
276
+ PolyFillType fillType = pftEvenOdd);
277
+ bool Execute(ClipType clipType,
278
+ PolyTree &polytree,
279
+ PolyFillType subjFillType,
280
+ PolyFillType clipFillType);
281
+ bool ReverseSolution() { return m_ReverseOutput; };
282
+ void ReverseSolution(bool value) {m_ReverseOutput = value;};
283
+ bool StrictlySimple() {return m_StrictSimple;};
284
+ void StrictlySimple(bool value) {m_StrictSimple = value;};
285
+ //set the callback function for z value filling on intersections (otherwise Z is 0)
286
+ #ifdef use_xyz
287
+ void ZFillFunction(ZFillCallback zFillFunc);
288
+ #endif
289
+ protected:
290
+ virtual bool ExecuteInternal();
291
+ private:
292
+ JoinList m_Joins;
293
+ JoinList m_GhostJoins;
294
+ IntersectList m_IntersectList;
295
+ ClipType m_ClipType;
296
+ typedef std::list<cInt> MaximaList;
297
+ MaximaList m_Maxima;
298
+ TEdge *m_SortedEdges;
299
+ bool m_ExecuteLocked;
300
+ PolyFillType m_ClipFillType;
301
+ PolyFillType m_SubjFillType;
302
+ bool m_ReverseOutput;
303
+ bool m_UsingPolyTree;
304
+ bool m_StrictSimple;
305
+ #ifdef use_xyz
306
+ ZFillCallback m_ZFill; //custom callback
307
+ #endif
308
+ void SetWindingCount(TEdge& edge);
309
+ bool IsEvenOddFillType(const TEdge& edge) const;
310
+ bool IsEvenOddAltFillType(const TEdge& edge) const;
311
+ void InsertLocalMinimaIntoAEL(const cInt botY);
312
+ void InsertEdgeIntoAEL(TEdge *edge, TEdge* startEdge);
313
+ void AddEdgeToSEL(TEdge *edge);
314
+ bool PopEdgeFromSEL(TEdge *&edge);
315
+ void CopyAELToSEL();
316
+ void DeleteFromSEL(TEdge *e);
317
+ void SwapPositionsInSEL(TEdge *edge1, TEdge *edge2);
318
+ bool IsContributing(const TEdge& edge) const;
319
+ bool IsTopHorz(const cInt XPos);
320
+ void DoMaxima(TEdge *e);
321
+ void ProcessHorizontals();
322
+ void ProcessHorizontal(TEdge *horzEdge);
323
+ void AddLocalMaxPoly(TEdge *e1, TEdge *e2, const IntPoint &pt);
324
+ OutPt* AddLocalMinPoly(TEdge *e1, TEdge *e2, const IntPoint &pt);
325
+ OutRec* GetOutRec(int idx);
326
+ void AppendPolygon(TEdge *e1, TEdge *e2);
327
+ void IntersectEdges(TEdge *e1, TEdge *e2, IntPoint &pt);
328
+ OutPt* AddOutPt(TEdge *e, const IntPoint &pt);
329
+ OutPt* GetLastOutPt(TEdge *e);
330
+ bool ProcessIntersections(const cInt topY);
331
+ void BuildIntersectList(const cInt topY);
332
+ void ProcessIntersectList();
333
+ void ProcessEdgesAtTopOfScanbeam(const cInt topY);
334
+ void BuildResult(Paths& polys);
335
+ void BuildResult2(PolyTree& polytree);
336
+ void SetHoleState(TEdge *e, OutRec *outrec);
337
+ void DisposeIntersectNodes();
338
+ bool FixupIntersectionOrder();
339
+ void FixupOutPolygon(OutRec &outrec);
340
+ void FixupOutPolyline(OutRec &outrec);
341
+ bool IsHole(TEdge *e);
342
+ bool FindOwnerFromSplitRecs(OutRec &outRec, OutRec *&currOrfl);
343
+ void FixHoleLinkage(OutRec &outrec);
344
+ void AddJoin(OutPt *op1, OutPt *op2, const IntPoint offPt);
345
+ void ClearJoins();
346
+ void ClearGhostJoins();
347
+ void AddGhostJoin(OutPt *op, const IntPoint offPt);
348
+ bool JoinPoints(Join *j, OutRec* outRec1, OutRec* outRec2);
349
+ void JoinCommonEdges();
350
+ void DoSimplePolygons();
351
+ void FixupFirstLefts1(OutRec* OldOutRec, OutRec* NewOutRec);
352
+ void FixupFirstLefts2(OutRec* InnerOutRec, OutRec* OuterOutRec);
353
+ void FixupFirstLefts3(OutRec* OldOutRec, OutRec* NewOutRec);
354
+ #ifdef use_xyz
355
+ void SetZ(IntPoint& pt, TEdge& e1, TEdge& e2);
356
+ #endif
357
+ };
358
+ //------------------------------------------------------------------------------
359
+
360
+ class ClipperOffset
361
+ {
362
+ public:
363
+ ClipperOffset(double miterLimit = 2.0, double roundPrecision = 0.25);
364
+ ~ClipperOffset();
365
+ void AddPath(const Path& path, JoinType joinType, EndType endType);
366
+ void AddPaths(const Paths& paths, JoinType joinType, EndType endType);
367
+ void Execute(Paths& solution, double delta);
368
+ void Execute(PolyTree& solution, double delta);
369
+ void Clear();
370
+ double MiterLimit;
371
+ double ArcTolerance;
372
+ private:
373
+ Paths m_destPolys;
374
+ Path m_srcPoly;
375
+ Path m_destPoly;
376
+ std::vector<DoublePoint> m_normals;
377
+ double m_delta, m_sinA, m_sin, m_cos;
378
+ double m_miterLim, m_StepsPerRad;
379
+ IntPoint m_lowest;
380
+ PolyNode m_polyNodes;
381
+
382
+ void FixOrientations();
383
+ void DoOffset(double delta);
384
+ void OffsetPoint(int j, int& k, JoinType jointype);
385
+ void DoSquare(int j, int k);
386
+ void DoMiter(int j, int k, double r);
387
+ void DoRound(int j, int k);
388
+ };
389
+ //------------------------------------------------------------------------------
390
+
391
+ class clipperException : public std::exception
392
+ {
393
+ public:
394
+ clipperException(const char* description): m_descr(description) {}
395
+ virtual ~clipperException() throw() {}
396
+ virtual const char* what() const throw() {return m_descr.c_str();}
397
+ private:
398
+ std::string m_descr;
399
+ };
400
+ //------------------------------------------------------------------------------
401
+
402
+ } //ClipperLib namespace
403
+
404
+ #endif //clipper_hpp
405
+
406
+
@@ -0,0 +1,20 @@
1
+
2
+ # Tell the user project where to find our headers and libraries
3
+
4
+ set (NLOPT_VERSION "2.9.1")
5
+
6
+ set (NLOPT_INCLUDE_DIRS "C:/Users/runneradmin/AppData/Local/Temp/tmpxvbxt4z7/wheel/platlib/include")
7
+ set (NLOPT_LIBRARY_DIRS "C:/Users/runneradmin/AppData/Local/Temp/tmpxvbxt4z7/wheel/platlib/lib")
8
+
9
+ # Allows loading NLOPT settings from another project
10
+ set (NLOPT_CONFIG_FILE "${CMAKE_CURRENT_LIST_FILE}")
11
+
12
+ # List of compilation flags -DTOTO to export
13
+ set (NLOPT_DEFINITIONS "")
14
+
15
+ # Our library dependencies (contains definitions for IMPORTED targets)
16
+ include ("${CMAKE_CURRENT_LIST_DIR}/NLoptLibraryDepends.cmake")
17
+
18
+ # These are IMPORTED targets created by NLOPTLibraryDepends.cmake
19
+ set (NLOPT_LIBRARIES "NLopt::nlopt")
20
+
@@ -0,0 +1,12 @@
1
+
2
+ set (PACKAGE_VERSION "2.9.1")
3
+
4
+ # Check whether the requested PACKAGE_FIND_VERSION is compatible
5
+ if ("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
6
+ set (PACKAGE_VERSION_COMPATIBLE FALSE)
7
+ else ()
8
+ set (PACKAGE_VERSION_COMPATIBLE TRUE)
9
+ if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
10
+ set (PACKAGE_VERSION_EXACT TRUE)
11
+ endif ()
12
+ endif ()
@@ -0,0 +1,19 @@
1
+ #----------------------------------------------------------------
2
+ # Generated CMake target import file for configuration "Release".
3
+ #----------------------------------------------------------------
4
+
5
+ # Commands may need to know the format version.
6
+ set(CMAKE_IMPORT_FILE_VERSION 1)
7
+
8
+ # Import target "NLopt::nlopt" for configuration "Release"
9
+ set_property(TARGET NLopt::nlopt APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
10
+ set_target_properties(NLopt::nlopt PROPERTIES
11
+ IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C;CXX"
12
+ IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/nlopt.lib"
13
+ )
14
+
15
+ list(APPEND _cmake_import_check_targets NLopt::nlopt )
16
+ list(APPEND _cmake_import_check_files_for_NLopt::nlopt "${_IMPORT_PREFIX}/lib/nlopt.lib" )
17
+
18
+ # Commands beyond this point should not need to know the version.
19
+ set(CMAKE_IMPORT_FILE_VERSION)
@@ -0,0 +1,106 @@
1
+ # Generated by CMake
2
+
3
+ if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.8)
4
+ message(FATAL_ERROR "CMake >= 2.8.3 required")
5
+ endif()
6
+ if(CMAKE_VERSION VERSION_LESS "2.8.3")
7
+ message(FATAL_ERROR "CMake >= 2.8.3 required")
8
+ endif()
9
+ cmake_policy(PUSH)
10
+ cmake_policy(VERSION 2.8.3...3.29)
11
+ #----------------------------------------------------------------
12
+ # Generated CMake target import file.
13
+ #----------------------------------------------------------------
14
+
15
+ # Commands may need to know the format version.
16
+ set(CMAKE_IMPORT_FILE_VERSION 1)
17
+
18
+ # Protect against multiple inclusion, which would fail when already imported targets are added once more.
19
+ set(_cmake_targets_defined "")
20
+ set(_cmake_targets_not_defined "")
21
+ set(_cmake_expected_targets "")
22
+ foreach(_cmake_expected_target IN ITEMS NLopt::nlopt)
23
+ list(APPEND _cmake_expected_targets "${_cmake_expected_target}")
24
+ if(TARGET "${_cmake_expected_target}")
25
+ list(APPEND _cmake_targets_defined "${_cmake_expected_target}")
26
+ else()
27
+ list(APPEND _cmake_targets_not_defined "${_cmake_expected_target}")
28
+ endif()
29
+ endforeach()
30
+ unset(_cmake_expected_target)
31
+ if(_cmake_targets_defined STREQUAL _cmake_expected_targets)
32
+ unset(_cmake_targets_defined)
33
+ unset(_cmake_targets_not_defined)
34
+ unset(_cmake_expected_targets)
35
+ unset(CMAKE_IMPORT_FILE_VERSION)
36
+ cmake_policy(POP)
37
+ return()
38
+ endif()
39
+ if(NOT _cmake_targets_defined STREQUAL "")
40
+ string(REPLACE ";" ", " _cmake_targets_defined_text "${_cmake_targets_defined}")
41
+ string(REPLACE ";" ", " _cmake_targets_not_defined_text "${_cmake_targets_not_defined}")
42
+ message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_cmake_targets_defined_text}\nTargets not yet defined: ${_cmake_targets_not_defined_text}\n")
43
+ endif()
44
+ unset(_cmake_targets_defined)
45
+ unset(_cmake_targets_not_defined)
46
+ unset(_cmake_expected_targets)
47
+
48
+
49
+ # Compute the installation prefix relative to this file.
50
+ get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
51
+ get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
52
+ get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
53
+ get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
54
+ if(_IMPORT_PREFIX STREQUAL "/")
55
+ set(_IMPORT_PREFIX "")
56
+ endif()
57
+
58
+ # Create imported target NLopt::nlopt
59
+ add_library(NLopt::nlopt STATIC IMPORTED)
60
+
61
+ set_target_properties(NLopt::nlopt PROPERTIES
62
+ INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
63
+ )
64
+
65
+ # Load information for each installed configuration.
66
+ file(GLOB _cmake_config_files "${CMAKE_CURRENT_LIST_DIR}/NLoptLibraryDepends-*.cmake")
67
+ foreach(_cmake_config_file IN LISTS _cmake_config_files)
68
+ include("${_cmake_config_file}")
69
+ endforeach()
70
+ unset(_cmake_config_file)
71
+ unset(_cmake_config_files)
72
+
73
+ # Cleanup temporary variables.
74
+ set(_IMPORT_PREFIX)
75
+
76
+ # Loop over all imported files and verify that they actually exist
77
+ foreach(_cmake_target IN LISTS _cmake_import_check_targets)
78
+ if(CMAKE_VERSION VERSION_LESS "3.28"
79
+ OR NOT DEFINED _cmake_import_check_xcframework_for_${_cmake_target}
80
+ OR NOT IS_DIRECTORY "${_cmake_import_check_xcframework_for_${_cmake_target}}")
81
+ foreach(_cmake_file IN LISTS "_cmake_import_check_files_for_${_cmake_target}")
82
+ if(NOT EXISTS "${_cmake_file}")
83
+ message(FATAL_ERROR "The imported target \"${_cmake_target}\" references the file
84
+ \"${_cmake_file}\"
85
+ but this file does not exist. Possible reasons include:
86
+ * The file was deleted, renamed, or moved to another location.
87
+ * An install or uninstall procedure did not complete successfully.
88
+ * The installation package was faulty and contained
89
+ \"${CMAKE_CURRENT_LIST_FILE}\"
90
+ but not all the files it references.
91
+ ")
92
+ endif()
93
+ endforeach()
94
+ endif()
95
+ unset(_cmake_file)
96
+ unset("_cmake_import_check_files_for_${_cmake_target}")
97
+ endforeach()
98
+ unset(_cmake_target)
99
+ unset(_cmake_import_check_targets)
100
+
101
+ # This file does not depend on other imported targets which have
102
+ # been exported from the same project but in a separate export set.
103
+
104
+ # Commands beyond this point should not need to know the version.
105
+ set(CMAKE_IMPORT_FILE_VERSION)
106
+ cmake_policy(POP)
lib/nlopt.lib ADDED
Binary file
lib/pkgconfig/nlopt.pc ADDED
@@ -0,0 +1,12 @@
1
+ prefix=C:/Users/runneradmin/AppData/Local/Temp/tmpxvbxt4z7/wheel/platlib
2
+ exec_prefix=${prefix}
3
+ libdir=${exec_prefix}/lib
4
+ includedir=${prefix}/include
5
+
6
+ Name: NLopt
7
+ Description: nonlinear optimization library
8
+ Version: 2.9.1
9
+ Libs: -L${libdir} -lnlopt
10
+ Libs.private:
11
+ Cflags: -I${includedir}
12
+
lib/polyclipping.lib ADDED
Binary file
Binary file
@@ -0,0 +1,88 @@
1
+ Metadata-Version: 2.4
2
+ Name: python-libnest2d
3
+ Version: 0.1.0
4
+ Summary: Unofficial Python bindings for libnest2d — 2D bin packing / polygon nesting
5
+ Keywords: nesting,bin-packing,2d,polygon,cnc,laser-cutting
6
+ Author-Email: "Ultimaker B.V. (original pynest2d)" <plugins@ultimaker.com>
7
+ Maintainer: AhmetHTTP
8
+ License-Expression: LGPL-3.0-or-later
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Intended Audience :: Manufacturing
12
+ Classifier: Operating System :: Microsoft :: Windows
13
+ Classifier: Operating System :: POSIX :: Linux
14
+ Classifier: Programming Language :: C++
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Topic :: Scientific/Engineering
17
+ Project-URL: Homepage, https://github.com/AhmetHTTP/pynest2d
18
+ Project-URL: Repository, https://github.com/AhmetHTTP/pynest2d
19
+ Project-URL: Upstream (Ultimaker), https://github.com/Ultimaker/pynest2d
20
+ Project-URL: libnest2d, https://github.com/tamasmeszaros/libnest2d
21
+ Requires-Python: >=3.8
22
+ Description-Content-Type: text/markdown
23
+
24
+ # python-libnest2d
25
+
26
+ **Unofficial** Python bindings for [libnest2d](https://github.com/tamasmeszaros/libnest2d) — a library for 2D bin packing / polygon nesting.
27
+
28
+ Based on [pynest2d](https://github.com/Ultimaker/pynest2d) by Ultimaker B.V., repackaged for easy `pip install`.
29
+
30
+ ```bash
31
+ pip install python-libnest2d
32
+ ```
33
+
34
+ ## Quick Start
35
+
36
+ ```python
37
+ from pynest2d import Point, Box, Item, nest
38
+
39
+ # Define items as polygons
40
+ square = Item([Point(0, 0), Point(100, 0), Point(100, 100), Point(0, 100)])
41
+ triangle = Item([Point(0, 0), Point(100, 0), Point(50, 100)])
42
+
43
+ # Define the bin (sheet)
44
+ bin_shape = Box(1000, 1000)
45
+
46
+ # Pack items into bins
47
+ num_bins = nest([square, triangle], bin_shape, distance=5)
48
+
49
+ # Read results
50
+ for item in [square, triangle]:
51
+ t = item.translation()
52
+ print(f"Bin {item.binId()}: ({t.x()}, {t.y()}) rot={item.rotation():.2f}")
53
+ ```
54
+
55
+ ## API
56
+
57
+ | Class | Description |
58
+ |-------|-------------|
59
+ | `Point(x, y)` | 2D integer coordinate |
60
+ | `Box(w, h)` | Rectangular bin |
61
+ | `Item(vertices)` | Polygonal item to nest |
62
+ | `NfpConfig()` | NFP placer configuration |
63
+ | `nest(items, bin, distance, config)` | Main nesting function |
64
+
65
+ ## Building from Source
66
+
67
+ Requires: CMake 3.20+, C++17 compiler, Python 3.8+
68
+
69
+ ```bash
70
+ pip install .
71
+ ```
72
+
73
+ ## License
74
+
75
+ **LGPL-3.0-or-later** — see [LICENSE](LICENSE) for full text.
76
+
77
+ | Component | License |
78
+ |-----------|---------|
79
+ | pynest2d (bindings) | LGPL-3.0 — © Ultimaker B.V. |
80
+ | libnest2d (engine) | LGPL-3.0 — © Tamás Mészáros |
81
+ | Clipper | BSL-1.0 — © Angus Johnson |
82
+ | Boost | BSL-1.0 |
83
+ | NLopt | LGPL-2.1+ — © Steven G. Johnson |
84
+ | pybind11 | BSD-3-Clause |
85
+
86
+ **This is NOT an official Ultimaker product.** For the official version, see [Ultimaker/pynest2d](https://github.com/Ultimaker/pynest2d).
87
+
88
+ Source code: https://github.com/AhmetHTTP/pynest2d