Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Joseph Siddons
GeoSpatialTools
Commits
4f6461e8
Commit
4f6461e8
authored
5 months ago
by
Joseph Siddons
Browse files
Options
Download
Plain Diff
Merge remote-tracking branch 'upstream/main' into bounding_rect
parents
16bd1d75
9a529acd
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
5 deletions
+35
-5
GeoSpatialTools/octtree.py
GeoSpatialTools/octtree.py
+8
-2
GeoSpatialTools/quadtree.py
GeoSpatialTools/quadtree.py
+8
-2
README.md
README.md
+1
-1
test/test_octtree.py
test/test_octtree.py
+10
-0
test/test_quadtree.py
test/test_quadtree.py
+8
-0
No files found.
GeoSpatialTools/octtree.py
View file @
4f6461e8
...
...
@@ -224,8 +224,14 @@ class SpaceTimeRectangle:
# Other is fully south of self
return
False
# Handle east / west edges
return
self
.
_test_east_west
(
other
.
west
)
or
self
.
_test_east_west
(
other
.
east
return
(
self
.
_test_east_west
(
other
.
west
)
or
self
.
_test_east_west
(
other
.
east
)
# Fully contained within other
or
(
other
.
_test_east_west
(
self
.
west
)
and
other
.
_test_east_west
(
self
.
east
)
)
)
def
nearby
(
...
...
This diff is collapsed.
Click to expand it.
GeoSpatialTools/quadtree.py
View file @
4f6461e8
...
...
@@ -188,8 +188,14 @@ class Rectangle:
# Other is fully south of self
return
False
# Handle east / west edges
return
self
.
_test_east_west
(
other
.
west
)
or
self
.
_test_east_west
(
other
.
east
return
(
self
.
_test_east_west
(
other
.
west
)
or
self
.
_test_east_west
(
other
.
east
)
# Fully contained within other
or
(
other
.
_test_east_west
(
self
.
west
)
and
other
.
_test_east_west
(
self
.
east
)
)
)
def
nearby
(
...
...
This diff is collapsed.
Click to expand it.
README.md
View file @
4f6461e8
...
...
@@ -10,7 +10,7 @@ to usage of type annotations.
As a dependency with
`pip`
```
bash
pip
install
git+git@git.noc.ac.uk
:
nocsurfaceprocesses/geospatialtools.git
pip
install
git+
ssh://
git@git.noc.ac.uk
/
nocsurfaceprocesses/geospatialtools.git
```
## Neighbours
...
...
This diff is collapsed.
Click to expand it.
test/test_octtree.py
View file @
4f6461e8
...
...
@@ -72,6 +72,16 @@ class TestRect(unittest.TestCase):
)
assert
not
rect
.
intersects
(
test_rect
)
def
test_inside
(
self
):
# TEST: rectangle fully inside another
d
=
datetime
(
1978
,
5
,
17
,
2
,
33
)
dt
=
timedelta
(
days
=
4
,
hours
=
7
)
outer
=
Rectangle
(
-
10
,
10
,
d
,
-
10
,
10
,
dt
)
inner
=
Rectangle
(
-
5
,
5
,
d
,
-
5
,
5
,
timedelta
(
days
=
1
,
hours
=
3
))
assert
outer
.
intersects
(
inner
)
assert
inner
.
intersects
(
outer
)
class
TestOctTree
(
unittest
.
TestCase
):
def
test_divides
(
self
):
...
...
This diff is collapsed.
Click to expand it.
test/test_quadtree.py
View file @
4f6461e8
...
...
@@ -46,6 +46,14 @@ class TestRect(unittest.TestCase):
test_rect
=
Rectangle
(
-
140
,
-
60
,
20
,
60
)
assert
rect
.
intersects
(
test_rect
)
def
test_inside
(
self
):
# TEST: rectangle fully inside another
outer
=
Rectangle
(
-
10
,
10
,
-
10
,
10
)
inner
=
Rectangle
(
-
5
,
5
,
-
5
,
5
)
assert
outer
.
intersects
(
inner
)
assert
inner
.
intersects
(
outer
)
class
TestQuadTree
(
unittest
.
TestCase
):
def
test_divides
(
self
):
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment