-
Notifications
You must be signed in to change notification settings - Fork 32
Making the Integer Arithmetic more robust when calculating the split statistics for the KD tree #24
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
Making the Integer Arithmetic more robust when calculating the split statistics for the KD tree #24
Conversation
…ginning more gracefully. Adding an initialized flag to each Region. The Region content is now only validated if the region was initialized first.
…or not and if they use integer arithmetic
… using integer arithmetic This bug led to splits with regions containing zero number of samples
…her as shared or static library
…from scratch from multiple sample sets
…se integer arithmetic when parallel pivot splitting is disabled.
… increase robustness on very large scenes and adding some additional checks
…e IntegerSampleStatistics
…able inc variance estimation
…rithmetric based sample statistic estimation
…considers zero valued variance estimates
The regionPivot is separated from the SampleStatistics mean position in case no samples are collected after a spatial split which clears the SampleStatistics.
| float minDistance = length(sampleVariance); | ||
| float norm = sampleVariance.x * sampleVariance.x + sampleVariance.y * sampleVariance.y + sampleVariance.z * sampleVariance.z; | ||
| norm = std::max(FLT_EPSILON, norm); | ||
| float minDistance = std::sqrt(norm); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mixing std::sqrt() and sqrt()
| // merge split handling | ||
| regionAndRangeData.first.sampleStatistics.split(splitDim, splitPos, 0.25f, false); | ||
| regionAndRangeDataRight.first.sampleStatistics.split(splitDim, splitPos, 0.25f, true); | ||
| // regionAndRangeData.first.sampleStatistics.split(splitDim, splitPos, 0.25f, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this commented code still necessary or can it be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am currently keeping it to remember that I removed it for this fix.
Just in case that we need to revert this.
Maybe adding a comment would be a good idea.
This PR improves some numerical stabilities when using integer arithmetic when calculating the splitting statistics during KD tree building.
In addition, it fixes some numerical instabilities for the VMM fitting when only one sample is used to fit an VMM.
This is an unusual case but now it is at least stable.