reworked find isolated connection; fixed computation error on geometry#24
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates Omega-Prime’s map segmentation logic by reworking how isolated lane connections are detected/merged into intersections and by changing how segment polygons are computed for improved performance and corrected geometry behavior.
Changes:
- Bump project version to
0.3.0. - Update
_compute_segment_polygonto buffer the combined lane centerlines directly and simplify the result before hull computation. - Rework
find_isolated_connectionsand adjustinit_intersectionsordering so components that border exactly one intersection can be absorbed into it.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
pyproject.toml |
Version bump to 0.3.0. |
omega_prime/mapsegment.py |
Simplifies segment polygon computation by buffering a MultiLineString and simplifying prior to hull. |
omega_prime/maposicenterlinesegmentation.py |
Reorders intersection initialization and reworks isolated-connection classification/absorption logic. |
docs/notebooks/tutorial_projections.ipynb |
Minor notebook source formatting change (newline removal). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| G = self.create_non_intersecting_lane_graph() | ||
| isolated_connections = [] | ||
| new_connections = [] | ||
| segment_name_type = type(next(iter(self.lane_segment_dict.values()))) | ||
|
|
There was a problem hiding this comment.
segment_name_type = type(next(iter(self.lane_segment_dict.values()))) will raise StopIteration when lane_segment_dict is empty (e.g., recordings/maps with zero lanes). Consider deriving the SegmentName type without iterating values (e.g., define it once at class/init level and reuse), or guard with an early return when self.lane_segment_dict is empty.
Reworked
find_isolated_connectionsChanged how
_compute_segment_polygoncombines the lanes for improved performance.