Description
Following on from: #234 (comment)
There are lots of conventions needed to work with orientations. We (the developers) are starting to learn that anything other than extremely well documented conventions will lead to problems. This thread aims to spell these conventions out, agree upon them, and also design a strategy for documenting them. I have decided to design it into "Phases" so as not to lead to information overload. Each new phase will be added to the top line to make life easier.
Phase 0 - Setting Terms
- Where possible we will follow a mixture of the three manuscripts on which orix was built, for compatibility. These are:
[1] D Rowenhorst et al 2015 Modelling Simul. Mater. Sci. Eng. 23 083501
[2] Johnstone et al. J. Appl. Cryst. (2020). 53, 1293–1298
[3] Krakow R et al.. 2017 On three-dimensional misorientation spaces. Proc. R. Soc. A 473: 20170274.
And the computer package MTEX (which we will refer to as [4]).
Phase 1
- The vast majority of our use cases will involve a sample (specimen) which is a macroscopic object and crystal(s) which are microscopic arrangements of atoms. I suggest the following.
- The sample z direction goes perpendicular to the array of our 2D sample (obtained through some scanning mechanism)
- The sample basis (and all such basis) should be right handed [1]
Two options jump out:
a1. Follow [4], x east, y south, z into page.
a2. Stick with what we have, x east, y north, z out of page.
Having decided this we should then decided how the crystal axes for each crystal system 'align' with this basis when no rotation has been applied. This basically involves completing the following table, ideally from a single authoritative source (perhaps noting disagreements with other source as and when needed). Appendix B of [3] suggests this might be a bit tricky. Adjacently, I think this is the cause of #236
Crystal System | e1 | e2 | e3 |
---|---|---|---|
Cubic | a | e3 x e1 | c* |
Hexagonal | a | e3 x e1 | c* |
Tetragonal | a | e3 x e1 | c* |
Trigonal | a | e3 x e1 | c* |
Orthorhombic | a | e3 x e1 | c* |
Monoclinic | a | e3 x e1 | c* |
Trigonal | a | e3 x e1 | c* |
So questions.
q1) a1 or a2?
q2) Do we have an authoritative source to complete this table, if not, which ones do we think are obvious and can be agreed upon (eg. cubic is a bit trivial)?
Phase 2
This is more of a code design element. I think we should make almost all from_euler
code (and similar) private so that we can maintain a single internal set of conventions that are consistently applied. As an example, I believe the "lab2crystal"
and "crystal2lab"
arguments set whether imported data is "active" (static if your transform3d) or "passive" (rotating in transform3d) - this can get extremely confusing very quickly. Basically I don't think we want this exposed to users.
In a later phase we will discuss whether we should use "passive" or "active", but this only makes sense if (under the hood) every import is converted into the same form. At present a reasonably careful user can run from_euler
and be off by an inversion without anybody really noticing.
(also as a mild addendum to this, I would be much happier if we used axangles in our examples over Eulers, but that's a much more minor point)
Phase 3
It seems we are broadly in agreement on the "passive" convention, in which a rotation R describes the transformation that brings the crystal coordinates into coincidence with the lab coordinates [2]. This has the slightly unwelcome side effect that
R * crystal_vector
is not the correct way to bring some crystal direction from it's "neutral" positions to that described by orientation R
instead an inversion is needed.
Would be good to check that everyone is happy with this.