bos-geo 0.1.0__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.
- bos_geo-0.1.0/.gitignore +3 -0
- bos_geo-0.1.0/CHANGELOG.md +22 -0
- bos_geo-0.1.0/Cargo.lock +132 -0
- bos_geo-0.1.0/Cargo.toml +33 -0
- bos_geo-0.1.0/LICENSE +674 -0
- bos_geo-0.1.0/PKG-INFO +203 -0
- bos_geo-0.1.0/README.md +189 -0
- bos_geo-0.1.0/benches/metrics.rs +108 -0
- bos_geo-0.1.0/bos_geo.pyi +105 -0
- bos_geo-0.1.0/pyproject.toml +26 -0
- bos_geo-0.1.0/src/geometry.rs +639 -0
- bos_geo-0.1.0/src/lib.rs +78 -0
- bos_geo-0.1.0/src/metrics.rs +434 -0
- bos_geo-0.1.0/src/point2d.rs +212 -0
- bos_geo-0.1.0/src/python.rs +148 -0
- bos_geo-0.1.0/tests/common/mod.rs +341 -0
- bos_geo-0.1.0/tests/invalid_input.rs +225 -0
- bos_geo-0.1.0/tests/properties.rs +451 -0
- bos_geo-0.1.0/tests/python/test_bos_geo.py +238 -0
- bos_geo-0.1.0/tests/regression.rs +300 -0
bos_geo-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
## 0.1.0 - 2026-11-17
|
|
6
|
+
|
|
7
|
+
First release.
|
|
8
|
+
|
|
9
|
+
- `calc_completeness` (recall) and `calc_correctness` (precision) for two 2D polylines, after the
|
|
10
|
+
buffer overlay statistics of Tveite and Langaas (1999).
|
|
11
|
+
- The buffer of a line is everything within the buffer distance of it: round at bends and
|
|
12
|
+
reaching past the two ends, as a GIS buffer does. The matched lengths are computed exactly from
|
|
13
|
+
this definition; no buffer polygon is built.
|
|
14
|
+
- Flat buffer ends as an option, for a line that should get no credit beyond its own ends:
|
|
15
|
+
`end_cap="flat"` in Python, `EndCap::Flat` with `calc_completeness_with_end_cap` and
|
|
16
|
+
`calc_correctness_with_end_cap` in Rust.
|
|
17
|
+
- Input without a result is an error, never a number: a line with fewer than two distinct points,
|
|
18
|
+
a coordinate that is NaN or infinite, a buffer that is not a finite number greater than 0.
|
|
19
|
+
Python raises `ValueError`; Rust returns `MetricError`.
|
|
20
|
+
- Python: the module `bos_geo` for CPython 3.9 and later. A line is a sequence of `(x, y)` pairs or
|
|
21
|
+
an `(N, 2)` NumPy array. A type stub and a `py.typed` marker are included.
|
|
22
|
+
- Rust: the crate has no dependencies. The Python binding is behind the cargo feature `python`.
|
bos_geo-0.1.0/Cargo.lock
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 4
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "bos-geo"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
dependencies = [
|
|
9
|
+
"pyo3",
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
[[package]]
|
|
13
|
+
name = "heck"
|
|
14
|
+
version = "0.5.0"
|
|
15
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
16
|
+
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
17
|
+
|
|
18
|
+
[[package]]
|
|
19
|
+
name = "libc"
|
|
20
|
+
version = "0.2.175"
|
|
21
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
22
|
+
checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543"
|
|
23
|
+
|
|
24
|
+
[[package]]
|
|
25
|
+
name = "once_cell"
|
|
26
|
+
version = "1.21.3"
|
|
27
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
28
|
+
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
|
29
|
+
|
|
30
|
+
[[package]]
|
|
31
|
+
name = "portable-atomic"
|
|
32
|
+
version = "1.11.1"
|
|
33
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
34
|
+
checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483"
|
|
35
|
+
|
|
36
|
+
[[package]]
|
|
37
|
+
name = "proc-macro2"
|
|
38
|
+
version = "1.0.101"
|
|
39
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
40
|
+
checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de"
|
|
41
|
+
dependencies = [
|
|
42
|
+
"unicode-ident",
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
[[package]]
|
|
46
|
+
name = "pyo3"
|
|
47
|
+
version = "0.30.1"
|
|
48
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
49
|
+
checksum = "229ca13b8a15bb0d1487b81ab975bfcd97513416499a8312011b6036e42e0de4"
|
|
50
|
+
dependencies = [
|
|
51
|
+
"libc",
|
|
52
|
+
"once_cell",
|
|
53
|
+
"portable-atomic",
|
|
54
|
+
"pyo3-build-config",
|
|
55
|
+
"pyo3-ffi",
|
|
56
|
+
"pyo3-macros",
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
[[package]]
|
|
60
|
+
name = "pyo3-build-config"
|
|
61
|
+
version = "0.30.1"
|
|
62
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
63
|
+
checksum = "70130e2b6dd1ee589a8788026a429561ca5c40fa7a2fa7914c2282eddae24700"
|
|
64
|
+
dependencies = [
|
|
65
|
+
"target-lexicon",
|
|
66
|
+
]
|
|
67
|
+
|
|
68
|
+
[[package]]
|
|
69
|
+
name = "pyo3-ffi"
|
|
70
|
+
version = "0.30.1"
|
|
71
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
72
|
+
checksum = "5e7ff73c555c286d212d4ce7e5fbda845a973c4f61bd5f160f5f2c3c2a04d1c4"
|
|
73
|
+
dependencies = [
|
|
74
|
+
"libc",
|
|
75
|
+
"pyo3-build-config",
|
|
76
|
+
]
|
|
77
|
+
|
|
78
|
+
[[package]]
|
|
79
|
+
name = "pyo3-macros"
|
|
80
|
+
version = "0.30.1"
|
|
81
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
82
|
+
checksum = "c46d2e5862c7bb8207e3b639f713dda3c499933444784154c11d013c5a691b60"
|
|
83
|
+
dependencies = [
|
|
84
|
+
"proc-macro2",
|
|
85
|
+
"pyo3-macros-backend",
|
|
86
|
+
"quote",
|
|
87
|
+
"syn",
|
|
88
|
+
]
|
|
89
|
+
|
|
90
|
+
[[package]]
|
|
91
|
+
name = "pyo3-macros-backend"
|
|
92
|
+
version = "0.30.1"
|
|
93
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
94
|
+
checksum = "38b89f066f2ae72a2aef52d1537ca2fcd104440ebfadee06e97aa90738a25b9b"
|
|
95
|
+
dependencies = [
|
|
96
|
+
"heck",
|
|
97
|
+
"proc-macro2",
|
|
98
|
+
"quote",
|
|
99
|
+
"syn",
|
|
100
|
+
]
|
|
101
|
+
|
|
102
|
+
[[package]]
|
|
103
|
+
name = "quote"
|
|
104
|
+
version = "1.0.40"
|
|
105
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
106
|
+
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
|
|
107
|
+
dependencies = [
|
|
108
|
+
"proc-macro2",
|
|
109
|
+
]
|
|
110
|
+
|
|
111
|
+
[[package]]
|
|
112
|
+
name = "syn"
|
|
113
|
+
version = "3.0.10"
|
|
114
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
115
|
+
checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79"
|
|
116
|
+
dependencies = [
|
|
117
|
+
"proc-macro2",
|
|
118
|
+
"quote",
|
|
119
|
+
"unicode-ident",
|
|
120
|
+
]
|
|
121
|
+
|
|
122
|
+
[[package]]
|
|
123
|
+
name = "target-lexicon"
|
|
124
|
+
version = "0.13.6"
|
|
125
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
126
|
+
checksum = "8c447be3a2abfa84b2d91680c56600bd6b2873866de27b36ec911be705e291da"
|
|
127
|
+
|
|
128
|
+
[[package]]
|
|
129
|
+
name = "unicode-ident"
|
|
130
|
+
version = "1.0.18"
|
|
131
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
132
|
+
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
|
bos_geo-0.1.0/Cargo.toml
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "bos-geo"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
edition = "2024"
|
|
5
|
+
description = "Buffer overlay statistics for 2D polylines: completeness (recall) and correctness (precision) of a predicted line against a ground truth line"
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
license = "GPL-3.0-only"
|
|
8
|
+
keywords = ["buffer-overlay-statistics", "algorithm", "geometry", "polyline", "completeness", "correctness", "precision", "recall", "rust", "python"]
|
|
9
|
+
repository = "https://github.com/vassilijnadarajah/bos"
|
|
10
|
+
# Kept out of `cargo package` and so out of the Python source distribution, which holds the same
|
|
11
|
+
# files. `tests/` and `benches/` stay in.
|
|
12
|
+
exclude = [".github/", ".vscode/", "AgentDocs/", "docs/", "literature/", "sample/"]
|
|
13
|
+
|
|
14
|
+
[lib]
|
|
15
|
+
name = "bos_geo"
|
|
16
|
+
crate-type = ["cdylib", "rlib"]
|
|
17
|
+
# The benchmark is benches/metrics.rs; there is nothing to measure in the unit tests.
|
|
18
|
+
bench = false
|
|
19
|
+
|
|
20
|
+
[features]
|
|
21
|
+
# Builds the Python extension module `bos_geo`. maturin turns it on (see pyproject.toml).
|
|
22
|
+
# Without it the crate is plain Rust: `cargo build` and `cargo test` need no Python.
|
|
23
|
+
# `abi3-py39` limits the binding to Python's stable ABI: one wheel per platform serves CPython 3.9
|
|
24
|
+
# and every later version. It is set here and not in pyproject.toml so that clippy lints what is
|
|
25
|
+
# shipped.
|
|
26
|
+
python = ["dep:pyo3", "pyo3/abi3-py39"]
|
|
27
|
+
|
|
28
|
+
[dependencies]
|
|
29
|
+
pyo3 = { version = "0.30", optional = true }
|
|
30
|
+
|
|
31
|
+
[[bench]]
|
|
32
|
+
name = "metrics"
|
|
33
|
+
harness = false
|