差别
这里会显示出您选择的修订版和当前版本之间的差别。
| 两侧同时换到之前的修订记录 前一修订版 后一修订版 | 前一修订版 | ||
| 直骨架的研究 [2025/09/26 00:03] – 张叶安 | 直骨架的研究 [2025/10/16 11:17] (当前版本) – 张叶安 | ||
|---|---|---|---|
| 行 1: | 行 1: | ||
| + | https:// | ||
| + | |||
| + | {{ : | ||
| + | |||
| - [[直骨架的研究: | - [[直骨架的研究: | ||
| - [[直骨架的研究: | - [[直骨架的研究: | ||
| 行 99: | 行 103: | ||
| 除了上面七种事件外,其他的点的组合构成的事件不会发生。 | 除了上面七种事件外,其他的点的组合构成的事件不会发生。 | ||
| + | [[直骨架的研究: | ||
| - | Thanks for the detailed report. I reproduced the core differences against the C++ and found a critical mismatch that explains why concave skeleton lines still fail on a skewed (non-regular) star polygon. | + | [[直骨架的研究:鞋带公式]] |
| - | + | ||
| - | What I changed just now | + | |
| - | • I updated calcMovingSteinerSpeed in HDSkeleton/ | + | |
| - | ◦ C++: mpv-> | + | |
| - | ◦ Before: the C# code had a fallback that replaced near-degenerate cases with a “safe” direction (e2 or (1,0)). This suppresses the very large speeds that the C++ logic intentionally creates in near-parallel configurations. | + | |
| - | ◦ After: C# now computes mpv.Speed = e1 / denom with denom = |e1 - dot(e1, e2) e2| and only guards denom from being zero (set to a tiny EPS). No direction fallback. This aligns with C++ and preserves the intended scheduling of Split/ | + | |
| - | + | ||
| - | Why this matters for skewed star polygons | + | |
| - | • Skewed star polygons create many near-parallel interactions between motorcycle edges and polygon edges. The “fallback” in C# often reduced moving-Steiner speeds to a tame unit direction, which: | + | |
| - | ◦ Inflated edge vanish times (dl <= 0 or very small), so Split events didn’t trigger when they should. | + | |
| - | ◦ Broke the temporal order of events in the queue, indirectly causing missing concave skeleton spokes. | + | |
| - | • By removing the fallback and restoring the C++ behavior, moving-Steiner vertices now get the correct (often very large) speed in near-degenerate cases, making the Split/ | + | |
| - | + | ||
| - | What we had already aligned earlier | + | |
| - | • Split Event (motorcycle-edge branch) only adds one skeleton edge to the collision point (from the reflex side or the other side), not two. This exactly matches the C++ implementation (even though the high-level doc says “add uv,” the C++ code draws from vertex to collision point, and adds the third leg only for the disappearing triangle special cases). | + | |
| - | • Switch, Edge, Multi Split: verified to add skeleton edges in the same conditions as C++. | + | |
| - | • Event type matrix and dispatcher: matches C++ ordering and selection. | + | |
| - | • POLYGON_EDGE split branch: we perform reconnections and times updates without directly adding a skeleton edge, as per C++. | + | |
| - | + | ||
| - | How to verify on your side | + | |
| - | • Rebuild is already successful. Please run the Visualizer and test with a skewed star polygon (examples) | + | |
| - | ◦ Example 1 (CCW order): (0,0) (4,7) (8,0) (0,5) (8,5) (0,0) | + | |
| - | ◦ Example 2 (more skewed): (0,0) (2,7) (5,0) (-1,4) (6,6) (0,0) | + | |
| - | • Watch the log: you should see Split/ | + | |
| - | + | ||
| - | If you still see issues | + | |
| - | • Orientation: | + | |
| - | • Edge vanish times: If any edge shows VanishTime = MaxValue when you expect an event, dump the two endpoint speeds and the normalized edge direction to catch dl <= 0 cases. With the updated moving-Steiner speed, you should see far fewer of these. | + | |
| - | • Enable targeted debug in handleSplitEvent and handleSwitchEvent: | + | |
| - | ◦ Log event.Type, edge.Type (POLYGON_EDGE vs MOTORCYCLE_EDGE), | + | |
| - | ◦ Log when the “triangle disappears” special cases are hit (where we add the extra spoke). | + | |
| - | • Compare with C++ using the same star polygon input if possible; now that moving-Steiner speed is identical, the event order and skeleton spokes should match. | + | |
| - | Summary | + | [[直骨架的研究:射线法]] |
| - | • Root cause for skewed star polygons: moving-Steiner speed fallback diverged from the C++ formula, suppressing Split/ | + | |
| - | • Fixed by matching the C++ calcMovingSteinerSpeed exactly (no direction fallback; only guard zero denominator). | + | |
| - | • Combined with the earlier Split Event alignment, this should produce the correct concave skeleton lines for your skewed star tests. | + | |
| - | If you’d like, I can also add minimal debug prints to the Split and Switch handlers to confirm which branch (polygon-edge vs motorcycle-edge split) is exercised on your star test and list the exact skeleton segments added per event | + | [[直骨架的研究: |
| + | [[直骨架的研究: | ||