I have a couple of lines pointing towards a center, and I need to rotate them so that they face the white direction. This rotation must be according to the least rotation possible.
I was not able to think of an appropriate criteria to use. I thought about comparing Angle and Reflex angle, but it is not enough: In the picture you can see that both reflex angles (blue) are larger than the actual angle (red), but the line in the upper corner needs to be rotated anti-clockwise while the line in the lower corner needs to be rotated clockwise.
Hi @diff-arch any idea why Plane Align does not actually return the smallest angle? In this case, item nr 7, it makes sense to rotate anti-clowise 81.87, but Plane Align rotates clockwise 261.87.
This represents a problem for me, because the goal is to plug a slider into rotation angle, going from 0 to 180 and having all lines progressively line up with the main direction. The problem is, some lines make unnecessary additional rotations:
I’m not exactly sure myself, but I would guess that this has to do with the line directions of the starting curves, and the Align (Align Planes) having to make a decision in some fringe cases, whether to use the measured angle or reflex.
For measured angles below 0.0 and above Pi (i.e. 180°), the negative reflex angles are now used, since they represent the minimum rotation angles in the given plane.
Instead of subtracting the angles from 2 Pi (i.e. 360°), which might return undesired results, simply drive the rotation animation with your values from 0 to 180 that get remapped to the rotation angles.