Normal transform orientation for edge is wrong when edge has specific coordinates
Closed, ResolvedPublic

Description

System Information
Windows 7 Professional 64-bit service pack 1
Intel Core i7-2600
8GB RAM
NVIDIA GTX 1060 6GB

Blender Version
Broken: 2.79 5bd8ac9

description of error
When selected edge matches one of following rules, wrong transform orientation being used instead of normal transform orientation.

  1. One of vertex is on local origin.

Or

  1. One of vertex's local coordinate is the other vertex's local coordinate multiplied by power of 2.

e.g. (1, 2, 3)and(4, 8, 12), (0.3, -1.22, 7)and(-2.4, 9.76, -56), (0, 0, 0)and(0.5,0.6,-0.4)

Exact steps for others to reproduce the error

  1. Open attached .blend file and enter edit mode.
  2. Make sure show_manipulator is on and transform orientation is set to normal.
  3. Select edge and see transform orientation.

ronan ducluzeau (zeauro) triaged this task as Confirmed priority.EditedNov 15 2017, 6:15 PM

Confirmed on linux for 2.79 and master 556b13f

After playing with this a bit, I noticed that if you move the vertex that is positioned at local (0,0,0) to another position, and then move it back to local (0,0,0), the orientation of the manipulator is correct.

My last comment wasn;t entirely true. It seems that in the first case of (0,0,0), setting the pivot point to "active element" corrects the behavior. However, for the second reproduction step regarding multiples of 2, no pivot point selection seems to remedy the problem.

This is actually a problem that occurs when the vertex normal is the same as the normal between both points of the edge; aka the edge is pointing towards the object origin.

Thanks @Dan Marra (dmarra) for finding the cause of the error, though I closed the diff since I think it doesn't properly resolve the issue.
Modifying the normal by the plane may give bad results in some cases.

The issue is:

  • the normal and the plane may be aligned or near aligned.
  • the resulting matrix prioritizes the normal over the plane (the plane is rotated to be orthogonal with the normal).
  • in the case of wire edges it's expected the orientation is aligned with the edge (in this case the normals aren't meaningful).

No problem @Campbell Barton (campbellbarton) . My fix had some weird side effects when I tested it deeper after submitting the patch, so not surprised it was rejected. Glad I could help better define the root cause though.