Page MenuHome

Align to Transform Orientation precision issue
Closed, InvalidPublic

Description

Blender Version
Broken: 2.8x

Short description of error
Align to Transform Orientation introduces a small error in orientation.

Exact steps for others to reproduce the error

  1. Load the default scene.
  2. Rotate the cube.
  3. Make sure current transform orientation is set to Global.
  4. With the cube selected, go Object -> Transform -> Align to Transform Orientation

In my case, the new orientation of the cube, while close to (0, 0, 0), is actually (0.000001, -0.000002, 0). This, in turn, results in accumulation of small "errors" in coordinates when translating the object along its axes. Running the operator a second time seems to make the orientation (0, 0, 0) though.

Event Timeline

No. That thread talks about inaccuracies that accumulate while editing. These are indeed to be expected. Aligning to orientation is not a temporal operation. It should, if at all possible, match the object's orientation with the desired one, otherwise it's at best a "Try to align". Right now it's just calculated with floats, which contributes to the discrepancy listed in the task description.

If I move the cube around and do slightly different rotations then I get different values than the ones you wrote above. We are talking about the 7th digit in -0.000002, which is around the limit of floating point arithmetics. Note that these are indeed incorrect values but the behavior is expected in the sense that Blender cannot have any higher precision than that because it uses floats to represent real numbers.

Whether we should round such numbers for display is a different issue I think.

What are you talking about? Final orientation is already known and is represented to the precision available. Aligning an object should match that orientation to the same precision, not approximate it. It's not about rounding of final result, at all.

Interestingly, that bpy.ops.transform.transform() operator has "Accurate" parameter (use_accurate), that is set by default to False.
But toggling in on have no effect on align precision. Does anyone know why it there?

Jacques Lucke (JacquesLucke) claimed this task.

While in this special case, the exact target orientation is known, the code that computes this has to deal with more complex situations. E.g. when the object is parented to some other rotated object. Then when aligning it to world coordinates is more difficult than just copying the values over.
Blender could have a special case for the case you describe, but I think it is fine if it does not have it. Therefore, do not consider this to be a bug. It is working as expected with an error smaller than the machine precision.

"Special" case would be the parented one. Trivial case should be indistinguishable from copy-pasting the orientation.