source: trunk/MagicSoft/slalib/dtp2v.c@ 6882

Last change on this file since 6882 was 731, checked in by tbretz, 24 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 1.3 KB
Line 
1#include "slalib.h"
2#include "slamac.h"
3void slaDtp2v ( double xi, double eta, double v0[3], double v[3] )
4/*
5** - - - - - - - - -
6** s l a D t p 2 v
7** - - - - - - - - -
8**
9** Given the tangent-plane coordinates of a star and the direction
10** cosines of the tangent point, determine the direction cosines
11** of the star.
12**
13** (double precision)
14**
15** Given:
16** xi,eta double tangent plane coordinates of star
17** v0 double[3] direction cosines of tangent point
18**
19** Returned:
20** v double[3] direction cosines of star
21**
22** Notes:
23**
24** 1 If vector v0 is not of unit length, the returned vector v will
25** be wrong.
26**
27** 2 If vector v0 points at a pole, the returned vector v will be
28** based on the arbitrary assumption that the RA of the tangent
29** point is zero.
30**
31** 3 This routine is the Cartesian equivalent of the routine slaDtp2s.
32**
33** Last revision: 12 February 1995
34**
35** Copyright P.T.Wallace. All rights reserved.
36*/
37{
38 double x, y, z, f, r;
39
40
41 x = v0[0];
42 y = v0[1];
43 z = v0[2];
44 f = sqrt ( 1.0 + xi * xi + eta * eta );
45 r = sqrt ( x * x + y * y );
46 if ( r == 0.0 ) {
47 r = 1e-20;
48 x = r;
49 }
50 v[0] = ( x - ( xi * y + eta * x * z ) / r ) / f;
51 v[1] = ( y + ( xi * x - eta * y * z ) / r ) / f;
52 v[2] = ( z + eta * r ) / f;
53}
Note: See TracBrowser for help on using the repository browser.