aboutsummaryrefslogtreecommitdiff
path: root/sys/mwcs/mwv1tran.gx
blob: 170d82394f3c9a1383dcdd5b2b0c240daf8a5320 (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
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include	"../mwcs.h"

# MW_V1TRAN -- Optimized 1D coordinate transformation for an array of points.

procedure mw_v1tran$t (a_ct, x1, x2, npts)

pointer	a_ct			#I pointer to CTRAN descriptor
PIXEL	x1[ARB]			#I coordinates in input system
PIXEL	x2[ARB]			#O coordinates in output system
int	npts

int	i
pointer	ct
PIXEL	scale, offset
errchk	mw_ctran$t

begin
	# Get real or double version of descriptor.
	ct = CT_$T(a_ct)

	scale  = Mem$t[CT_LTM(ct)]
	offset = Mem$t[CT_LTV(ct)]

	# Perform the transformation; case LNR is a simple linear transform.
	if (CT_TYPE(ct) == LNR) {
	    do i = 1, npts
		x2[i] = scale * x1[i] + offset
	} else {
	    do i = 1, npts
		call mw_ctran$t (a_ct, x1[i], x2[i], 1)
	}
end