Inner margin for ClampLocationNavigableWorld#15
Open
OregonJunco wants to merge 2 commits intoVSZue:masterfrom
Open
Inner margin for ClampLocationNavigableWorld#15OregonJunco wants to merge 2 commits intoVSZue:masterfrom
OregonJunco wants to merge 2 commits intoVSZue:masterfrom
Conversation
…ixing a crash where locations that get clamped to a maximum world dimension would then round to an invalid index in VolumeIdAt (e.g. clamping 150 to 100, which then rounds to invalid index 100 instead of 99 in a 100-voxel world)
…w, as the rounding bug doesn't apply to that case. Fixed a capitalization error. Better comment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR changes ClampLocationToNavigableWorld so that vector components with values greater than the max world edges are clamped to just below the max values. For instance, the vector (150, 0, 0) is clamped to (99.9999, 0, 0) instead of (100, 0, 0) in a 100 centimeter world.
This was made in response to an engine crash I experienced after using ClampLocationToNavigableWorld to clean a location value before sending it into DoN. The engine crashed because VolumeAtId uses a float-to-int comparison in order to obtain a voxel address from a floating-point location, and the clamped value rounded to invalid index "100" in a 100-voxel world, whereas the valid indices ran from 0-99.
With this in mind it seems that locations exactly along the maximum edges of a DoN world are not safe, and thus it makes sense to me that ClampLocationToNavigableWorld should clamp away from them.
Thank you for all your hard work on this plugin!