Open andrewkaufman opened 2 months ago
That is correct. Deciding what "the right" comparison should be for two quaternions is can be context-sensitive, I think.
Oh? Interesting. The context of the slack conversation is for a diffing tool. In that context, would an element wise comparision (as though it was a float4) not be correct?
For a straight-up textual or "numdiff" differ, yes that would be sufficient. But if we provide a GfIsClose for quaternions, then someone might believe it's going to give them a reasonable answer about the angular distance between the two orientations, which a component-wise diff does not discriminate well.
I was thinking that a reasonable GfIsClose might be
abs(1 - abs(q1 x q2*)) < eps
where x is a multiplication and * is the inverse. That would capture the case where two rotations are the same but have an opposite sense.
Removing the inner abs would reject two rotations that are the same but have an opposite sense.
I wonder if GfIsClose should try to say that two quarternions are close with the same sense. And we could document how to accomplish the other.
Ps, I am suggesting the norm comparison rather than an element wise comparison because the elements of a quaternion are coupled, and the norm comparison will test the distribution of error about the sphere. A component wise comparison might report a lesser or greater difference but might represent a deviation from a norm based comparison. In other words the norm measure will capture a deviation from a unit length, and the component wise comparison will not.
Filed as internal issue #USD-9843
Description of Issue
As mentioned in #wg-usd on ASWF slack https://academysoftwarefdn.slack.com/archives/C013Z5AMT7T/p1720807979342119?thread_ts=1720804075.436449&cid=C013Z5AMT7T, the various GfQuat types do not work with
Gf.IsClose
in python. Presumbly they don't have a c++ implementation either.