Finish curved brinks

- Keep a horseshoe tip off the outlet zone end and reach start
- Scan segments upstream of a fall for horseshoe water in settlement
- Measure the brink cap from the real brink and pin it at 11
- Replace the angled 1.25 bound with rule and square-on checks
- Add behaviour tests for every ReachGeometry guard and use site
This commit is contained in:
Brian Fopiano committed 2026-11-03 07:31:45 -05:00
1 parent 855c2e7f61
commit c4a076b587
4 files changed
+396 -18

No files matched your search

@@ -77,7 +77,7 @@ public final class PondChannelSettlement {
BitSet visited = new BitSet(width * (bounds.maxZ() - bounds.minZ() + 1));
for (Reach reach : reaches) {
for (int segment = 0; segment + 1 < reach.xs().length; segment++) {
if (Math.min(WaterHeads.snap(reach.grade()[segment], seaLevel), WaterHeads.snap(reach.grade()[segment + 1], seaLevel)) >= WaterHeads.snap(level, seaLevel)) {
if (WaterHeads.snap(brinks.lowestGrade(reach, segment), seaLevel) >= WaterHeads.snap(level, seaLevel)) {
continue;
}
float radius = Math.max(reach.halfWidth()[segment], reach.halfWidth()[segment + 1]) + 1f;
@@ -113,11 +113,22 @@ final class ReachGeometry {
return straight;
}
double ratio = choice.distance / inner;
boolean below = at - shifts[curve] * (1D - ratio * ratio) >= middles[curve];
double moved = shifts[curve] * (1D - ratio * ratio);
if (shifts[curve] > 0D) {
return below ? straight : segments[curve];
return at - moved >= middles[curve] ? straight : segments[curve];
}
return below ? segments[curve] + 1 : straight;
return at - moved > middles[curve] ? segments[curve] + 1 : straight;
}
int lowestGrade(Reach reach, int segment) {
int[] grade = reach.grade();
int lowest = Math.min(grade[segment], grade[segment + 1]);
for (int curve = 0; curve < segments.length; curve++) {
if (shifts[curve] < 0D && along[segment] < middles[curve] && along[segment + 1] > starts[curve]) {
lowest = Math.min(lowest, grade[segments[curve] + 1]);
}
}
return lowest;
}
private static double[] along(Reach reach) {
@@ -183,5 +194,9 @@ final class ReachGeometry {
int point(ReachCursor.Choice choice) {
return of(choice.reach).point(choice);
}
int lowestGrade(Reach reach, int segment) {
return of(reach).lowestGrade(reach, segment);
}
}
}