feat: make crosswalk size a constraint the geometry stage reads
Every zebra was six stripes at 3m by 0.45m on a 0.9m pitch, all literals. Depth and stripe count are now a constraint, junction-crosswalk-size, and the loop reads them. The span across the road stays derived rather than stored: it is count times pitch, and pitch is fixed because stripe and gap widths are standardised while the road they cross is not. Widening a crossing means adding stripes, which is what a real one does, and it is why the span quantises in 0.9m steps. That also fixes a span pinned at 4.95m regardless of the street. Measured, every crossing sat on a 6.50m carriageway and covered under four fifths of it. The default now follows the segment width — both directions, since a crossing spans the carriageway — giving eight stripes and 6.74m, reaching the kerb rather than stopping short. Fixture baselines move for exactly two entries on the one area with crossings; the area without them is untouched. No handle is published yet. design.md requires proving compileGeometry() consumes a parameter before any grip is drawn — the rule left over from profile.interval shipping a handle that did nothing — so the grips come next, on a value already known to work. Adding the kind made the client's exhaustive scalar switch fail to compile, which is the check working: size is a pair and has no dragged-scalar form, so that case now says so and throws rather than writing half a value. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
84c82f3f09
commit
f3924caa5c
10 files changed
+176
-13
No files matched your search
@@ -115,6 +115,7 @@ const KIND_LABELS: Record<ConstraintKind, string> = {
|
||||
'junction-cutback': '进口 cutback',
|
||||
'junction-corner-radius': '角部圆角',
|
||||
'junction-crosswalk-inset': '斑马线退让',
|
||||
'junction-crosswalk-size': '斑马线尺寸',
|
||||
'junction-stop-line-offset': '停止线偏移',
|
||||
};
|
||||
|
||||
|
||||
@@ -108,6 +108,12 @@ export function constraintValueFor(
|
||||
return { insetMeters: Math.max(0, scalar) };
|
||||
case 'junction-stop-line-offset':
|
||||
return { offsetMeters: Math.max(0, scalar) };
|
||||
case 'junction-crosswalk-size':
|
||||
// Size is a pair — depth and stripe count — so no single dragged scalar
|
||||
// produces it, and the solver emits no handle of this kind. Reaching here
|
||||
// means one appeared without a matching input path; failing loudly beats
|
||||
// writing half a value.
|
||||
throw new Error('junction-crosswalk-size has no scalar form; it is written by the element size controls');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,10 @@ export const JUNCTION_KINDS = [
|
||||
'junction-cutback',
|
||||
'junction-corner-radius',
|
||||
...CONTROL_KINDS,
|
||||
// Size is deliberately outside CONTROL_KINDS: it has no handle yet, and its
|
||||
// value is a pair rather than the scalar the parameter panel renders. It joins
|
||||
// the panel when the corner grips exist to drive it.
|
||||
'junction-crosswalk-size',
|
||||
] as const;
|
||||
|
||||
export type RoadConstraintKind = (typeof ROAD_KINDS)[number];
|
||||
@@ -98,6 +102,7 @@ export type ConstraintValue =
|
||||
| { offsetMeters: number; transition?: Transition }
|
||||
| { widthMeters: number; transition?: Transition }
|
||||
| { boundaryIndex: number; offsetMeters: number; transition?: Transition }
|
||||
| { depthMeters: number; stripeCount: number }
|
||||
| { cutbackMeters: number }
|
||||
| { radiusMeters: number }
|
||||
| { insetMeters: number };
|
||||
|
||||
Reference in new issue
Block a user