tg_geometry 0.3.2 → 0.3.3
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +81 -291
- data/ext/tg_geometry/tg_geometry_ext.c +3 -4
- data/ext/tg_geometry/vendor/.vendored +8 -8
- data/ext/tg_geometry/vendor/json/VERSION +1 -1
- data/ext/tg_geometry/vendor/json/json.c +20 -20
- data/ext/tg_geometry/vendor/json/json.h +20 -20
- data/ext/tg_geometry/vendor/rtree/VERSION +2 -2
- data/ext/tg_geometry/vendor/rtree/rtree.c +121 -148
- data/ext/tg_geometry/vendor/rtree/rtree.h +14 -11
- data/ext/tg_geometry/vendor/tg/VERSION +1 -1
- data/ext/tg_geometry/vendor/tg/tg.c +1854 -1339
- data/ext/tg_geometry/vendor/tg/tg.h +18 -17
- data/lib/tg/geometry/version.rb +1 -1
- data/script/vendor_libs.rb +11 -7
- metadata +3 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// https://github.com/tidwall/tg
|
|
2
2
|
//
|
|
3
3
|
// Copyright 2023 Joshua J Baker. All rights reserved.
|
|
4
|
-
// Use of this source code is governed by a license
|
|
4
|
+
// Use of this source code is governed by a license
|
|
5
5
|
// that can be found in the LICENSE file.
|
|
6
6
|
|
|
7
7
|
#ifndef TG_H
|
|
@@ -26,7 +26,7 @@ struct tg_segment {
|
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
/// A rectangle defined by a minimum and maximum coordinates.
|
|
29
|
-
/// Returned by the tg_geom_rect(), tg_ring_rect(), and other \*_rect()
|
|
29
|
+
/// Returned by the tg_geom_rect(), tg_ring_rect(), and other \*_rect()
|
|
30
30
|
/// functions for getting a geometry's minimum bounding rectangle.
|
|
31
31
|
/// Also used internally for geometry indexing.
|
|
32
32
|
/// @see RectFuncs
|
|
@@ -62,10 +62,10 @@ enum tg_geom_type {
|
|
|
62
62
|
/// Used for polygons, rings, and lines to make the point-in-polygon and
|
|
63
63
|
/// geometry intersection operations fast.
|
|
64
64
|
///
|
|
65
|
-
/// An index can also be used for efficiently traversing, searching, and
|
|
66
|
-
/// performing nearest-neighbor (kNN) queries on the segment using
|
|
65
|
+
/// An index can also be used for efficiently traversing, searching, and
|
|
66
|
+
/// performing nearest-neighbor (kNN) queries on the segment using
|
|
67
67
|
/// tg_ring_index_*() and tg_ring_nearest() functions.
|
|
68
|
-
enum tg_index {
|
|
68
|
+
enum tg_index {
|
|
69
69
|
TG_DEFAULT, ///< default is TG_NATURAL or tg_env_set_default_index().
|
|
70
70
|
TG_NONE, ///< no indexing available, or disabled.
|
|
71
71
|
TG_NATURAL, ///< indexing with natural ring order, for rings/lines
|
|
@@ -73,7 +73,7 @@ enum tg_index {
|
|
|
73
73
|
};
|
|
74
74
|
|
|
75
75
|
/// @defgroup GeometryConstructors Geometry constructors
|
|
76
|
-
/// Functions for creating and freeing geometries.
|
|
76
|
+
/// Functions for creating and freeing geometries.
|
|
77
77
|
/// @{
|
|
78
78
|
struct tg_geom *tg_geom_new_point(struct tg_point point);
|
|
79
79
|
struct tg_geom *tg_geom_new_linestring(const struct tg_line *line);
|
|
@@ -110,6 +110,7 @@ const struct tg_poly *tg_geom_poly_at(const struct tg_geom *geom, int index);
|
|
|
110
110
|
int tg_geom_num_geometries(const struct tg_geom *geom);
|
|
111
111
|
const struct tg_geom *tg_geom_geometry_at(const struct tg_geom *geom, int index);
|
|
112
112
|
const char *tg_geom_extra_json(const struct tg_geom *geom);
|
|
113
|
+
const char *tg_geom_extra_json2(const struct tg_geom *geom, size_t *jsonlen);
|
|
113
114
|
bool tg_geom_is_empty(const struct tg_geom *geom);
|
|
114
115
|
int tg_geom_dims(const struct tg_geom *geom);
|
|
115
116
|
bool tg_geom_has_z(const struct tg_geom *geom);
|
|
@@ -240,7 +241,7 @@ bool tg_rect_intersects_point(struct tg_rect a, struct tg_point b);
|
|
|
240
241
|
/// Functions for working directly with the tg_ring type.
|
|
241
242
|
///
|
|
242
243
|
/// There are no direct spatial predicates for tg_ring.
|
|
243
|
-
/// If you want to perform operations like "intersects" or "covers" then you
|
|
244
|
+
/// If you want to perform operations like "intersects" or "covers" then you
|
|
244
245
|
/// must upcast the ring to a tg_geom, like such:
|
|
245
246
|
///
|
|
246
247
|
/// ```
|
|
@@ -265,17 +266,17 @@ int tg_ring_index_spread(const struct tg_ring *ring);
|
|
|
265
266
|
int tg_ring_index_num_levels(const struct tg_ring *ring);
|
|
266
267
|
int tg_ring_index_level_num_rects(const struct tg_ring *ring, int levelidx);
|
|
267
268
|
struct tg_rect tg_ring_index_level_rect(const struct tg_ring *ring, int levelidx, int rectidx);
|
|
268
|
-
bool tg_ring_nearest_segment(const struct tg_ring *ring,
|
|
269
|
+
bool tg_ring_nearest_segment(const struct tg_ring *ring,
|
|
269
270
|
double (*rect_dist)(struct tg_rect rect, int *more, void *udata),
|
|
270
271
|
double (*seg_dist)(struct tg_segment seg, int *more, void *udata),
|
|
271
272
|
bool (*iter)(struct tg_segment seg, double dist, int index, void *udata),
|
|
272
273
|
void *udata);
|
|
273
|
-
void tg_ring_line_search(const struct tg_ring *a, const struct tg_line *b,
|
|
274
|
-
bool (*iter)(struct tg_segment aseg, int aidx, struct tg_segment bseg,
|
|
274
|
+
void tg_ring_line_search(const struct tg_ring *a, const struct tg_line *b,
|
|
275
|
+
bool (*iter)(struct tg_segment aseg, int aidx, struct tg_segment bseg,
|
|
275
276
|
int bidx, void *udata),
|
|
276
277
|
void *udata);
|
|
277
|
-
void tg_ring_ring_search(const struct tg_ring *a, const struct tg_ring *b,
|
|
278
|
-
bool (*iter)(struct tg_segment aseg, int aidx, struct tg_segment bseg,
|
|
278
|
+
void tg_ring_ring_search(const struct tg_ring *a, const struct tg_ring *b,
|
|
279
|
+
bool (*iter)(struct tg_segment aseg, int aidx, struct tg_segment bseg,
|
|
279
280
|
int bidx, void *udata),
|
|
280
281
|
void *udata);
|
|
281
282
|
double tg_ring_area(const struct tg_ring *ring);
|
|
@@ -286,7 +287,7 @@ double tg_ring_perimeter(const struct tg_ring *ring);
|
|
|
286
287
|
/// Functions for working directly with the tg_line type.
|
|
287
288
|
///
|
|
288
289
|
/// There are no direct spatial predicates for tg_line.
|
|
289
|
-
/// If you want to perform operations like "intersects" or "covers" then you
|
|
290
|
+
/// If you want to perform operations like "intersects" or "covers" then you
|
|
290
291
|
/// must upcast the line to a tg_geom, like such:
|
|
291
292
|
///
|
|
292
293
|
/// ```
|
|
@@ -310,13 +311,13 @@ int tg_line_index_spread(const struct tg_line *line);
|
|
|
310
311
|
int tg_line_index_num_levels(const struct tg_line *line);
|
|
311
312
|
int tg_line_index_level_num_rects(const struct tg_line *line, int levelidx);
|
|
312
313
|
struct tg_rect tg_line_index_level_rect(const struct tg_line *line, int levelidx, int rectidx);
|
|
313
|
-
bool tg_line_nearest_segment(const struct tg_line *line,
|
|
314
|
+
bool tg_line_nearest_segment(const struct tg_line *line,
|
|
314
315
|
double (*rect_dist)(struct tg_rect rect, int *more, void *udata),
|
|
315
316
|
double (*seg_dist)(struct tg_segment seg, int *more, void *udata),
|
|
316
317
|
bool (*iter)(struct tg_segment seg, double dist, int index, void *udata),
|
|
317
318
|
void *udata);
|
|
318
|
-
void tg_line_line_search(const struct tg_line *a, const struct tg_line *b,
|
|
319
|
-
bool (*iter)(struct tg_segment aseg, int aidx, struct tg_segment bseg,
|
|
319
|
+
void tg_line_line_search(const struct tg_line *a, const struct tg_line *b,
|
|
320
|
+
bool (*iter)(struct tg_segment aseg, int aidx, struct tg_segment bseg,
|
|
320
321
|
int bidx, void *udata),
|
|
321
322
|
void *udata);
|
|
322
323
|
double tg_line_length(const struct tg_line *line);
|
|
@@ -326,7 +327,7 @@ double tg_line_length(const struct tg_line *line);
|
|
|
326
327
|
/// Functions for working directly with the tg_poly type.
|
|
327
328
|
///
|
|
328
329
|
/// There are no direct spatial predicates for tg_poly.
|
|
329
|
-
/// If you want to perform operations like "intersects" or "covers" then you
|
|
330
|
+
/// If you want to perform operations like "intersects" or "covers" then you
|
|
330
331
|
/// must upcast the poly to a tg_geom, like such:
|
|
331
332
|
///
|
|
332
333
|
/// ```
|
data/lib/tg/geometry/version.rb
CHANGED
data/script/vendor_libs.rb
CHANGED
|
@@ -14,24 +14,24 @@ PINS = {
|
|
|
14
14
|
tg: {
|
|
15
15
|
repo: "https://github.com/tidwall/tg.git",
|
|
16
16
|
ref: "main",
|
|
17
|
-
commit: "
|
|
18
|
-
sha256: "
|
|
17
|
+
commit: "532fc38e1a7bd440339cf83259a9d7983f04ad69",
|
|
18
|
+
sha256: "dbf9a49d5ff326974312e94fb39c5687260a2c2b27b10971b24635ed6f79184c",
|
|
19
19
|
target: "tg",
|
|
20
20
|
files: %w[tg.c tg.h LICENSE README.md]
|
|
21
21
|
},
|
|
22
22
|
rtree: {
|
|
23
23
|
repo: "https://github.com/tidwall/rtree.c.git",
|
|
24
|
-
ref: "v0.
|
|
25
|
-
commit: "
|
|
26
|
-
sha256: "
|
|
24
|
+
ref: "v0.6.1",
|
|
25
|
+
commit: "eebc774929f89fd5f4095f7c8835a87f2d2fb73f",
|
|
26
|
+
sha256: "6779f4b2c9df8f199907d26c3fba11bc07c6f923d80881577c19f50119e15177",
|
|
27
27
|
target: "rtree",
|
|
28
28
|
files: %w[rtree.c rtree.h LICENSE README.md]
|
|
29
29
|
},
|
|
30
30
|
json: {
|
|
31
31
|
repo: "https://github.com/tidwall/json.c.git",
|
|
32
32
|
ref: "main",
|
|
33
|
-
commit: "
|
|
34
|
-
sha256: "
|
|
33
|
+
commit: "104d8cbf5d09ceba37d469574cbf5696349bcaf1",
|
|
34
|
+
sha256: "764155b839b910f45aaaf0d0881a47570d4ef0919465c5117c7658ab3dac0594",
|
|
35
35
|
target: "json",
|
|
36
36
|
files: %w[json.c json.h LICENSE]
|
|
37
37
|
}
|
|
@@ -74,6 +74,10 @@ def normalize_tree!(directory)
|
|
|
74
74
|
next if File.symlink?(path)
|
|
75
75
|
|
|
76
76
|
if File.file?(path)
|
|
77
|
+
if %w[.c .h].include?(File.extname(path))
|
|
78
|
+
source = File.binread(path)
|
|
79
|
+
File.binwrite(path, source.gsub(/[ \t]+(?=\r?$)/, ""))
|
|
80
|
+
end
|
|
77
81
|
File.chmod(0o644, path)
|
|
78
82
|
File.utime(NORMALIZED_MTIME, NORMALIZED_MTIME, path)
|
|
79
83
|
elsif File.directory?(path)
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tg_geometry
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Roman Haydarov
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: rake
|
|
@@ -187,7 +186,6 @@ metadata:
|
|
|
187
186
|
homepage_uri: https://github.com/roman-haidarov/tg_geometry
|
|
188
187
|
source_code_uri: https://github.com/roman-haidarov/tg_geometry/tree/main
|
|
189
188
|
changelog_uri: https://github.com/roman-haidarov/tg_geometry/blob/main/CHANGELOG.md
|
|
190
|
-
post_install_message:
|
|
191
189
|
rdoc_options: []
|
|
192
190
|
require_paths:
|
|
193
191
|
- lib
|
|
@@ -202,8 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
202
200
|
- !ruby/object:Gem::Version
|
|
203
201
|
version: '0'
|
|
204
202
|
requirements: []
|
|
205
|
-
rubygems_version: 3.
|
|
206
|
-
signing_key:
|
|
203
|
+
rubygems_version: 3.6.7
|
|
207
204
|
specification_version: 4
|
|
208
205
|
summary: Native extension for TG::Geometry parsing, predicates, immutable indexes,
|
|
209
206
|
FeatureSource imports, registries, low-level wrappers, packed point batches, and
|