Fix intermittent SIGSEGV from NaN/non-unit axis in angle_to_quaternion#179
Open
caic99 wants to merge 1 commit intodptech-corp:mainfrom
Open
Fix intermittent SIGSEGV from NaN/non-unit axis in angle_to_quaternion#179caic99 wants to merge 1 commit intodptech-corp:mainfrom
caic99 wants to merge 1 commit intodptech-corp:mainfrom
Conversation
…ternion (dptech-corp#160) angle_to_quaternion(axis, angle) assumed the axis is a unit vector, but GPU floating-point precision drift in matrix-vector multiplication (segment transformations in tree.h) can produce non-unit or NaN axes. The existing assert() is stripped in release builds, leaving no protection and causing intermittent crashes. Add robust handling: - NaN or zero-length axis: return identity quaternion (no rotation) - Near-unit axis: renormalize before use - Well-behaved axis: unchanged behavior Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
e60b4cc to
5158c69
Compare
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.
Summary
Root cause:
angle_to_quaternion(axis, angle)assumes the axis is a unit vector, but floating-point precision drift from GPU matrix-vector multiplication (segment transformations in tree.h) can produce non-unit or NaN axes. The existingassert()is stripped in release builds, leaving no protection.Fix: Add robust handling:
This makes the function resilient to floating-point drift without changing docking results for well-behaved inputs.
Test plan
🤖 Generated with Claude Code