-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix floating-point precision problem in apply_light_arc #76959
Conversation
|
Thanks for reminding. I actually intended to have a normalized oangle between 0_degrees and 360_degrees. But I forgot to check the behavior of fmod. Fix is on the way.
It has to be normalized.
My rationale is to make floating point inaccuracy unimportant. oangle, with its immutable nature, can only fall into a octant once. cangle too. Therefore, even if they fall into adjacent octant due to inaccuracy, they still should be fairly close to octant boundaries. For example, if oangle is 44.9_degrees and cangle is 90.1_degrees, surely |
Ah, so you're saying the castlight calls are actually doing something useful with almost correct parameter values and that this doesn't gets degraded by the inherent blockiness of the result (as it has to be tiles being illuminated). Such as illuminating a tile to 99.999% of what it should have been, and another by 0.99999% when it shouldn't be? |
I'm not sure I fully get what you mean, but from my understanding, although slightly inaccurate parameter values can possibly lead to the boundaries of adjacent octants being falsely illuminated, in fact the octants' boundaries are overlapping, so the falsely illuminated tiles of one octant are effectively correctly illuminated tiles of another. On the other hand, |
Summary
Bugfixes "Fix floating-point precision problem in apply_light_arc"
Purpose of change
Fix #76909
Describe the solution
Instead of using std::floor to determine which octant the light beam should fall into, I'd rather compare the boundaries of light beam with octant boundaries to make sure nothing is incorrectly rounded.
This also simplified the code by using a unified approach to cast light into one octant.
Describe alternatives you've considered
Fix the rounding problem of units::angle : Would love to leave that to more authoritative ones to decide.
Testing
Additional context