source: trunk/MagicSoft/slalib/tp2v.c@ 807

Last change on this file since 807 was 732, checked in by tbretz, 23 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 slaTp2v ( float xi, float eta, float v0[3], float v[3] )
4/*
5** - - - - - - - -
6** s l a 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** (single precision)
14**
15** Given:
16** xi,eta float tangent plane coordinates of star
17** v0 float[3] direction cosines of tangent point
18**
19** Returned:
20** v float[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 slaTp2s.
32**
33** Last revision: 11 February 1995
34**
35** Copyright P.T.Wallace. All rights reserved.
36*/
37{
38 float x, y, z, f, r;
39
40
41 x = v0[0];
42 y = v0[1];
43 z = v0[2];
44 f = (float) sqrt ( (double) ( 1.0f + xi * xi + eta * eta ) );
45 r = (float) sqrt ( (double) ( x * x + y * y ) );
46 if ( r == 0.0f ) {
47 r = 1e-20f;
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.