Commit 8e43202
committed
Add gradient magnitude safety check to prevent overshooting in ApplyConstraints
When gradient magnitude is very weak (< 0.5), cap the step size by the distance value to prevent taking unreasonably large steps. This handles pathological cases in smoothed distance fields where weak gradients can cause steps orders of magnitude larger than the distance to the surface and exceed the narrow band.1 parent b351dea commit 8e43202
1 file changed
+16
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
92 | 100 | | |
93 | | - | |
94 | 101 | | |
95 | 102 | | |
96 | 103 | | |
| |||
0 commit comments