Skip to content

Commit

Permalink
Merge pull request #48 from jannikmi/2.2.3
Browse files Browse the repository at this point in the history
v2.2.3
  • Loading branch information
jannikmi committed Aug 11, 2022
2 parents 899f223 + 5a56143 commit 80c7184
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
10 changes: 8 additions & 2 deletions CHANGELOG.rst
@@ -1,16 +1,22 @@
Changelog
=========

2.2.3 (2022-10-11)
-------------------

* reverting changes of version ``2.2.2``


2.2.2 (2022-07-10)
-------------------

* minor improvement in the visibility graph computation: if a candidate point is closer to the query point than both vertices of an edge, it surely lies in front of that edge -> skip actually checking point visibility for this edge
* [DEPRECATED]


2.2.1 (2022-07-10)
-------------------

* packaging completely based on pyproject.toml (poetry)
* packaging completely based on ``pyproject.toml`` (poetry)
* CI/CD: automatic publishing based on GitHub Actions

2.2.0 (2021-01-25)
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -19,7 +19,7 @@ hook:
@pre-commit install
@pre-commit run --all-files

hook2:
hookupdate:
@pre-commit autoupdate

clean:
Expand Down
22 changes: 8 additions & 14 deletions extremitypathfinder/helper_fcts.py
Expand Up @@ -462,6 +462,7 @@ def find_visible(vertex_candidates, edges_to_check):
if len(vertex_candidates) == 0:
return visible_vertices

# used for increasing the priority of "closer" edges
priority_edges = set()
# goal: eliminating all vertices lying 'behind' any edge
# TODO improvement in combination with priority: process edges roughly in sequence, but still allow jumps
Expand Down Expand Up @@ -569,26 +570,19 @@ def find_visible(vertex_candidates, edges_to_check):
if len(vertices_to_check) == 0:
continue

# if a candidate is farther away from the query point than both vertices of the edge,
# it surely lies behind the edge
# ATTENTION: even if a candidate is closer to the query point than both vertices of the edge,
# it still needs to be checked!
v1_dist = v1.get_distance_to_origin()
v2_dist = v2.get_distance_to_origin()

# if a candidate is farther away from the query point than both vertices of the edge,
# it surely lies behind the edge
max_distance = max(v1_dist, v2_dist)
vertices_behind = {v for v in vertices_to_check if v.get_distance_to_origin() > max_distance}

# they do not have to be checked, no intersection computation necessary
# TODO improvement: increase the neighbouring edges' priorities when there were extremities behind
vertices_to_check.difference_update(vertices_behind)

# if a candidate is closer to the query point than both vertices of the edge,
# it surely lies in front of the edge -> doesn't need to be checked
# Edge case: vertices directly on the edge are allowed (not eliminated)! -> also skip equally distant points
min_distance = min(v1_dist, v2_dist)
# used for increasing the priority of "closer" edges
vertices_in_front = {v for v in vertices_to_check if v.get_distance_to_origin() <= min_distance}
vertices_to_check.difference_update(vertices_in_front)

vertices_in_front = set()
# for all remaining vertices v it has to be tested if the line segment from query point (=origin) to v
# has an intersection with the current edge p1---p2
p1 = v1.get_coordinates_translated()
Expand All @@ -609,10 +603,10 @@ def find_visible(vertex_candidates, edges_to_check):
# (prioritize them)
# they lie in front and hence will eliminate other vertices faster
# the fewer vertex candidates remain, the faster the procedure
# TODO improvement: increase priority every time and draw highest priority items
# TODO possible improvement: increase priority every time and draw highest priority items
# but this involves sorting (expensive for large polygons!)
# idea: work with a list of sets, add new set for higher priority, no real sorting, but still managing!
# TODO test speed impact
# test speed impact.
for e in vertices_in_front:
# only add the neighbour edges to the priority set if they still have to be checked!
if isinstance(e, PolygonVertex):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "extremitypathfinder"
version = "2.2.2"
version = "2.2.3"
license = "MIT"
readme = "README.rst"
repository = "https://github.com/jannikmi/extremitypathfinder"
Expand Down

0 comments on commit 80c7184

Please sign in to comment.