The rotation is counter clock-wise (i.e., mathematically positive, unless invert=f is used) as seen from the right-handed xyz-axes: a z rotation will rotate the x axis towards the y axis, a y rotation will rotate the z axis towards the x axis, and an x rotation will rotate the y axis towards the z axis.
As an example, for a disk in the X-Y plane, a positive Y rotation causes the -X axis to move upwards, towards the observer, i.e. becoming the near side.
An alternate way to specify rotations is using the spinvector= keyword, where all points are rotated around this vector.
Although by default all vectors are rotated by the same matrix, the keyword select= can be used to select any set of Position, Velocity or Acceleration.
For ’normal’ unbarred
spiral galaxies the following example shows how to project them into their
normaly sky view, taking the sense of rotation into account:
set pa=170 # M51, use pa=200 for M33 set inc=22 # M51, use inc=30 for M33 set sign=1 # M51, use sign=-1 for M33 set sinc=‘nemoinp "-$sign*$inc"‘ mkdisk - 1000 sign=$sign |\ snaprotate - - theta=$sinc,$pa order=yz |\ snapgrid - velfie.ccd mom=-1 nds9 velfie.ccd # view the velocity field using ’ds9’.fiWith sign=1 it will create a counter clockwise (CCW) rotating disk and project it using -$inc,$pa, For a clock-wise (CW) rotating disk $inc,$pa, hence the somewhat awkward looking expressing to compute sinc. An alternative desription could be to allow the inclination to be negative as well (which observers do not do), where inc<0 means CCW, and inc>0 means CW rotation.
Suppose you have a barred galaxy model, bar.dat, with the galactic plane
at z=0 and the bar along the y axis ("position angle=0"), and want to
project this (such that z=0 will be the sky plane, and the positive z-axis
pointed towards the observer) with given final position angle ($pa), inclination
($inc) and angle from line of nodes to bar ($phi) the following rotations
will do the job:
set pa=39 set inc=-45 set phi=-34 snaprotate bar.dat n7476.dat "atand(tand($phi)/cosd($inc)),$inc,$pa" zyz snapplot n7476 psize="z>0?0.03:0.0"where psize was choosen such that ‘‘near’’ (z>0) particles were plotted a bit bigger to accentuate the near side of the model. Flipping the sign if $inc will flip the near and far side.
rotation dPA_near J_z sign(J_z) sinc CW +90 away < 0 inc CCW -90 towards > 0 -inc
Another common way to describe motion (e.g. in an aircraft, robotics) is the Yaw-Pitch-Roll (RPY) convention.
Peter Teuben
xx-jan-88 V1.0 original JEB 3-oct-88 V2.1 eulerian angles (order=zyz) PJT 17-feb-89: V2.1a new get+snap macros redef’s PJT 27-nov-89: V2.1b cosmetic defv[] PJT 15-nov-90 V3.0 theta is now an array keyword PJT 1-jun-92 documented the rotation manner bit more precise PJT 11-jun-92 V4.0 rotation now defined in math sense PJT 21-nov-98 V5.0 added tscale= keyword PJT 18-nov-05 V5.1a added select=, also implemented select=acc PJT 22-sep-08 V6.0 added spinvector= PJT 18-jan-22 fix sense of rotation example PJT