UC-Davis-molecular-computing / scadnano-python-package

Python scripting library for generating designs readable by scadnano.
https://scadnano.org
MIT License
15 stars 7 forks source link

switch to unambiguous orientation system #150

Open dave-doty opened 4 years ago

dave-doty commented 4 years ago

The three principle aircraft axes are not an unambiguous specification of orientation, because it depends on the order in which they are applied. https://en.wikipedia.org/wiki/Aircraft_principal_axes

For instance, roll by 180, then pitch by 90, would nose-dive the plane, whereas pitch by 90 then roll by 180 would point the plane straight up and then roll it (while still going up).

Two possibilities:

  1. (easier for now) Explicitly specify order that angles are applied. I suggest yaw, then pitch, then roll.

  2. Use "quaternions": two vectors forward and normal, where forward specifies equivalent information to pitch and yaw, by saying which direction the forward direction of the Helix is pointing, and normal is a vector perpendicular to forward indicating the roll along the forward axis.

See also https://github.com/UC-Davis-molecular-computing/scadnano/issues/546.

There's two issues here:

  1. What we store internally and in the JSON. I think that should eventually be the forward and normal vectors, which makes this more straightforward for oxDNA export, for example.

  2. What interface is provided in the web interface and Python API. Some people might find it easier to think in terms of aircraft principle axes, so we might want to keep that as a way to specify the orientation. For instance, designs that set pitch to rotate in the main view are more straightforward to just give an angle (like 45 degrees), than to think about the axes and what the forward vector should be. (which for 45 degree pitch I think would be the vector (0,1,1))

This should be implemented before #139, to make it simpler to do that export, since oxDNA supposedly uses the quarternion approach.

dave-doty commented 3 years ago

There may not be a need to implement this. It seemed more elegant than the aircraft axes rotation angles, but now that we've formalized the order in which to apply those rotation angles (yaw, pitch, roll), it is unambiguous how to interpret them.