11/* ******************************************************************************
22* Author : Angus Johnson *
3- * Date : 17 September 2024 *
3+ * Date : 24 January 2025 *
44* Website : http://www.angusj.com *
5- * Copyright : Angus Johnson 2010-2024 *
5+ * Copyright : Angus Johnson 2010-2025 *
66* Purpose : This module exports the Clipper2 Library (ie DLL/so) *
77* License : http://www.boost.org/LICENSE_1_0.txt *
88*******************************************************************************/
1919
2020The path structures used extensively in other parts of this library are all
2121based on std::vector classes. Since C++ classes can't be accessed by other
22- languages, these paths are converted here into very simple array data
23- structures that can be parsed by just about any programming language.
22+ languages, these paths are exported here as very simple array structures
23+ (either of int64_t or double) that can be parsed by just about any
24+ programming language.
2425
2526These 2D paths are defined by series of x and y coordinates together with an
2627optional user-defined 'z' value (see Z-values below). Hence, a vertex refers
27- to a single x and y coordinate (+/- a user-defined value). These values will
28- be either type int64_t or type double. Data structures have names that
29- indicate the array type by a suffixed '64' or a 'D'. For example, the data
30- structure CPath64 contains an array of int64_t values, whereas the data
31- structure CPathD contains an array of double. Where documentation omits
32- the type suffix (eg CPath), it is simply agnostic to the array's data type .
28+ to a single x and y coordinate (+/- a user-defined value). Data structures
29+ have names with suffixes that indicate the array type (either int64_t or
30+ double). For example, the data structure CPath64 contains an array of int64_t
31+ values, whereas the data structure CPathD contains an array of double.
32+ Where documentation omits the type suffix (eg CPath), it is referring to an
33+ array whose data type could be either int64_t or double .
3334
3435For conciseness, the following letters are used in the diagrams below:
3536N: Number of vertices in a given path
36- C: Count of structure's paths
37- A: Array size (as distinct from the size in memory)
37+ C: Count (ie number) of paths (or PolyPaths) in the structure
38+ A: Number of elements in an array
3839
3940
4041CPath64 and CPathD:
41- These are arrays of consecutive vertices preceeded by a pair of values
42- containing the number of vertices (N) in the path, and a 0 value.
42+ These are arrays of either int64_t or double values. Apart from
43+ the first two elements, these arrays are a series of vertices
44+ that together define a path. The very first element contains the
45+ number of vertices (N) in the path, while second element should
46+ contain a 0 value.
4347_______________________________________________________________
4448| counters | vertex1 | vertex2 | ... | vertexN |
4549| N, 0 | x1, y1, (z1) | x2, y2, (z2) | ... | xN, yN, (zN) |
4650---------------------------------------------------------------
4751
4852
4953CPaths64 and CPathsD:
50- These are also arrays containing any number of consecutive CPath
51- structures. Preceeding these consecutive paths, there is a pair of
52- values that contain the length of the array structure (A) and
53- the count of following CPath structures (C).
54+ These are also arrays of either int64_t or double values that
55+ contain any number of consecutive CPath structures. However,
56+ preceeding the first path is a pair of values. The first value
57+ contains the length of the entire array structure (A), and the
58+ second contains the number (ie count) of contained paths (C).
5459 Memory allocation for CPaths64 = A * sizeof(int64_t)
5560 Memory allocation for CPathsD = A * sizeof(double)
5661__________________________________________
@@ -60,12 +65,13 @@ __________________________________________
6065
6166
6267CPolytree64 and CPolytreeD:
63- These structures consist of two values followed by a series of CPolyPath
64- structures. The first value indicates the total length of the array (A).
65- The second value indicates the number of following CPolyPath structures
66- that are the top level CPolyPath in the CPolytree (C). These CPolyPath
67- may, in turn, contain their own nested CPolyPath children that
68- collectively make a tree structure.
68+ The entire polytree structure is an array of int64_t or double. The
69+ first element in the array indicates the array's total length (A).
70+ The second element indicates the number (C) of CPolyPath structures
71+ that are the TOP LEVEL CPolyPath in the polytree, and these top
72+ level CPolyPath immediately follow these first two array elements.
73+ These top level CPolyPath structures may, in turn, contain nested
74+ CPolyPath children, and these collectively make a tree structure.
6975_________________________________________________________
7076| counters | CPolyPath1 | CPolyPath2 | ... | CPolyPathC |
7177| A, C | | | ... | |
0 commit comments