aboutsummaryrefslogtreecommitdiff
path: root/math/slalib/dav2m.f
diff options
context:
space:
mode:
authorJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
committerJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
commit40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch)
tree4464880c571602d54f6ae114729bf62a89518057 /math/slalib/dav2m.f
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'math/slalib/dav2m.f')
-rw-r--r--math/slalib/dav2m.f84
1 files changed, 84 insertions, 0 deletions
diff --git a/math/slalib/dav2m.f b/math/slalib/dav2m.f
new file mode 100644
index 00000000..7eb1f68b
--- /dev/null
+++ b/math/slalib/dav2m.f
@@ -0,0 +1,84 @@
+ SUBROUTINE slDAVM (AXVEC, RMAT)
+*+
+* - - - - - -
+* D A V M
+* - - - - - -
+*
+* Form the rotation matrix corresponding to a given axial vector.
+* (double precision)
+*
+* A rotation matrix describes a rotation about some arbitrary axis,
+* called the Euler axis. The "axial vector" supplied to this routine
+* has the same direction as the Euler axis, and its magnitude is the
+* amount of rotation in radians.
+*
+* Given:
+* AXVEC d(3) axial vector (radians)
+*
+* Returned:
+* RMAT d(3,3) rotation matrix
+*
+* If AXVEC is null, the unit matrix is returned.
+*
+* The reference frame rotates clockwise as seen looking along
+* the axial vector from the origin.
+*
+* Last revision: 26 November 2005
+*
+* Copyright P.T.Wallace. All rights reserved.
+*
+* License:
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program (see SLA_CONDITIONS); if not, write to the
+* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+* Boston, MA 02110-1301 USA
+*
+* Copyright (C) 1995 Association of Universities for Research in Astronomy Inc.
+*-
+
+ IMPLICIT NONE
+
+ DOUBLE PRECISION AXVEC(3),RMAT(3,3)
+
+ DOUBLE PRECISION X,Y,Z,PHI,S,C,W
+
+
+
+* Rotation angle - magnitude of axial vector - and functions
+ X = AXVEC(1)
+ Y = AXVEC(2)
+ Z = AXVEC(3)
+ PHI = SQRT(X*X+Y*Y+Z*Z)
+ S = SIN(PHI)
+ C = COS(PHI)
+ W = 1D0-C
+
+* Euler axis - direction of axial vector (perhaps null)
+ IF (PHI.NE.0D0) THEN
+ X = X/PHI
+ Y = Y/PHI
+ Z = Z/PHI
+ END IF
+
+* Compute the rotation matrix
+ RMAT(1,1) = X*X*W+C
+ RMAT(1,2) = X*Y*W+Z*S
+ RMAT(1,3) = X*Z*W-Y*S
+ RMAT(2,1) = X*Y*W-Z*S
+ RMAT(2,2) = Y*Y*W+C
+ RMAT(2,3) = Y*Z*W+X*S
+ RMAT(3,1) = X*Z*W+Y*S
+ RMAT(3,2) = Y*Z*W-X*S
+ RMAT(3,3) = Z*Z*W+C
+
+ END