fix: verify and align complex junction layer seams
This commit is contained in:
1 parent
79590d3d0f
commit
cfb3593a0b
15 files changed
+1122
-57
No files matched your search
@@ -6,3 +6,4 @@
|
||||
- [Direct Edit Solver And API](./direct-edit-api.md) -- pure constraint solving, preview/save endpoints, version protection, and rebase behavior.
|
||||
|
||||
- [Junction Island Contact](./junction-island-contact.md) -- confirmed target contract for full crossing-edge contact, dynamic island legs and the six-point green region (implementation pending).
|
||||
- [Junction Layer Seams](./junction-layer-seams.md) -- metric seam audit, source identity mapping, and both-end corridor trims.
|
||||
@@ -0,0 +1,81 @@
|
||||
# Junction layer seams
|
||||
|
||||
## Scope and source contracts
|
||||
|
||||
Complex-junction seams use a **0.01 m** numerical tolerance in local metric
|
||||
coordinates. This is internal stitching precision, not OSM survey accuracy.
|
||||
`test/helpers/junction-seams.js` audits published features against source
|
||||
identities in `junction_structure`; it does not call the geometry builders to
|
||||
manufacture expected geometry.
|
||||
|
||||
- Exterior surfaces match the complete `directional_road_ids` set of a
|
||||
carriageway. Core and pavement match `cluster_id`; approaches match
|
||||
`carriageway_key`.
|
||||
- Native lanes use `road_id` and travel-direction `lane_index`. Preview lanes
|
||||
use a combined cross-section index running from `outer.right` to `outer.left`.
|
||||
Map outgoing lanes in reverse order, followed by incoming lanes in forward
|
||||
order. Do not equate these two index spaces or choose a nearest lane globally.
|
||||
- Edge lines match the source road and `side`. Separators match the lane pair;
|
||||
the boundary between opposite directions belongs to the road centre marking.
|
||||
Centre markings match the complete `directional_road_ids` set and a primary
|
||||
`road_id` belonging to that set; a partial source match is not sufficient.
|
||||
- Sidewalk corners match `corner_key` and strips from their two source arms.
|
||||
Absence is acceptable only for disabled source sidewalks or an explicit
|
||||
rejection identifying that exact corner. A cluster-wide fallback diagnostic
|
||||
must not excuse a missing corner elsewhere.
|
||||
|
||||
## Both ends of a corridor
|
||||
|
||||
`trimRoadAtComplexClusters(road, junctionPlans, clusters, boundaries)` in
|
||||
`native-road.js` calculates **both** endpoint cutbacks from the original source
|
||||
polyline and each cluster's `outer.stationMeters`, then calls `trimLineRange`
|
||||
once. Road surfaces, sidewalks, edges, centre lines and native lanes share it.
|
||||
|
||||
Wrong: select `startCluster || endCluster` as the only trim owner, or trim
|
||||
sequentially using the second station on the shortened line. Correct: resolve
|
||||
each endpoint independently and preserve intermediate source bends.
|
||||
|
||||
The first bug leaves the far approach covered by exterior pavement and its
|
||||
edge/lane endpoints tens of metres past the seam. Vertex-to-boundary checks can
|
||||
miss it because the long side edges still touch both seam endpoints.
|
||||
|
||||
## Measurements and failures
|
||||
|
||||
`auditJunctionSeams(model, geometry, structures)` returns each layer's `checked`,
|
||||
`failed`, `notApplicable` and identity-bearing `records`.
|
||||
|
||||
| Interface | Required measurement |
|
||||
| --- | --- |
|
||||
| Exterior surface / approach | Endpoint error and complete boundary segment coverage |
|
||||
| Approach / core and published pavement | Complete segment containment, respecting holes |
|
||||
| Native / preview lanes and solid edges | Corresponding endpoint or paint-cap midpoint |
|
||||
| Dashed edges, centre lines, separators | Support alignment and bounded terminal gap |
|
||||
| Corner / sidewalk strip | Both full end edges, with source-arm matching |
|
||||
|
||||
Missing expected objects fail; never iterate only detected objects and report an
|
||||
empty set as success. Segment coverage partitions at all boundary crossings, so
|
||||
interior notches cannot hide between fixed probes. Polygon holes remain holes.
|
||||
|
||||
Dashes do not need white paint across every seam. An outward road starts its
|
||||
dash sequence at the seam, so its first cap must coincide; the other end can
|
||||
leave a residual dash cycle. Current edge/separator cycles are 2 m paint + 2 m
|
||||
gap. Centre markings publish `dash_length_m` and `dash_gap_m`. Report these gaps
|
||||
separately from the 1 cm transverse alignment tolerance. The audit does not
|
||||
certify every individual dash, every double-line component, or interior paint
|
||||
continuity through a complex core where centre markings are not published.
|
||||
|
||||
## Required regression
|
||||
|
||||
Run `node test/junction-layer-seams.js` (also in `npm test`). To inspect every
|
||||
identity and measurement, run:
|
||||
|
||||
```sh
|
||||
node test/junction-layer-seams.js --report /private/tmp/junction-layer-seams.json
|
||||
```
|
||||
|
||||
Keep nonempty per-layer counts for straight/curved, one-way/two-way, local width
|
||||
and island edits, two-ended corridors, reordered input, current real OSM and
|
||||
explicitly sidewalk-enabled real OSM. Required negative controls: exactly 2 cm
|
||||
displacement, missing single/whole counterparts, wrong source identities,
|
||||
swapped lane indices, absent first anchored dash, a 2 cm interior notch and a
|
||||
hole. Do not loosen the tolerance or refresh unrelated fixture snapshots.
|
||||
@@ -0,0 +1,2 @@
|
||||
{"file": ".trellis/spec/backend/junction-island-contact.md", "reason": "检查接缝与诊断"}
|
||||
{"file": ".trellis/spec/backend/junction-layer-seams.md", "reason": "接缝矩阵、来源映射、两端裁切及负向验证"}
|
||||
@@ -0,0 +1,23 @@
|
||||
# Phase 3.4 提交批次(用户已确认)
|
||||
|
||||
2026-09-17:用户回复“可以”,授权以下两笔提交及接缝专项归档。
|
||||
|
||||
1. `fix: verify and align complex junction layer seams`
|
||||
- `src/compile/native-road.js`
|
||||
- `src/compile/complex-junction-facilities.js`
|
||||
- `test/helpers/junction-seams.js`
|
||||
- `test/junction-layer-seams.js`
|
||||
- `package.json`
|
||||
- `.trellis/spec/backend/index.md`
|
||||
- `.trellis/spec/backend/junction-layer-seams.md`
|
||||
- `.trellis/tasks/09-17-junction-layer-seams/`(需求、设计、实施、验收及上下文)
|
||||
|
||||
2. `docs: scope junction exclusion routing follow-up`
|
||||
- `.trellis/tasks/09-17-junction-exclusion-routing/`(规划与只读初审,无产品代码)
|
||||
|
||||
没有未识别的脏文件;没有 fixture 快照更新;不推送远端。
|
||||
确认后按上述顺序提交,再归档接缝专项并记录会话。
|
||||
排除区专项保持 planning,父任务保持已归档。
|
||||
|
||||
确认要求来源:`.trellis/workflow.md` Phase 3.4 第 5 步
|
||||
“Present the plan once, ask for one-shot confirmation”。
|
||||
@@ -0,0 +1,11 @@
|
||||
# 接缝审计设计
|
||||
|
||||
审计发布几何与来源身份,复用已有 BoundaryGraph/structure 中的接入关系。先在 test/helpers/junction-seams.js 建立独立测量,再由 test/junction-layer-seams.js 编译合成和真实场景。报告以 JSON 可序列化对象输出,各层记录身份、测量值、判定和覆盖数量;不新增产品 API。
|
||||
|
||||
面积接边测量两端及整段覆盖,不只检查顶点最近距离。线图层按方向与 lane_index 对应外部车道和 transition lane。对条纹/虚线按其连续支撑线或合法裁切终点评估,不要求白条填满所有空间。需先审计生成代码确定每层有效接缝契约,不能将所有图层强行套用道路面边界。
|
||||
|
||||
局部米制坐标以当前接缝作为原点,避免绝对经纬度距离与面积数值误差。几何辅助优先复用既有 polygon/segment 工具,但测试期望不能调用被测生成器重建同一结果。
|
||||
|
||||
修改范围:新增测量测试与 helper、package.json 测试入口;如发现局部构建缺陷,仅修改拥有实际接缝的 native-road/complex-junction 模块,并补独立反例。新规划器不纳入本专项。
|
||||
|
||||
风险:缺失对象容易导致空集通过;虚线和控制标线本来有间隙;曲线法线可能让端点不一致。用覆盖计数、明确不适用原因及人工损坏反例验证审计器。若需改变设施语义,先记录独立专项。
|
||||
@@ -0,0 +1,89 @@
|
||||
# 接缝专项验收证据
|
||||
|
||||
2026-09-17。实现与专项验收完成,用户已确认 Phase 3.4 提交及归档;父任务
|
||||
`junction-reference-fidelity` 保持归档。本次没有实施复杂绕障规划。
|
||||
|
||||
## 实际修复
|
||||
|
||||
真实 OSM 的两条相邻路口连接道路只选取一个端点所属 cluster 进行裁切。
|
||||
另一端的面边界没有真正形成接边,边线与车道线端点偏离约 28.9 / 34.4 m。
|
||||
旧顶点检查仍能通过,因为道路两条长边经过了应有接缝的两个端点。
|
||||
|
||||
`native-road.js` 现在从原始道路分别计算两端 station,一次裁切;道路面、
|
||||
边线、中心线、车道中心线和人行道共同使用这一规则,保留中间弯折。
|
||||
角部人行道的自交拒绝诊断改为具体 corner 身份,避免一个角部的拒绝
|
||||
掩盖另一个角部的意外缺失。设施省略规则没有更改。
|
||||
|
||||
## 测量矩阵与结果
|
||||
|
||||
完整契约见 `.trellis/spec/backend/junction-layer-seams.md`。
|
||||
|
||||
| 图层/接口 | checked | failed | notApplicable | 最大位置误差 m | 最大未覆盖长度 m |
|
||||
| --- | ---: | ---: | ---: | ---: | ---: |
|
||||
| 道路面 / 进口 / 最终铺装 | 172 | 0 | 0 | 0.003285 | 0.000262 |
|
||||
| 核心 / 进口 | 86 | 0 | 0 | 0 | < 0.000001 |
|
||||
| 道路边线 | 172 | 0 | 8 | 0.006183 | < 0.000001 |
|
||||
| 道路中心线 | 26 | 0 | 86 | 0.000005 | < 0.000001 |
|
||||
| 车道中心线 | 560 | 0 | 0 | 0.006149 | 0 |
|
||||
| 车道分隔线 | 362 | 0 | 194 | 0.000004 | 0.000002 |
|
||||
| 人行道 | 68 | 0 | 28 | 0 | 0 |
|
||||
|
||||
以上最大值向上取整。共 **13 个场景、1,446 个测量记录**,阈值始终
|
||||
为 0.01 m。`checked` 是接口记录数,包含同一图层不同接口及多场景,
|
||||
不是互不重复的道路数量。`notApplicable` 可与同一对象的有效测量并存,
|
||||
用于说明不要求连续白漆或不发布中心标线的接口。
|
||||
|
||||
场景包含单向直线/曲线、双向直线/曲线、真实 OSM 单路口/相邻路口、
|
||||
真实道路显式开启人行道、双向曲线相邻路口、单向/双向局部展宽、
|
||||
岛体位移、道路与 cluster 输入重排、虚线边线。
|
||||
|
||||
测试锁定每个场景各图层的 checked 数量,所有应连续接口须通过。
|
||||
每个图层有非空覆盖;源数据没有人行道的真实场景明确标记不适用,
|
||||
由显式开启人行道的真实场景提供角部接边验证。
|
||||
|
||||
负向测试验证:精确向东平移 2 cm、删除单个/整组必需对象、错误道路
|
||||
来源、交换车道序号、缺失外部人行道/分隔线、缺失起始锚定虚线、
|
||||
接边中部 2 cm 缺口及穿过接边的孔洞。原实现子代理中断留下的审计器
|
||||
还存在双向/驶出车道序号误配及缺失车道时异常,这些问题均已修正。
|
||||
|
||||
## 可复现命令
|
||||
|
||||
```sh
|
||||
node test/junction-layer-seams.js --report /private/tmp/junction-layer-seams.json
|
||||
node test/junction-island-offset.js
|
||||
npm test
|
||||
npm run test:client
|
||||
npx prettier --check src/compile/native-road.js src/compile/complex-junction-facilities.js test/helpers/junction-seams.js test/junction-layer-seams.js package.json
|
||||
git diff --check
|
||||
```
|
||||
|
||||
报告按场景和图层保存 checked/failed/notApplicable、对象身份、feature IDs、
|
||||
位置误差、未覆盖长度、虚线端部间隙及省略原因;临时报告可随时重建,
|
||||
不把大型机器报告作为仓库快照。
|
||||
|
||||
## 质量检查
|
||||
|
||||
- 专项最终 13 场景 / 1,446 接口通过;已加入 `npm test`。
|
||||
- `npm test` 中编译、结构、轨迹、投影、反例、设施、铺装、标线、
|
||||
接缝、编辑文档、修订存储、编辑 solver、Workbench API 和导入测试通过。
|
||||
最终 `test/fixtures.js:18` 仍因既有当前 OSM / 旧基线差异失败。
|
||||
全量运行时为 11 场景,后续新增的 2 场景及强化反例已单独完整重跑通过;
|
||||
此后没有修改生产几何代码。
|
||||
- TypeScript 检查、独立岛体位移回归、变更文件 Prettier、diff 检查通过。
|
||||
- 全仓 `format:check` 仅报告既有未改动的
|
||||
`src/compile/junction-facility-composition.js` 格式问题。
|
||||
- 独立 `trellis-check` 已复核裁切、来源匹配、面积完整接边、缺对象、
|
||||
车道映射及明确省略契约;未发现阻断问题。
|
||||
|
||||
## 明确限制
|
||||
|
||||
不把每个角部都能生成设施作为接缝验收条件。两个单向合成角部因自交被
|
||||
生成器明确拒绝;这些记录携带对应 corner 的拒绝原因,其他已发布角部
|
||||
仍必须完整接边。未实现新的角部设施语义。
|
||||
|
||||
虚线按接缝附近支撑线及合法端部间隙测量,起始锚点不能丢失;不声称
|
||||
验证整条道路的每根白条、双实/虚线每一组成部分或复杂核心内不存在的
|
||||
中心标线。路口外的所有内部标线连续性不是本审计的对象。
|
||||
|
||||
排除区最终铺装孔洞保留风险仅完成代码初审,尚未运行最终发布面的反例;
|
||||
保留在 `09-17-junction-exclusion-routing/research.md`,不能当成已修复。
|
||||
@@ -0,0 +1,2 @@
|
||||
{"file": ".trellis/spec/backend/junction-island-contact.md", "reason": "共享坐标与精度约定"}
|
||||
{"file": ".trellis/spec/backend/junction-layer-seams.md", "reason": "实施产生的共享接缝与两端裁切契约"}
|
||||
@@ -0,0 +1,13 @@
|
||||
# 实施步骤
|
||||
|
||||
- [x] 审计现有接缝与落面断言,编写 PRD 和设计。
|
||||
- [x] 审计每个发布层的身份、裁切和连续性契约,写测量矩阵。
|
||||
- [x] 实现独立米制测量和报告,加入 2 cm 偏移、缺对象、错接和中段缺口反例。
|
||||
- [x] 建立直线、曲线、编辑、相邻路口、真实 OSM 场景,保证各层非空覆盖。
|
||||
- [x] 修复被测量定位的局部接缝错误;超出局部修复范围的项目列入独立专项。
|
||||
- [x] 接入 npm test,运行针对性回归、全量回归、变更文件格式及 git diff --check。
|
||||
- [x] 记录各层结果、误差、覆盖数量及明确限制;更新规范。
|
||||
- [x] 按 Phase 3.4 确认提交批次。
|
||||
- [ ] 提交并归档。
|
||||
|
||||
已知基线问题:npm test 的 test/fixtures.js 快照与当前 OSM 不符;全仓 format:check 曾在 junction-facility-composition.js 失败。不得把这两项写成通过,也不得为本任务直接重置快照。
|
||||
@@ -0,0 +1,26 @@
|
||||
# 复杂路口全图层接缝精度验证
|
||||
|
||||
## Goal
|
||||
|
||||
以自动测量验证复杂路口各发布图层在应连续接口处的接缝精度,定位并修复支持范围内的局部缺陷。承接已归档 junction-reference-fidelity 的验证遗留。
|
||||
|
||||
## Requirements
|
||||
|
||||
- 检查道路面、核心/进口面、道路边线、道路中心线、车道中心线、车道分隔线及人行道。
|
||||
- 由 road/carriageway/lane 来源身份匹配相邻对象,以米制测量完整接边或对应线端位置,不通过全图最近点掩盖错接。
|
||||
- 接缝位置误差上限 0.01 m。明确区分停止线裁切、虚线间隔与本来不发布的设施,这些正常断开不能算接缝失败。
|
||||
- 缺少应存在的相邻对象必须报错,不能跳过。各图层报告 checked/failed/not-applicable 数量、对象身份、误差与不适用原因。
|
||||
- 测量发现的局部构建错误应修复;新绕障规划和设施规则变更作为独立专项。
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- [x] 每个图层有非空的应连续样本,覆盖直线、曲线、宽度变化、局部编辑、相邻路口与当前真实 OSM。
|
||||
- [x] 人为移动接缝 2 cm、删除必需邻接对象、错接不同道路均被检测;面积接边中间缺口不能只凭两端接触通过。
|
||||
- [x] 输入重排保持身份匹配稳定。支持场景满足 1 cm,不放宽阈值或减少覆盖使测试通过。
|
||||
- [x] 回归纳入 npm test,记录已有 fixture 差异,不刷新基线掩盖变化。
|
||||
|
||||
## 范围边界和现有证据
|
||||
|
||||
不涉及复杂排除区绕障、多通行区路径规划、车辆扫掠、UI 新控件或人工视觉验收。1 cm 为内部拼接精度,不是 OSM 测绘精度。
|
||||
|
||||
test/index.js:148 已验证 transition lane 与进口断面;:193 验证展宽保持外部图层;:230 仅验证道路面接缝端点;:324 的 0.3 m 落面容差不等同于接缝;:379 验证角部人行道完整端边。test/junction-build-plan-counterexamples.js:718 有核心整段覆盖反例。
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"id": "junction-layer-seams",
|
||||
"name": "junction-layer-seams",
|
||||
"title": "复杂路口全图层接缝精度验证",
|
||||
"description": "",
|
||||
"status": "in_progress",
|
||||
"dev_type": null,
|
||||
"scope": null,
|
||||
"package": null,
|
||||
"priority": "P2",
|
||||
"creator": "dingkang",
|
||||
"assignee": "dingkang",
|
||||
"createdAt": "2026-09-17",
|
||||
"completedAt": null,
|
||||
"branch": null,
|
||||
"base_branch": "main",
|
||||
"worktree_path": null,
|
||||
"commit": null,
|
||||
"pr_url": null,
|
||||
"subtasks": [],
|
||||
"children": [],
|
||||
"parent": null,
|
||||
"relatedFiles": ["src/compile/native-road.js", "src/compile/complex-junction-facilities.js", "test/helpers/junction-seams.js", "test/junction-layer-seams.js", "package.json"],
|
||||
"notes": "实现及专项验收完成:13 场景、1446 接口;详情见 evidence.md。全量回归保留既有 fixture / format 基线问题。用户已确认 Phase 3.4 提交及归档。",
|
||||
"meta": {}
|
||||
}
|
||||
Reference in new issue
Block a user