Skip to content

Issue #213: Project invalid trajectories inside walkable area #506

Open
awestphal1 wants to merge 23 commits intoPedestrianDynamics:mainfrom
awestphal1:main
Open

Issue #213: Project invalid trajectories inside walkable area #506
awestphal1 wants to merge 23 commits intoPedestrianDynamics:mainfrom
awestphal1:main

Conversation

@awestphal1
Copy link
Collaborator

@awestphal1 awestphal1 commented Dec 8, 2025

Added a new preprocessing directory containing the trajectory_projector file.

The function correct_invalid_trajectories identifies every invalid point of a trajectory and moves it outside the geometry.

The direction and the new distance between the point and the wall are computed using trigonometric methods and linear interpolation. Points that lie deeper inside a wall are shifted a shorter distance outward, while points that are already close to the boundary are moved farther.

Closes #213

@schroedtert schroedtert self-requested a review December 8, 2025 13:22
Copy link
Collaborator

@schroedtert schroedtert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just the start to get the unit tests running again. Took a brief look at the pre-commit checks, some of them fail due to wrong format of the docstrings, which should be easily fixable. If you need help setting up the pre-commit checks locally let me know. I will have a more in-depth review in the next days.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move the tests into a preprocessing directory as you did for the implementation, e.g., tests/unit_tests/preprocessing/test_trajectory_projector.py?

Copy link
Collaborator

@schroedtert schroedtert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I finally had the time for a more in-depth review, but I skipped the math part, maybe someone else will have a look at that.

There are some general remarks, which we may have to discuss with the others. Personally I would prefer to get the functionality quickly into the main branch and do optimizations then. Otherwise it will take too long to get it included. What do you think.

  • You transfer the shapely data structures into float values. Would't it be easier to just keep them and pass them to the functions?
  • When dealing with DataFrames, Numpy and Shapely there is usually a way to avoid looping over everything and performing an action on an individual row/data point/geometry. My feeling tells me, that is also possible here, but I would also need a deeper dive into the code test it.

I really like that you already added some unit tests! This gives me a lot of confidence that this works as expected. And as an additional advantage it make optimization and refactoring way easier!

If you don't understand one of the comments or disagree, don't hesitate to contact me (RC or answer to the comment). The comments marked as optional you can resolve yourself if currently too much effort.

a is equal to back_distance \n
b is equal to start_distance \n
c is equal to end_distance \n

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is highly optional!

If you have it already or it is not too difficult to create, a picture/plot showing the projection and the corresponding parameters would be great.

Copy link
Collaborator Author

@awestphal1 awestphal1 Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have made a plot to visualize the parameters, but I don’t know where to put it yet. I attached it here.
plot_different_parameters.pdf
I also changed the paramters start_-/end_distance to min_-/max_distance, because it seems easier to understand their purpose this way.

@awestphal1 awestphal1 marked this pull request as draft January 6, 2026 15:05
@codecov
Copy link

codecov bot commented Mar 3, 2026

Codecov Report

❌ Patch coverage is 90.34749% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.99%. Comparing base (dd2ead9) to head (cb39276).

Files with missing lines Patch % Lines
pedpy/preprocessing/trajectory_projector.py 90.00% 23 Missing ⚠️
pedpy/__init__.py 93.10% 2 Missing ⚠️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@awestphal1 awestphal1 marked this pull request as ready for review March 3, 2026 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Project invalid trajectories inside walkable area

2 participants