Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Obstacle avoidance for lines #359

Closed
wants to merge 12 commits into from
Closed

Obstacle avoidance for lines #359

wants to merge 12 commits into from

Conversation

amolenaar
Copy link
Member

@amolenaar amolenaar commented Oct 31, 2021

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Documentation content changes

What is the current behavior?

Lines are just straight.

Issue Number: #360

What is the new behavior?

Gaphas has code that support object avoidance in the canvas.

  • When a new line is drawn, the line tries to avoid obstacles
  • When an element is moved, the lines should move aside
  • When an element is moved, connected lines should reroute
  • Avoidance for normal lines
  • Avoidance for orthogonal lines
  • Sometimes the routing algorithm "hangs". Esp. when the paths are more complicated.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Try examples/demo.py. The (experimental) collision avoidance code is activated there.

@amolenaar amolenaar marked this pull request as draft October 31, 2021 13:54
@amolenaar amolenaar linked an issue Oct 31, 2021 that may be closed by this pull request
@amolenaar amolenaar self-assigned this Oct 31, 2021
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Nov 10, 2021

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 0.18%.

Quality metrics Before After Change
Complexity 3.05 ⭐ 2.99 ⭐ -0.06 👍
Method Length 42.38 ⭐ 42.14 ⭐ -0.24 👍
Working memory 7.34 🙂 7.29 🙂 -0.05 👍
Quality 73.41% 🙂 73.59% 🙂 0.18% 👍
Other metrics Before After Change
Lines 2051 2090 39
Changed files Quality Before Quality After Quality Change
examples/demo.py 70.26% 🙂 70.24% 🙂 -0.02% 👎
gaphas/geometry.py 66.04% 🙂 66.60% 🙂 0.56% 👍
gaphas/item.py 83.28% ⭐ 83.54% ⭐ 0.26% 👍
gaphas/quadtree.py 78.43% ⭐ 78.75% ⭐ 0.32% 👍
gaphas/segment.py 67.42% 🙂 67.42% 🙂 0.00%
gaphas/aspect/connector.py 84.77% ⭐ 84.98% ⭐ 0.21% 👍

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
gaphas/geometry.py intersect_line_line 15 🙂 247 ⛔ 15 😞 33.49% 😞 Try splitting into smaller methods. Extract out complex expressions
examples/demo.py create_window 4 ⭐ 676 ⛔ 9 🙂 47.90% 😞 Try splitting into smaller methods
gaphas/geometry.py point_on_rectangle 17 🙂 138 😞 10 😞 48.57% 😞 Try splitting into smaller methods. Extract out complex expressions
gaphas/segment.py LineSegment.merge_segment 9 🙂 165 😞 10 😞 52.62% 🙂 Try splitting into smaller methods. Extract out complex expressions
gaphas/item.py Element.__init__ 0 ⭐ 200 😞 13 😞 53.21% 🙂 Try splitting into smaller methods. Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

@amolenaar amolenaar changed the base branch from master to main March 23, 2022 19:35
@amolenaar
Copy link
Member Author

Maybe I'll pick this up later...

@amolenaar amolenaar closed this Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Line routing
1 participant