Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

When clipping a triangle creates a zero‑area face: a Monster Forge case study

Описание и применение

При обрезке треугольника, где граница проходит через вершину, возникает повторяющийся индекс вершины, что приводит к треугольнику нулевой площади. Устранение дубликатов до триангуляции решает проблему.

Задача

Clipping a triangle against a boundary that passes through an existing vertex can produce a polygon with a repeated vertex index, leading to a zero‑area face during triangulation.

Результат

The minimal reproduction demonstrates that welding duplicate vertices before triangulation removes the zero‑area face, and the production fix in Monster Forge incorporates this logic.

Рабочий процесс

  • Define triangle vertices and clipping boundary.
  • Iterate over directed edges, retaining vertices inside the boundary and computing intersections when edges cross the boundary.
  • Emit polygon vertices, including repeated vertices where intersections coincide with existing vertices.
  • Build a vertex lookup table with coordinate rounding to identify duplicates.
  • Generate fan triangulation from the vertex index sequence.
  • Detect duplicate indices and rebuild triangulation using unique vertex indices.
  • Verify triangle areas to ensure no zero‑area faces remain.

Доказательства

Welding equal coordinates produces the index sequence [0, 1, 2, 0]. A fan triangulator then emits (0,1,2) and (0,2,0). The second face has zero area because two of its vertex references are identical.

Источник

assert ids == [0, 1, 2, 0]

Источник

assert after == [(0, 1, 2)]

Источник

  • Дата записи: 2026-11-02T07:29:12.410Z