cmu-graphics-helpers 0.1.3__tar.gz
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.
- cmu_graphics_helpers-0.1.3/.gitignore +72 -0
- cmu_graphics_helpers-0.1.3/Cargo.lock +593 -0
- cmu_graphics_helpers-0.1.3/Cargo.toml +26 -0
- cmu_graphics_helpers-0.1.3/PKG-INFO +7 -0
- cmu_graphics_helpers-0.1.3/pyproject.toml +13 -0
- cmu_graphics_helpers-0.1.3/src/lib.rs +65 -0
- cmu_graphics_helpers-0.1.3/test.py +255 -0
- cmu_graphics_helpers-0.1.3/uv.lock +7 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/target
|
|
2
|
+
|
|
3
|
+
# Byte-compiled / optimized / DLL files
|
|
4
|
+
__pycache__/
|
|
5
|
+
.pytest_cache/
|
|
6
|
+
*.py[cod]
|
|
7
|
+
|
|
8
|
+
# C extensions
|
|
9
|
+
*.so
|
|
10
|
+
|
|
11
|
+
# Distribution / packaging
|
|
12
|
+
.Python
|
|
13
|
+
.venv/
|
|
14
|
+
env/
|
|
15
|
+
bin/
|
|
16
|
+
build/
|
|
17
|
+
develop-eggs/
|
|
18
|
+
dist/
|
|
19
|
+
eggs/
|
|
20
|
+
lib/
|
|
21
|
+
lib64/
|
|
22
|
+
parts/
|
|
23
|
+
sdist/
|
|
24
|
+
var/
|
|
25
|
+
include/
|
|
26
|
+
man/
|
|
27
|
+
venv/
|
|
28
|
+
*.egg-info/
|
|
29
|
+
.installed.cfg
|
|
30
|
+
*.egg
|
|
31
|
+
|
|
32
|
+
# Installer logs
|
|
33
|
+
pip-log.txt
|
|
34
|
+
pip-delete-this-directory.txt
|
|
35
|
+
pip-selfcheck.json
|
|
36
|
+
|
|
37
|
+
# Unit test / coverage reports
|
|
38
|
+
htmlcov/
|
|
39
|
+
.tox/
|
|
40
|
+
.coverage
|
|
41
|
+
.cache
|
|
42
|
+
nosetests.xml
|
|
43
|
+
coverage.xml
|
|
44
|
+
|
|
45
|
+
# Translations
|
|
46
|
+
*.mo
|
|
47
|
+
|
|
48
|
+
# Mr Developer
|
|
49
|
+
.mr.developer.cfg
|
|
50
|
+
.project
|
|
51
|
+
.pydevproject
|
|
52
|
+
|
|
53
|
+
# Rope
|
|
54
|
+
.ropeproject
|
|
55
|
+
|
|
56
|
+
# Django stuff:
|
|
57
|
+
*.log
|
|
58
|
+
*.pot
|
|
59
|
+
|
|
60
|
+
.DS_Store
|
|
61
|
+
|
|
62
|
+
# Sphinx documentation
|
|
63
|
+
docs/_build/
|
|
64
|
+
|
|
65
|
+
# PyCharm
|
|
66
|
+
.idea/
|
|
67
|
+
|
|
68
|
+
# VSCode
|
|
69
|
+
.vscode/
|
|
70
|
+
|
|
71
|
+
# Pyenv
|
|
72
|
+
.python-version
|
|
@@ -0,0 +1,593 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 4
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "allocator-api2"
|
|
7
|
+
version = "0.2.21"
|
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
+
checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
|
|
10
|
+
|
|
11
|
+
[[package]]
|
|
12
|
+
name = "approx"
|
|
13
|
+
version = "0.3.2"
|
|
14
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
15
|
+
checksum = "f0e60b75072ecd4168020818c0107f2857bb6c4e64252d8d3983f6263b40a5c3"
|
|
16
|
+
dependencies = [
|
|
17
|
+
"num-traits",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
[[package]]
|
|
21
|
+
name = "approx"
|
|
22
|
+
version = "0.5.1"
|
|
23
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
24
|
+
checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6"
|
|
25
|
+
dependencies = [
|
|
26
|
+
"num-traits",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[[package]]
|
|
30
|
+
name = "autocfg"
|
|
31
|
+
version = "1.5.0"
|
|
32
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
33
|
+
checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
|
|
34
|
+
|
|
35
|
+
[[package]]
|
|
36
|
+
name = "byteorder"
|
|
37
|
+
version = "1.5.0"
|
|
38
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
39
|
+
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
|
40
|
+
|
|
41
|
+
[[package]]
|
|
42
|
+
name = "cfg-if"
|
|
43
|
+
version = "1.0.4"
|
|
44
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
45
|
+
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
|
46
|
+
|
|
47
|
+
[[package]]
|
|
48
|
+
name = "cmu-graphics-helpers"
|
|
49
|
+
version = "0.1.3"
|
|
50
|
+
dependencies = [
|
|
51
|
+
"geo",
|
|
52
|
+
"geo-booleanop",
|
|
53
|
+
"geo-types 0.7.18",
|
|
54
|
+
"pyo3",
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
[[package]]
|
|
58
|
+
name = "crossbeam-deque"
|
|
59
|
+
version = "0.8.6"
|
|
60
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
61
|
+
checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51"
|
|
62
|
+
dependencies = [
|
|
63
|
+
"crossbeam-epoch",
|
|
64
|
+
"crossbeam-utils",
|
|
65
|
+
]
|
|
66
|
+
|
|
67
|
+
[[package]]
|
|
68
|
+
name = "crossbeam-epoch"
|
|
69
|
+
version = "0.9.18"
|
|
70
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
71
|
+
checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
|
|
72
|
+
dependencies = [
|
|
73
|
+
"crossbeam-utils",
|
|
74
|
+
]
|
|
75
|
+
|
|
76
|
+
[[package]]
|
|
77
|
+
name = "crossbeam-utils"
|
|
78
|
+
version = "0.8.21"
|
|
79
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
80
|
+
checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
|
|
81
|
+
|
|
82
|
+
[[package]]
|
|
83
|
+
name = "earcutr"
|
|
84
|
+
version = "0.4.3"
|
|
85
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
86
|
+
checksum = "79127ed59a85d7687c409e9978547cffb7dc79675355ed22da6b66fd5f6ead01"
|
|
87
|
+
dependencies = [
|
|
88
|
+
"itertools",
|
|
89
|
+
"num-traits",
|
|
90
|
+
]
|
|
91
|
+
|
|
92
|
+
[[package]]
|
|
93
|
+
name = "either"
|
|
94
|
+
version = "1.15.0"
|
|
95
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
96
|
+
checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
|
|
97
|
+
|
|
98
|
+
[[package]]
|
|
99
|
+
name = "equivalent"
|
|
100
|
+
version = "1.0.2"
|
|
101
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
102
|
+
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
|
|
103
|
+
|
|
104
|
+
[[package]]
|
|
105
|
+
name = "float_next_after"
|
|
106
|
+
version = "0.1.5"
|
|
107
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
108
|
+
checksum = "4fc612c5837986b7104a87a0df74a5460931f1c5274be12f8d0f40aa2f30d632"
|
|
109
|
+
dependencies = [
|
|
110
|
+
"num-traits",
|
|
111
|
+
]
|
|
112
|
+
|
|
113
|
+
[[package]]
|
|
114
|
+
name = "float_next_after"
|
|
115
|
+
version = "1.0.0"
|
|
116
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
117
|
+
checksum = "8bf7cc16383c4b8d58b9905a8509f02926ce3058053c056376248d958c9df1e8"
|
|
118
|
+
|
|
119
|
+
[[package]]
|
|
120
|
+
name = "foldhash"
|
|
121
|
+
version = "0.1.5"
|
|
122
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
123
|
+
checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
|
|
124
|
+
|
|
125
|
+
[[package]]
|
|
126
|
+
name = "geo"
|
|
127
|
+
version = "0.32.0"
|
|
128
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
129
|
+
checksum = "3f3901269ec6d4f6068d3f09e5f02f995bd076398dcd1dfec407cd230b02d11b"
|
|
130
|
+
dependencies = [
|
|
131
|
+
"earcutr",
|
|
132
|
+
"float_next_after 1.0.0",
|
|
133
|
+
"geo-types 0.7.18",
|
|
134
|
+
"geographiclib-rs",
|
|
135
|
+
"i_overlay",
|
|
136
|
+
"log",
|
|
137
|
+
"num-traits",
|
|
138
|
+
"rand",
|
|
139
|
+
"robust 1.2.0",
|
|
140
|
+
"rstar",
|
|
141
|
+
"sif-itree",
|
|
142
|
+
"spade",
|
|
143
|
+
]
|
|
144
|
+
|
|
145
|
+
[[package]]
|
|
146
|
+
name = "geo-booleanop"
|
|
147
|
+
version = "0.3.2"
|
|
148
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
149
|
+
checksum = "d4b68ff17c819296610e9eee41bdf5eb37f71b09870a95f0086e07d8fcc1f45b"
|
|
150
|
+
dependencies = [
|
|
151
|
+
"float_next_after 0.1.5",
|
|
152
|
+
"geo-types 0.6.2",
|
|
153
|
+
"num-traits",
|
|
154
|
+
"robust 0.1.2",
|
|
155
|
+
]
|
|
156
|
+
|
|
157
|
+
[[package]]
|
|
158
|
+
name = "geo-types"
|
|
159
|
+
version = "0.6.2"
|
|
160
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
161
|
+
checksum = "7583925a1fdb2b450c461fe0878ba6e99a8f1332b2bc72fb1383fd25b2f13bf2"
|
|
162
|
+
dependencies = [
|
|
163
|
+
"approx 0.3.2",
|
|
164
|
+
"num-traits",
|
|
165
|
+
]
|
|
166
|
+
|
|
167
|
+
[[package]]
|
|
168
|
+
name = "geo-types"
|
|
169
|
+
version = "0.7.18"
|
|
170
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
171
|
+
checksum = "24f8647af4005fa11da47cd56252c6ef030be8fa97bdbf355e7dfb6348f0a82c"
|
|
172
|
+
dependencies = [
|
|
173
|
+
"approx 0.5.1",
|
|
174
|
+
"num-traits",
|
|
175
|
+
"rayon",
|
|
176
|
+
"rstar",
|
|
177
|
+
"serde",
|
|
178
|
+
]
|
|
179
|
+
|
|
180
|
+
[[package]]
|
|
181
|
+
name = "geographiclib-rs"
|
|
182
|
+
version = "0.2.7"
|
|
183
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
184
|
+
checksum = "c5a7f08910fd98737a6eda7568e7c5e645093e073328eeef49758cfe8b0489c7"
|
|
185
|
+
dependencies = [
|
|
186
|
+
"libm",
|
|
187
|
+
]
|
|
188
|
+
|
|
189
|
+
[[package]]
|
|
190
|
+
name = "getrandom"
|
|
191
|
+
version = "0.2.17"
|
|
192
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
193
|
+
checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
|
|
194
|
+
dependencies = [
|
|
195
|
+
"cfg-if",
|
|
196
|
+
"libc",
|
|
197
|
+
"wasi",
|
|
198
|
+
]
|
|
199
|
+
|
|
200
|
+
[[package]]
|
|
201
|
+
name = "hash32"
|
|
202
|
+
version = "0.3.1"
|
|
203
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
204
|
+
checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606"
|
|
205
|
+
dependencies = [
|
|
206
|
+
"byteorder",
|
|
207
|
+
]
|
|
208
|
+
|
|
209
|
+
[[package]]
|
|
210
|
+
name = "hashbrown"
|
|
211
|
+
version = "0.15.5"
|
|
212
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
213
|
+
checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
|
|
214
|
+
dependencies = [
|
|
215
|
+
"allocator-api2",
|
|
216
|
+
"equivalent",
|
|
217
|
+
"foldhash",
|
|
218
|
+
]
|
|
219
|
+
|
|
220
|
+
[[package]]
|
|
221
|
+
name = "heapless"
|
|
222
|
+
version = "0.8.0"
|
|
223
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
224
|
+
checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad"
|
|
225
|
+
dependencies = [
|
|
226
|
+
"hash32",
|
|
227
|
+
"stable_deref_trait",
|
|
228
|
+
]
|
|
229
|
+
|
|
230
|
+
[[package]]
|
|
231
|
+
name = "heck"
|
|
232
|
+
version = "0.5.0"
|
|
233
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
234
|
+
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
235
|
+
|
|
236
|
+
[[package]]
|
|
237
|
+
name = "i_float"
|
|
238
|
+
version = "1.15.0"
|
|
239
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
240
|
+
checksum = "010025c2c532c8d82e42d0b8bb5184afa449fa6f06c709ea9adcb16c49ae405b"
|
|
241
|
+
dependencies = [
|
|
242
|
+
"libm",
|
|
243
|
+
]
|
|
244
|
+
|
|
245
|
+
[[package]]
|
|
246
|
+
name = "i_key_sort"
|
|
247
|
+
version = "0.6.0"
|
|
248
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
249
|
+
checksum = "9190f86706ca38ac8add223b2aed8b1330002b5cdbbce28fb58b10914d38fc27"
|
|
250
|
+
|
|
251
|
+
[[package]]
|
|
252
|
+
name = "i_overlay"
|
|
253
|
+
version = "4.0.7"
|
|
254
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
255
|
+
checksum = "413183068e6e0289e18d7d0a1f661b81546e6918d5453a44570b9ab30cbed1b3"
|
|
256
|
+
dependencies = [
|
|
257
|
+
"i_float",
|
|
258
|
+
"i_key_sort",
|
|
259
|
+
"i_shape",
|
|
260
|
+
"i_tree",
|
|
261
|
+
"rayon",
|
|
262
|
+
]
|
|
263
|
+
|
|
264
|
+
[[package]]
|
|
265
|
+
name = "i_shape"
|
|
266
|
+
version = "1.14.0"
|
|
267
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
268
|
+
checksum = "1ea154b742f7d43dae2897fcd5ead86bc7b5eefcedd305a7ebf9f69d44d61082"
|
|
269
|
+
dependencies = [
|
|
270
|
+
"i_float",
|
|
271
|
+
]
|
|
272
|
+
|
|
273
|
+
[[package]]
|
|
274
|
+
name = "i_tree"
|
|
275
|
+
version = "0.16.0"
|
|
276
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
277
|
+
checksum = "35e6d558e6d4c7b82bc51d9c771e7a927862a161a7d87bf2b0541450e0e20915"
|
|
278
|
+
|
|
279
|
+
[[package]]
|
|
280
|
+
name = "itertools"
|
|
281
|
+
version = "0.11.0"
|
|
282
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
283
|
+
checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57"
|
|
284
|
+
dependencies = [
|
|
285
|
+
"either",
|
|
286
|
+
]
|
|
287
|
+
|
|
288
|
+
[[package]]
|
|
289
|
+
name = "libc"
|
|
290
|
+
version = "0.2.182"
|
|
291
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
292
|
+
checksum = "6800badb6cb2082ffd7b6a67e6125bb39f18782f793520caee8cb8846be06112"
|
|
293
|
+
|
|
294
|
+
[[package]]
|
|
295
|
+
name = "libm"
|
|
296
|
+
version = "0.2.16"
|
|
297
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
298
|
+
checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"
|
|
299
|
+
|
|
300
|
+
[[package]]
|
|
301
|
+
name = "log"
|
|
302
|
+
version = "0.4.29"
|
|
303
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
304
|
+
checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"
|
|
305
|
+
|
|
306
|
+
[[package]]
|
|
307
|
+
name = "num-traits"
|
|
308
|
+
version = "0.2.19"
|
|
309
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
310
|
+
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
|
|
311
|
+
dependencies = [
|
|
312
|
+
"autocfg",
|
|
313
|
+
"libm",
|
|
314
|
+
]
|
|
315
|
+
|
|
316
|
+
[[package]]
|
|
317
|
+
name = "once_cell"
|
|
318
|
+
version = "1.21.3"
|
|
319
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
320
|
+
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
|
321
|
+
|
|
322
|
+
[[package]]
|
|
323
|
+
name = "portable-atomic"
|
|
324
|
+
version = "1.13.1"
|
|
325
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
326
|
+
checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49"
|
|
327
|
+
|
|
328
|
+
[[package]]
|
|
329
|
+
name = "ppv-lite86"
|
|
330
|
+
version = "0.2.21"
|
|
331
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
332
|
+
checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
|
|
333
|
+
dependencies = [
|
|
334
|
+
"zerocopy",
|
|
335
|
+
]
|
|
336
|
+
|
|
337
|
+
[[package]]
|
|
338
|
+
name = "proc-macro2"
|
|
339
|
+
version = "1.0.106"
|
|
340
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
341
|
+
checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
|
|
342
|
+
dependencies = [
|
|
343
|
+
"unicode-ident",
|
|
344
|
+
]
|
|
345
|
+
|
|
346
|
+
[[package]]
|
|
347
|
+
name = "pyo3"
|
|
348
|
+
version = "0.28.2"
|
|
349
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
350
|
+
checksum = "cf85e27e86080aafd5a22eae58a162e133a589551542b3e5cee4beb27e54f8e1"
|
|
351
|
+
dependencies = [
|
|
352
|
+
"libc",
|
|
353
|
+
"once_cell",
|
|
354
|
+
"portable-atomic",
|
|
355
|
+
"pyo3-build-config",
|
|
356
|
+
"pyo3-ffi",
|
|
357
|
+
"pyo3-macros",
|
|
358
|
+
]
|
|
359
|
+
|
|
360
|
+
[[package]]
|
|
361
|
+
name = "pyo3-build-config"
|
|
362
|
+
version = "0.28.2"
|
|
363
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
364
|
+
checksum = "8bf94ee265674bf76c09fa430b0e99c26e319c945d96ca0d5a8215f31bf81cf7"
|
|
365
|
+
dependencies = [
|
|
366
|
+
"target-lexicon",
|
|
367
|
+
]
|
|
368
|
+
|
|
369
|
+
[[package]]
|
|
370
|
+
name = "pyo3-ffi"
|
|
371
|
+
version = "0.28.2"
|
|
372
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
373
|
+
checksum = "491aa5fc66d8059dd44a75f4580a2962c1862a1c2945359db36f6c2818b748dc"
|
|
374
|
+
dependencies = [
|
|
375
|
+
"libc",
|
|
376
|
+
"pyo3-build-config",
|
|
377
|
+
]
|
|
378
|
+
|
|
379
|
+
[[package]]
|
|
380
|
+
name = "pyo3-macros"
|
|
381
|
+
version = "0.28.2"
|
|
382
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
383
|
+
checksum = "f5d671734e9d7a43449f8480f8b38115df67bef8d21f76837fa75ee7aaa5e52e"
|
|
384
|
+
dependencies = [
|
|
385
|
+
"proc-macro2",
|
|
386
|
+
"pyo3-macros-backend",
|
|
387
|
+
"quote",
|
|
388
|
+
"syn",
|
|
389
|
+
]
|
|
390
|
+
|
|
391
|
+
[[package]]
|
|
392
|
+
name = "pyo3-macros-backend"
|
|
393
|
+
version = "0.28.2"
|
|
394
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
395
|
+
checksum = "22faaa1ce6c430a1f71658760497291065e6450d7b5dc2bcf254d49f66ee700a"
|
|
396
|
+
dependencies = [
|
|
397
|
+
"heck",
|
|
398
|
+
"proc-macro2",
|
|
399
|
+
"pyo3-build-config",
|
|
400
|
+
"quote",
|
|
401
|
+
"syn",
|
|
402
|
+
]
|
|
403
|
+
|
|
404
|
+
[[package]]
|
|
405
|
+
name = "quote"
|
|
406
|
+
version = "1.0.44"
|
|
407
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
408
|
+
checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4"
|
|
409
|
+
dependencies = [
|
|
410
|
+
"proc-macro2",
|
|
411
|
+
]
|
|
412
|
+
|
|
413
|
+
[[package]]
|
|
414
|
+
name = "rand"
|
|
415
|
+
version = "0.8.5"
|
|
416
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
417
|
+
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
|
418
|
+
dependencies = [
|
|
419
|
+
"libc",
|
|
420
|
+
"rand_chacha",
|
|
421
|
+
"rand_core",
|
|
422
|
+
]
|
|
423
|
+
|
|
424
|
+
[[package]]
|
|
425
|
+
name = "rand_chacha"
|
|
426
|
+
version = "0.3.1"
|
|
427
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
428
|
+
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
|
429
|
+
dependencies = [
|
|
430
|
+
"ppv-lite86",
|
|
431
|
+
"rand_core",
|
|
432
|
+
]
|
|
433
|
+
|
|
434
|
+
[[package]]
|
|
435
|
+
name = "rand_core"
|
|
436
|
+
version = "0.6.4"
|
|
437
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
438
|
+
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
|
439
|
+
dependencies = [
|
|
440
|
+
"getrandom",
|
|
441
|
+
]
|
|
442
|
+
|
|
443
|
+
[[package]]
|
|
444
|
+
name = "rayon"
|
|
445
|
+
version = "1.11.0"
|
|
446
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
447
|
+
checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f"
|
|
448
|
+
dependencies = [
|
|
449
|
+
"either",
|
|
450
|
+
"rayon-core",
|
|
451
|
+
]
|
|
452
|
+
|
|
453
|
+
[[package]]
|
|
454
|
+
name = "rayon-core"
|
|
455
|
+
version = "1.13.0"
|
|
456
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
457
|
+
checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91"
|
|
458
|
+
dependencies = [
|
|
459
|
+
"crossbeam-deque",
|
|
460
|
+
"crossbeam-utils",
|
|
461
|
+
]
|
|
462
|
+
|
|
463
|
+
[[package]]
|
|
464
|
+
name = "robust"
|
|
465
|
+
version = "0.1.2"
|
|
466
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
467
|
+
checksum = "222155e5550abd9100afdcdefbd08aa1b856d226b60e327044ec21b1ece2f78e"
|
|
468
|
+
|
|
469
|
+
[[package]]
|
|
470
|
+
name = "robust"
|
|
471
|
+
version = "1.2.0"
|
|
472
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
473
|
+
checksum = "4e27ee8bb91ca0adcf0ecb116293afa12d393f9c2b9b9cd54d33e8078fe19839"
|
|
474
|
+
|
|
475
|
+
[[package]]
|
|
476
|
+
name = "rstar"
|
|
477
|
+
version = "0.12.2"
|
|
478
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
479
|
+
checksum = "421400d13ccfd26dfa5858199c30a5d76f9c54e0dba7575273025b43c5175dbb"
|
|
480
|
+
dependencies = [
|
|
481
|
+
"heapless",
|
|
482
|
+
"num-traits",
|
|
483
|
+
"smallvec",
|
|
484
|
+
]
|
|
485
|
+
|
|
486
|
+
[[package]]
|
|
487
|
+
name = "serde"
|
|
488
|
+
version = "1.0.228"
|
|
489
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
490
|
+
checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
|
|
491
|
+
dependencies = [
|
|
492
|
+
"serde_core",
|
|
493
|
+
"serde_derive",
|
|
494
|
+
]
|
|
495
|
+
|
|
496
|
+
[[package]]
|
|
497
|
+
name = "serde_core"
|
|
498
|
+
version = "1.0.228"
|
|
499
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
500
|
+
checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
|
|
501
|
+
dependencies = [
|
|
502
|
+
"serde_derive",
|
|
503
|
+
]
|
|
504
|
+
|
|
505
|
+
[[package]]
|
|
506
|
+
name = "serde_derive"
|
|
507
|
+
version = "1.0.228"
|
|
508
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
509
|
+
checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
|
|
510
|
+
dependencies = [
|
|
511
|
+
"proc-macro2",
|
|
512
|
+
"quote",
|
|
513
|
+
"syn",
|
|
514
|
+
]
|
|
515
|
+
|
|
516
|
+
[[package]]
|
|
517
|
+
name = "sif-itree"
|
|
518
|
+
version = "0.4.1"
|
|
519
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
520
|
+
checksum = "d7f45b8998ced5134fb1d75732c77842a3e888f19c1ff98481822e8fbfbf930b"
|
|
521
|
+
|
|
522
|
+
[[package]]
|
|
523
|
+
name = "smallvec"
|
|
524
|
+
version = "1.15.1"
|
|
525
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
526
|
+
checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
|
|
527
|
+
|
|
528
|
+
[[package]]
|
|
529
|
+
name = "spade"
|
|
530
|
+
version = "2.15.0"
|
|
531
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
532
|
+
checksum = "fb313e1c8afee5b5647e00ee0fe6855e3d529eb863a0fdae1d60006c4d1e9990"
|
|
533
|
+
dependencies = [
|
|
534
|
+
"hashbrown",
|
|
535
|
+
"num-traits",
|
|
536
|
+
"robust 1.2.0",
|
|
537
|
+
"smallvec",
|
|
538
|
+
]
|
|
539
|
+
|
|
540
|
+
[[package]]
|
|
541
|
+
name = "stable_deref_trait"
|
|
542
|
+
version = "1.2.1"
|
|
543
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
544
|
+
checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
|
|
545
|
+
|
|
546
|
+
[[package]]
|
|
547
|
+
name = "syn"
|
|
548
|
+
version = "2.0.117"
|
|
549
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
550
|
+
checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
|
|
551
|
+
dependencies = [
|
|
552
|
+
"proc-macro2",
|
|
553
|
+
"quote",
|
|
554
|
+
"unicode-ident",
|
|
555
|
+
]
|
|
556
|
+
|
|
557
|
+
[[package]]
|
|
558
|
+
name = "target-lexicon"
|
|
559
|
+
version = "0.13.5"
|
|
560
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
561
|
+
checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
|
|
562
|
+
|
|
563
|
+
[[package]]
|
|
564
|
+
name = "unicode-ident"
|
|
565
|
+
version = "1.0.24"
|
|
566
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
567
|
+
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
|
568
|
+
|
|
569
|
+
[[package]]
|
|
570
|
+
name = "wasi"
|
|
571
|
+
version = "0.11.1+wasi-snapshot-preview1"
|
|
572
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
573
|
+
checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
|
|
574
|
+
|
|
575
|
+
[[package]]
|
|
576
|
+
name = "zerocopy"
|
|
577
|
+
version = "0.8.39"
|
|
578
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
579
|
+
checksum = "db6d35d663eadb6c932438e763b262fe1a70987f9ae936e60158176d710cae4a"
|
|
580
|
+
dependencies = [
|
|
581
|
+
"zerocopy-derive",
|
|
582
|
+
]
|
|
583
|
+
|
|
584
|
+
[[package]]
|
|
585
|
+
name = "zerocopy-derive"
|
|
586
|
+
version = "0.8.39"
|
|
587
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
588
|
+
checksum = "4122cd3169e94605190e77839c9a40d40ed048d305bfdc146e7df40ab0f3e517"
|
|
589
|
+
dependencies = [
|
|
590
|
+
"proc-macro2",
|
|
591
|
+
"quote",
|
|
592
|
+
"syn",
|
|
593
|
+
]
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "cmu-graphics-helpers"
|
|
3
|
+
version = "0.1.3"
|
|
4
|
+
edition = "2024"
|
|
5
|
+
|
|
6
|
+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
7
|
+
[lib]
|
|
8
|
+
name = "cmu_graphics_helpers"
|
|
9
|
+
crate-type = ["cdylib"]
|
|
10
|
+
|
|
11
|
+
[dependencies]
|
|
12
|
+
geo = "0.32.0"
|
|
13
|
+
geo-booleanop = "0.3.2"
|
|
14
|
+
geo-types = "0.7.18"
|
|
15
|
+
|
|
16
|
+
[dependencies.pyo3]
|
|
17
|
+
version = "0.28.2"
|
|
18
|
+
features = ["extension-module", "abi3-py37"]
|
|
19
|
+
|
|
20
|
+
[lints.clippy]
|
|
21
|
+
panic = "deny"
|
|
22
|
+
unwrap_used = "deny"
|
|
23
|
+
expect_used = "deny"
|
|
24
|
+
indexing_slicing = "deny"
|
|
25
|
+
unreachable = "deny"
|
|
26
|
+
todo = "deny"
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cmu-graphics-helpers
|
|
3
|
+
Version: 0.1.3
|
|
4
|
+
Classifier: Programming Language :: Rust
|
|
5
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
7
|
+
Requires-Python: >=3.7
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["maturin>=1.12,<2.0"]
|
|
3
|
+
build-backend = "maturin"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "cmu-graphics-helpers"
|
|
7
|
+
requires-python = ">=3.7"
|
|
8
|
+
classifiers = [
|
|
9
|
+
"Programming Language :: Rust",
|
|
10
|
+
"Programming Language :: Python :: Implementation :: CPython",
|
|
11
|
+
"Programming Language :: Python :: Implementation :: PyPy",
|
|
12
|
+
]
|
|
13
|
+
dynamic = ["version"]
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
use pyo3::Bound;
|
|
2
|
+
use pyo3::exceptions::PyValueError;
|
|
3
|
+
use pyo3::prelude::*;
|
|
4
|
+
use pyo3::types::PyModule;
|
|
5
|
+
|
|
6
|
+
use geo::BooleanOps;
|
|
7
|
+
use geo::{LineString, MultiPolygon, Polygon};
|
|
8
|
+
|
|
9
|
+
// type aliases
|
|
10
|
+
type PyLineString = Vec<(f64, f64)>;
|
|
11
|
+
type PyPolygon = Vec<PyLineString>;
|
|
12
|
+
type PyMultiPolygon = Vec<PyPolygon>;
|
|
13
|
+
|
|
14
|
+
// conversions from Python to Rust
|
|
15
|
+
fn py_polygon_to_polygon(poly: PyPolygon) -> Polygon<f64> {
|
|
16
|
+
let mut line_strings = poly.into_iter().map(LineString::from);
|
|
17
|
+
|
|
18
|
+
match line_strings.next() {
|
|
19
|
+
Some(exterior) => Polygon::new(exterior, line_strings.collect()),
|
|
20
|
+
None => Polygon::empty(),
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
fn py_multi_polygon_to_multi_polygon(multi_poly: PyMultiPolygon) -> MultiPolygon<f64> {
|
|
25
|
+
let polys = multi_poly.into_iter().map(py_polygon_to_polygon).collect();
|
|
26
|
+
MultiPolygon::new(polys)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// conversions from Rust to Python
|
|
30
|
+
fn line_string_to_vec(line_string: &LineString<f64>) -> PyLineString {
|
|
31
|
+
line_string.points().map(|p| (p.x(), p.y())).collect()
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
fn polygon_to_py_polygon(poly: Polygon<f64>) -> PyPolygon {
|
|
35
|
+
let holes = poly.interiors().iter().map(line_string_to_vec);
|
|
36
|
+
let exterior = line_string_to_vec(poly.exterior());
|
|
37
|
+
|
|
38
|
+
std::iter::once(exterior).chain(holes).collect()
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
fn multi_polygon_to_py_multi_polygon(multi_poly: MultiPolygon<f64>) -> PyMultiPolygon {
|
|
42
|
+
multi_poly.into_iter().map(polygon_to_py_polygon).collect()
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Unions a vector of PyMultiPolygons
|
|
46
|
+
#[pyfunction]
|
|
47
|
+
fn union(py_polys: Vec<PyMultiPolygon>) -> PyResult<PyMultiPolygon> {
|
|
48
|
+
let union_result_or_none = py_polys
|
|
49
|
+
.into_iter()
|
|
50
|
+
.map(py_multi_polygon_to_multi_polygon)
|
|
51
|
+
.reduce(|u, m| m.union(&u));
|
|
52
|
+
|
|
53
|
+
match union_result_or_none {
|
|
54
|
+
Some(union_result) => Ok(multi_polygon_to_py_multi_polygon(union_result)),
|
|
55
|
+
None => Err(PyValueError::new_err(
|
|
56
|
+
"union must be given at least one MultiPolygon as input",
|
|
57
|
+
)),
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
#[pymodule]
|
|
62
|
+
fn cmu_graphics_helpers(m: &Bound<'_, PyModule>) -> PyResult<()> {
|
|
63
|
+
m.add_function(wrap_pyfunction!(union, m)?)?;
|
|
64
|
+
Ok(())
|
|
65
|
+
}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
import cmu_graphics_helpers
|
|
3
|
+
|
|
4
|
+
# simple: a square with no holes
|
|
5
|
+
square = [[[(0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0), (0.0, 0.0)]]]
|
|
6
|
+
|
|
7
|
+
# complex: test case from group_contains_shape.py
|
|
8
|
+
bigMulti = [
|
|
9
|
+
[[[(50, 150), (150, 150), (150, 250), (50, 250), (50, 150)]]],
|
|
10
|
+
[
|
|
11
|
+
[
|
|
12
|
+
[
|
|
13
|
+
(250, 100),
|
|
14
|
+
(266.83854912172984, 151.8237254218853),
|
|
15
|
+
(321.3292387221365, 151.82372542187895),
|
|
16
|
+
(277.24534480019355, 183.8525491562397),
|
|
17
|
+
(294.08389392193544, 235.67627457812108),
|
|
18
|
+
(250.0, 203.64745084375),
|
|
19
|
+
(205.9161060780645, 235.67627457812105),
|
|
20
|
+
(222.75465519980645, 183.85254915623966),
|
|
21
|
+
(178.6707612778635, 151.82372542187892),
|
|
22
|
+
(233.1614508782702, 151.8237254218853),
|
|
23
|
+
(250, 100),
|
|
24
|
+
]
|
|
25
|
+
]
|
|
26
|
+
],
|
|
27
|
+
[
|
|
28
|
+
[
|
|
29
|
+
[
|
|
30
|
+
(126.7037086255956, 137.9409523010254),
|
|
31
|
+
(124.99999997691395, 125.0),
|
|
32
|
+
(126.7037086255956, 112.05904769897461),
|
|
33
|
+
(131.69872973040822, 100.0),
|
|
34
|
+
(139.644660926621, 89.64466094970703),
|
|
35
|
+
(149.99999997691395, 81.69872975349426),
|
|
36
|
+
(162.05904767588856, 76.70370864868164),
|
|
37
|
+
(174.99999997691395, 75.0),
|
|
38
|
+
(187.94095227793935, 76.70370864868164),
|
|
39
|
+
(199.99999997691395, 81.69872975349426),
|
|
40
|
+
(210.35533902720692, 89.64466094970703),
|
|
41
|
+
(218.3012702234197, 100.0),
|
|
42
|
+
(223.29629132823231, 112.05904769897461),
|
|
43
|
+
(224.99999997691395, 125.0),
|
|
44
|
+
(223.29629132823231, 137.9409523010254),
|
|
45
|
+
(218.3012702234197, 150.0),
|
|
46
|
+
(210.35533902720692, 160.35533905029297),
|
|
47
|
+
(199.99999997691395, 168.30127024650574),
|
|
48
|
+
(187.94095227793935, 173.29629135131836),
|
|
49
|
+
(174.99999997691395, 175.0),
|
|
50
|
+
(162.05904767588856, 173.29629135131836),
|
|
51
|
+
(149.99999997691395, 168.30127024650574),
|
|
52
|
+
(139.644660926621, 160.35533905029297),
|
|
53
|
+
(131.69872973040822, 150.0),
|
|
54
|
+
(126.7037086255956, 137.9409523010254),
|
|
55
|
+
(126.7037086255956, 137.9409523010254),
|
|
56
|
+
]
|
|
57
|
+
],
|
|
58
|
+
[
|
|
59
|
+
[
|
|
60
|
+
(216.7037086255956, 287.9409523010254),
|
|
61
|
+
(214.99999997691395, 275.0),
|
|
62
|
+
(216.7037086255956, 262.0590476989746),
|
|
63
|
+
(221.69872973040822, 250.0),
|
|
64
|
+
(229.644660926621, 239.64466094970703),
|
|
65
|
+
(239.99999997691395, 231.69872975349426),
|
|
66
|
+
(252.05904767588856, 226.70370864868164),
|
|
67
|
+
(264.99999997691395, 225.0),
|
|
68
|
+
(277.94095227793935, 226.70370864868164),
|
|
69
|
+
(289.99999997691395, 231.69872975349426),
|
|
70
|
+
(300.3553390272069, 239.64466094970703),
|
|
71
|
+
(308.3012702234197, 250.0),
|
|
72
|
+
(313.2962913282323, 262.0590476989746),
|
|
73
|
+
(314.99999997691395, 275.0),
|
|
74
|
+
(314.70319006518605, 277.25449442863464),
|
|
75
|
+
(317.8120856054235, 278.28030824661255),
|
|
76
|
+
(321.9867360361028, 280.09361481666565),
|
|
77
|
+
(325.9791974790502, 282.2790298461914),
|
|
78
|
+
(329.7563872106481, 284.81844425201416),
|
|
79
|
+
(333.2870058782506, 287.69081568717957),
|
|
80
|
+
(336.54179809169057, 290.8723428249359),
|
|
81
|
+
(339.4937934644628, 294.33666253089905),
|
|
82
|
+
(342.1185309656072, 298.0550682544708),
|
|
83
|
+
(344.39426086024525, 301.99674820899963),
|
|
84
|
+
(346.3021259077001, 306.12904024124146),
|
|
85
|
+
(347.8263170488286, 310.4177031517029),
|
|
86
|
+
(348.95420429782155, 314.8271994590759),
|
|
87
|
+
(349.67644164637807, 319.32099080085754),
|
|
88
|
+
(349.9870443113256, 323.8618402481079),
|
|
89
|
+
(349.8834383256841, 328.4121208190918),
|
|
90
|
+
(349.36648271159413, 332.93412733078003),
|
|
91
|
+
(348.4404608972478, 337.39038944244385),
|
|
92
|
+
(347.11304614619496, 341.7439806461334),
|
|
93
|
+
(345.39523766116383, 345.9588260650635),
|
|
94
|
+
(343.3012702234197, 350.0),
|
|
95
|
+
(299.99999997691395, 325.0),
|
|
96
|
+
(299.99999997691395, 310.628000497818),
|
|
97
|
+
(289.99999997691395, 318.30127024650574),
|
|
98
|
+
(277.94095227793935, 323.29629135131836),
|
|
99
|
+
(264.99999997691395, 325.0),
|
|
100
|
+
(252.05904767588856, 323.29629135131836),
|
|
101
|
+
(239.99999997691395, 318.30127024650574),
|
|
102
|
+
(229.644660926621, 310.35533905029297),
|
|
103
|
+
(221.69872973040822, 300.0),
|
|
104
|
+
(216.7037086255956, 287.9409523010254),
|
|
105
|
+
(216.7037086255956, 287.9409523010254),
|
|
106
|
+
]
|
|
107
|
+
],
|
|
108
|
+
],
|
|
109
|
+
[[[(125, 225), (225, 225), (225, 325), (125, 325), (125, 225)]]],
|
|
110
|
+
[[[(225, 75), (275, 75), (275, 125), (225, 125), (225, 75)]]],
|
|
111
|
+
[[[(275, 75), (325, 75), (325, 125), (275, 125), (275, 75)]]],
|
|
112
|
+
[[[(20, 300), (170, 300), (38, 375), (90, 205), (130, 370), (35, 225), (20, 300)]]],
|
|
113
|
+
]
|
|
114
|
+
result = [
|
|
115
|
+
[
|
|
116
|
+
[
|
|
117
|
+
(60.94117638753511, 300.0),
|
|
118
|
+
(19.999999973045362, 300.0),
|
|
119
|
+
(34.99999997304536, 225.0),
|
|
120
|
+
(49.99999997304536, 247.89473676681519),
|
|
121
|
+
(49.99999997304536, 150.0),
|
|
122
|
+
(131.69872972653963, 150.0),
|
|
123
|
+
(126.703708621727, 137.9409523010254),
|
|
124
|
+
(124.99999997304536, 125.0),
|
|
125
|
+
(126.703708621727, 112.05904769897461),
|
|
126
|
+
(131.69872972653963, 100.0),
|
|
127
|
+
(139.6446609227524, 89.64466094970703),
|
|
128
|
+
(149.99999997304536, 81.69872975349426),
|
|
129
|
+
(162.05904767201997, 76.70370864868164),
|
|
130
|
+
(174.99999997304536, 75.0),
|
|
131
|
+
(187.94095227407075, 76.70370864868164),
|
|
132
|
+
(199.99999997304536, 81.69872975349426),
|
|
133
|
+
(210.35533902333833, 89.64466094970703),
|
|
134
|
+
(218.3012702195511, 100.0),
|
|
135
|
+
(223.29629132436372, 112.05904769897461),
|
|
136
|
+
(224.99999997304536, 125.0),
|
|
137
|
+
(223.29629132436372, 137.9409523010254),
|
|
138
|
+
(218.3012702195511, 150.0),
|
|
139
|
+
(216.90187642263032, 151.82372546195984),
|
|
140
|
+
(233.16145083592988, 151.82372546195984),
|
|
141
|
+
(241.8770074574814, 125.0),
|
|
142
|
+
(224.99999997304536, 125.0),
|
|
143
|
+
(224.99999997304536, 75.0),
|
|
144
|
+
(324.99999997304536, 75.0),
|
|
145
|
+
(324.99999997304536, 125.0),
|
|
146
|
+
(258.12299225019075, 125.0),
|
|
147
|
+
(266.83854911016084, 151.82372546195984),
|
|
148
|
+
(321.3292388646469, 151.82372546195984),
|
|
149
|
+
(277.2453448502884, 183.85254907608032),
|
|
150
|
+
(293.71864173101045, 234.55214405059814),
|
|
151
|
+
(300.35533902333833, 239.64466094970703),
|
|
152
|
+
(308.3012702195511, 250.0),
|
|
153
|
+
(313.2962913243637, 262.0590476989746),
|
|
154
|
+
(314.99999997304536, 275.0),
|
|
155
|
+
(314.70319006131746, 277.25449442863464),
|
|
156
|
+
(317.8120856015549, 278.28030824661255),
|
|
157
|
+
(321.9867360322342, 280.09361481666565),
|
|
158
|
+
(325.9791974751816, 282.2790298461914),
|
|
159
|
+
(329.7563872067795, 284.81844425201416),
|
|
160
|
+
(333.28700587438203, 287.69081568717957),
|
|
161
|
+
(336.541798087822, 290.8723428249359),
|
|
162
|
+
(339.4937934605942, 294.33666253089905),
|
|
163
|
+
(342.1185309617386, 298.0550682544708),
|
|
164
|
+
(344.39426085637666, 301.99674820899963),
|
|
165
|
+
(346.3021259038315, 306.12904024124146),
|
|
166
|
+
(347.82631704496004, 310.4177031517029),
|
|
167
|
+
(348.95420429395296, 314.8271994590759),
|
|
168
|
+
(349.6764416425095, 319.32099080085754),
|
|
169
|
+
(349.987044307457, 323.8618402481079),
|
|
170
|
+
(349.8834383218155, 328.4121208190918),
|
|
171
|
+
(349.36648270772554, 332.93412733078003),
|
|
172
|
+
(348.4404608933792, 337.39038944244385),
|
|
173
|
+
(347.11304614232637, 341.7439806461334),
|
|
174
|
+
(345.39523765729524, 345.9588260650635),
|
|
175
|
+
(343.3012702195511, 350.0),
|
|
176
|
+
(299.99999997304536, 325.0),
|
|
177
|
+
(299.99999997304536, 310.628000497818),
|
|
178
|
+
(289.99999997304536, 318.30127024650574),
|
|
179
|
+
(277.94095227407075, 323.29629135131836),
|
|
180
|
+
(264.99999997304536, 325.0),
|
|
181
|
+
(252.05904767201997, 323.29629135131836),
|
|
182
|
+
(239.99999997304536, 318.30127024650574),
|
|
183
|
+
(229.6446609227524, 310.35533905029297),
|
|
184
|
+
(224.99999997304536, 304.30229902267456),
|
|
185
|
+
(224.99999997304536, 325.0),
|
|
186
|
+
(125.99999997304536, 325.0),
|
|
187
|
+
(119.92736074613191, 328.45036339759827),
|
|
188
|
+
(113.03030297444917, 300.0),
|
|
189
|
+
(124.99999997304536, 300.0),
|
|
190
|
+
(124.99999997304536, 250.0),
|
|
191
|
+
(100.90909073041536, 250.0),
|
|
192
|
+
(113.03030297444917, 300.0),
|
|
193
|
+
(84.13793084310151, 300.0),
|
|
194
|
+
(68.32418725179292, 275.8632333278656),
|
|
195
|
+
(76.2352940766678, 250.0),
|
|
196
|
+
(51.37931010411836, 250.0),
|
|
197
|
+
(68.32418725179292, 275.8632333278656),
|
|
198
|
+
(60.94117638753511, 300.0),
|
|
199
|
+
],
|
|
200
|
+
[
|
|
201
|
+
(149.99999997304536, 168.30127024650574),
|
|
202
|
+
(149.99999997304536, 225.0),
|
|
203
|
+
(209.3850378720627, 225.0),
|
|
204
|
+
(222.7546553342209, 183.85254907608032),
|
|
205
|
+
(200.65664741681672, 167.7974066734314),
|
|
206
|
+
(199.99999997304536, 168.30127024650574),
|
|
207
|
+
(187.94095227407075, 173.29629135131836),
|
|
208
|
+
(174.99999997304536, 175.0),
|
|
209
|
+
(162.05904767201997, 173.29629135131836),
|
|
210
|
+
(149.99999997304536, 168.30127024650574),
|
|
211
|
+
],
|
|
212
|
+
[
|
|
213
|
+
(220.61073729680635, 225.0),
|
|
214
|
+
(224.99999997304536, 225.0),
|
|
215
|
+
(224.99999997304536, 245.69770097732544),
|
|
216
|
+
(229.6446609227524, 239.64466094970703),
|
|
217
|
+
(239.99999997304536, 231.69872975349426),
|
|
218
|
+
(252.05904767201997, 226.70370864868164),
|
|
219
|
+
(264.99999997304536, 225.0),
|
|
220
|
+
(277.94095227407075, 226.70370864868164),
|
|
221
|
+
(286.7648784844742, 230.3586983680725),
|
|
222
|
+
(249.99999997304536, 203.64745092391968),
|
|
223
|
+
(220.61073729680635, 225.0),
|
|
224
|
+
],
|
|
225
|
+
],
|
|
226
|
+
[
|
|
227
|
+
[
|
|
228
|
+
(107.43003985570527, 335.55111360549927),
|
|
229
|
+
(37.99999997304536, 375.0),
|
|
230
|
+
(60.94117638753511, 300.0),
|
|
231
|
+
(84.13793084310151, 300.0),
|
|
232
|
+
(107.43003985570527, 335.55111360549927),
|
|
233
|
+
]
|
|
234
|
+
],
|
|
235
|
+
[
|
|
236
|
+
[
|
|
237
|
+
(129.99999997304536, 370.0),
|
|
238
|
+
(107.43003985570527, 335.55111360549927),
|
|
239
|
+
(119.92736074613191, 328.45036339759827),
|
|
240
|
+
(129.99999997304536, 370.0),
|
|
241
|
+
]
|
|
242
|
+
],
|
|
243
|
+
]
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
class TestUnion(unittest.TestCase):
|
|
247
|
+
def test_union(self):
|
|
248
|
+
self.assertEqual(cmu_graphics_helpers.union([square]), square)
|
|
249
|
+
|
|
250
|
+
unionResult = cmu_graphics_helpers.union(bigMulti)
|
|
251
|
+
self.assertEqual(unionResult, result)
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
if __name__ == '__main__':
|
|
255
|
+
unittest.main()
|