Repository navigation
Report which cell gives each corridor, and let callers ask for a fair split - #248
Merged
Gonzalo-Mier merged 7 commits intoSep 3, 2026
Conversation
The rule that picks the cell was decided inside the carving loop and only its geometry came out, so it could be checked only through the shape it left behind. corridorShares() now holds the rule and generateHeadlands() applies what it returns.
Buffering a neighbour to find the shared border turns a single shared corner into a few millimetres of border on every edge that reaches it. Five cells meeting at one point were all neighbours of each other, and a disc came out of the middle. A border shorter than a centimetre is a corner.
CorridorHL always gave the whole corridor to the smaller cell, splitting evenly only when the two were the same size. corridorShares() now takes a CorridorShareMode, and SYMMETRIC always splits evenly regardless of size, so the two rules can be compared against each other. setShareMode() and getShareMode() pick which one generateHeadlands() applies; ASYMMETRIC stays the default, so existing behaviour is unchanged.
Tutorial 7.2 folded corridorShares into the same figure as ConstHL, ReqHL and CorridorHL, so double headland, asymmetric corridor and symmetric corridor all looked alike. Tutorial 3.3 now shows the three side by side on the same L-shaped field, with the route each one leaves so the difference in cost is visible, not just the area.
Gonzalo-Mier
reviewed
Sep 3, 2026
File-scope constexpr doubles hid them from anyone reading the class in the header. No behavior change.
Contributor
Author
|
CorridorHL currently creates corridors that are wider than they should be; this will be fixed in the next update. |
Contributor
Author
|
@Gonzalo-Mier I think you forgot to close this PR, so I wanted to remind you. |
Member
|
Thank you for the notice and the PR @u33549 |
This was referenced Nov 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CorridorHL::generateHeadlandsdecides, for every pair of cells that share a border, which one gives up the corridor and how much — but that decision was made and used in the same breath, inside the carving loop. Nothing outside the carved geometry could see it. This PR pulls the rule out into its own method, fixes a real bug the pull surfaced, and adds a second rule to compare the first one against.corridorShares, the rule on its owngenerateHeadlandsnow calls this and applies what it returns — same output as before, just no longer the only way to find out. A caller that needs the decision itself (a report, a test, a figure) doesn't have to re-derive the rule from the carved shape and risk it drifting from what the generator actually does.A bug the pull surfaced
Finding the shared border buffers the neighbour cell by a tolerance and intersects it with each edge. That tolerance turns a single shared corner into a few millimetres of "border" on every edge that reaches it. It's invisible with two cells, but five cells meeting at one point were all reported as neighbours of every other, and the corridor carved a disc out of the middle instead of five separate cuts. Fixed by giving the length filter its own, much looser threshold (
kMinBorder = 1e-2) than the buffer tolerance (kTol = 1e-3) — a border under a centimetre is a corner, not a border. Covered bysharesTreatACornerAsNoBorder, a five-slice pie test.CorridorShareMode: a second rule to compare againstcorridorSharesalways gave the whole corridor to the smaller cell (by perimeter), splitting evenly only when the two were within tolerance of the same size. There was no way to ask for the even split on purpose, which is exactly what's needed to measure the asymmetric rule's effect — the two only differ in which cell gives up how much, not in how much corridor opens overall.ASYMMETRICstays the default, so nothing that already callsgenerateHeadlandsor the no-modecorridorSharesoverload changes behaviour.Tutorial
Tutorial 7.2 had grown a
corridorSharesdemo into the same figure as the route, at the same zoom as every other headland tutorial — three different concepts drawn on top of each other, indistinguishable at a glance. Removed. In its place, Tutorial 3.3 givesCorridorHLits own section: one L-shaped field, decomposed once, headlanded three different ways (double headland,ASYMMETRICcorridor,SYMMETRICcorridor), each with its own route and path (DubinsCurvesCC) so the cost difference is visible, not just the leftover area.