[Jprogramming] making rotation matrices

Dan Bron j at bron.us
Sun Jul 10 18:47:48 UTC 2016


Bearing in mind that I have no idea what I’m doing, and just looked up some various definitions of “Euler angles” and rotating them, here’s what I came up with:

load’trig'
PROJ      =:  2 3 0 , 4 2 0 ,: 0 0 1

rotate    =:  [: +/ .*/ 0 1 0 eul2rot"0 +&0 0 0
  eul2rot =:  rotM proj { f
    rotM  =:  (2 # [) |. ]
    f     =:  0:, 1:, cos, sin, - at sin

Now, in retrospect, after having written it, so that I had enough understanding to come back and read yours, I realize it substantially recapitulates your approach.  I think the only difference I see is using  PROJ { f  as opposed to your elcric .  

There are also other ways to define f which one may find more or less pretty or more or less clear. But the definitions of PROJ and f must be kept in sync.  One may also consider doing something like ( PROJ { 0:`1:`cos`sin`(- at sin) ) `:0 but at the moment I’m not seeing a lot of advantage in that (and some disadvantages).

That is, my approach is to spell out, explicitly, which function I want at each index. If I had some understanding of why those particular functions were applied at those particular indices, I might be able to offer a more general solution (based on calculating the LHA to o., for example), but I don’t, so I can’t.

Let me know if this helps at all.

-Dan



More information about the Programming mailing list