aboutsummaryrefslogtreecommitdiff
path: root/noao/astutil/asttools/astvsun.x
blob: c466ab89e9d290a49e59b3724a3139a8311af019 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
include	<math.h>

# The sun's velocity with respect to the local standard of rest is:

define	RAVSUN	18.	# RA of sun's velocity
define	DECVSUN	30.	# DEC of sun's velocity
define	VSUN	20.	# VLSR of sun
define	EPOCH	1900.	# Epoch of sun's velocity

# AST_VSUN -- Projection of the sun's velocity along the given direction.

procedure ast_vsun (ra, dec, epoch, v) 

double	ra		# Reference right ascension (hours)
double	dec		# Reference declination (degrees)
double	epoch		# Epoch (years)
double	v		# VLSR of sun along reference direction

double	ravsun, decvsun, vx, vy, vz, cc, cs, s

begin
	# Precess VLSR direction to current date.
	call ast_precess (double (RAVSUN), double (DECVSUN), double (EPOCH),
	    ravsun, decvsun, epoch)

	# Cartisian velocity components of the sun's velocity.
	vx = VSUN * cos (DEGTORAD (15. * ravsun)) * cos (DEGTORAD (decvsun))
	vy = VSUN * sin (DEGTORAD (15. * ravsun)) * cos (DEGTORAD (decvsun))
	vz = VSUN * sin (DEGTORAD (decvsun))

	# Direction cosines along the reference direction.
	cc = cos (DEGTORAD (dec)) * cos (DEGTORAD (15. * ra))
	cs = cos (DEGTORAD (dec)) * sin (DEGTORAD (15. * ra))
	s  = sin (DEGTORAD (dec))

	# Project sun's motion along the reference direction.
	v = -(vx * cc + vy * cs + vz * s)
end