Outlet zone step hold

- LinkBlend holds a cross-window feeder point that steps one block down as a CASCADE out of a held point, so the restyled last point of an outlet zone keeps its grade as in-window grading does
- Plunge distance fields stop at the bowl radius instead of LIMIT, with identical beds
- Test: cross-window settling keeps a one-block step at the end of an outlet zone
This commit is contained in:
Brian Neumann-Fopiano committed 2026-11-02 06:21:21 -05:00
1 parent 6aafec196b
commit 90205dc5fe
3 files changed
+41 -6

No files matched your search

@@ -82,11 +82,15 @@ public final class LinkBlend {
fixed[0] = held || heldStart || style[0] == ReachStyle.POND_OUTLET;
for (int point = 1; point < style.length; point++) {
held = held && nearLip(lips, feeder.xs()[point], feeder.zs()[point], feeder.halfWidth()[point]);
fixed[point] = held || style[point] == ReachStyle.POND_OUTLET;
fixed[point] = held || style[point] == ReachStyle.POND_OUTLET || zoneStep(feeder, fixed, point);
}
return fixed;
}
private static boolean zoneStep(Reach feeder, boolean[] fixed, int point) {
return fixed[point - 1] && feeder.style()[point] == ReachStyle.CASCADE && feeder.grade()[point - 1] - feeder.grade()[point] == 1;
}
private static boolean nearLip(List<PondMask> lips, float x, float z, float halfWidth) {
for (PondMask lip : lips) {
if (ReachShaper.nearLip(lip, x, z, halfWidth)) {
@@ -53,13 +53,13 @@ final class RiffleProfile {
}
DistanceField distances = new DistanceField(heads);
for (Map.Entry<Crest, Seeds> crest : crests.entrySet()) {
int[] output = distances.measure(crest.getValue(), DistanceField.ANY_LEVEL);
int[] output = distances.measure(crest.getValue(), DistanceField.ANY_LEVEL, LIMIT);
if (output != null) {
fields.add(new Field(crest.getKey(), output));
}
}
for (Map.Entry<Fall, Seeds> fall : feet.entrySet()) {
int[] output = distances.measure(fall.getValue(), fall.getKey().foot());
int[] output = distances.measure(fall.getValue(), fall.getKey().foot(), fall.getKey().reach());
if (output != null) {
plunges.add(new Plunge(fall.getKey(), output));
}
@@ -191,6 +191,10 @@ final class RiffleProfile {
return Math.clamp(PLUNGE_RADIUS_RATIO * drop(), PLUNGE_MIN_RADIUS, PLUNGE_MAX_RADIUS);
}
int reach() {
return (int) Math.ceil(10D * radius());
}
@Override
public int compareTo(Fall other) {
return foot != other.foot ? Integer.compare(foot, other.foot) : Integer.compare(top, other.top);
@@ -224,13 +228,15 @@ final class RiffleProfile {
private final int[] previous = new int[GRID * GRID];
private final int[] first = new int[LIMIT];
private int level;
private int limit;
private DistanceField(int[] heads) {
this.heads = heads;
}
private int[] measure(Seeds seeds, int passable) {
private int[] measure(Seeds seeds, int passable, int reach) {
level = passable;
limit = reach;
Arrays.fill(distances, LIMIT);
Arrays.fill(next, -1);
Arrays.fill(previous, -1);
@@ -247,7 +253,7 @@ final class RiffleProfile {
}
private void offer(int cell, int distance) {
if (distance + REMAINING[cell] >= LIMIT) {
if (distance + REMAINING[cell] >= limit) {
return;
}
if (distances[cell] < LIMIT) {
@@ -276,7 +282,7 @@ final class RiffleProfile {
}
private void spread() {
for (int distance = 0; distance < LIMIT; distance++) {
for (int distance = 0; distance < limit; distance++) {
while (first[distance] >= 0) {
int cell = first[distance];
remove(cell);