snap_rounding_2 in CGAL 6.x: access violation (0xC0000005) with `Simple_cartesian<double>` but not with `Epeck`, same input
Not a bug
## Environment
- CGAL version: 6.x
- Compiler: MSVC 2022 (cl 19.4x), x64
- OS: Windows 11
## Summary
Calling `snap_rounding_2` with `Snap_rounding_traits_2<Simple_cartesian<double>>`
crashes with 0xC0000005 (access violation inside the internal `Arrangement_2`)
on certain near-degenerate large-coordinate datasets (coordinates ~200k–700k,
pixel size 50). The exact same input completes without error on CGAL 6.x when
`Snap_rounding_traits_2<Epeck>` is used instead.
## Root cause hypothesis
`snap_rounding_2` appears to require exact orientation predicates for
near-degenerate configurations at large coordinates. With
`Simple_cartesian<double>`, floating-point rounding produces a wrong orientation
sign that corrupts the internal `Arrangement_2` and leads to an access violation.
`Epeck` avoids the crash because its predicates are exact.
## Workaround in use
`Snap_rounding_traits_2<Epeck>` — compiles and runs correctly on CGAL 6.x,
but is slower than `Simple_cartesian<double>` due to lazy exact arithmetic.
## Minimal reproducer
See attached file `SnapRound_CrashRepro.cpp`.
Key parameters:
- 65 segments, coordinates in the range 150k–600k (millimetres)
- pixel_size = 50.0
- `do_isr = false`, `int_output = false`, `kd_trees = 1`
Expected on CGAL 6.x with Simple_cartesian<double>: access violation (0xC0000005).
Expected on CGAL 6.x with Epeck: prints "Done." and exits normally.
## Question
Is it possible to make the code work with `Simple_cartesian<double>`? Or it is inherently unstable?
关闭于 2026-06-11 2 条评论