Fix
Trying Sionna-RT for my research, I noticed strange behavior with wedges/edges and, particularly, a method for swapping edge extremities to orient identical edges in the same way. The problem was, as I understood that some coordinates (for example, r0 and r1) might coincide, but due to numerical issues, one might be larger than another (r0 > r1 yields True).
I changed the code, so comparison for nearly equal values starts before checking what number is larger.
My 1st commit contains an example where I have observed the problem. All edges have equal radii in spherical coordinates - due to numerical issues, r0 > r1 may give True. My 2nd commit contains changes to the method for swapping edge extremities.
The code snippet which I used to reproduce the problem.
scene = load_scene(sionna.rt.scene.sphere)
num_edges = tf.reduce_sum(tf.cast(scene._solver_paths._is_edge, tf.int32))
num_wedges = scene._solver_paths._wedges_origin.shape[0] - num_edges
print(num_edges, num_wedges)
Expected output/output after the fix: 0 120 Output before the fix: 44 98
Signed-off by: Ainur Ziganshin [email protected]
Checklist
- [x] Detailed description
- [ ] Added references to issues and discussions
- [ ] Added / modified documentation as needed
- [ ] Added / modified unit tests as needed
- [ ] Passes all tests
- [ ] Lint the code
- [x] Performed a self review
- [x] Ensure you Signed-off the commits. Required to accept contributions!
- [ ] Co-authored with someone? Add Co-authored-by: user@domain and ensure they signed off their commits too.