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

include	"../mwcs.h"

# MW_LTRAN -- Perform a general N-dimensional linear transformation, i.e.,
# matrix multiply and translation.

procedure mw_ltran$t (p1, p2, ltm, ltv, ndim)

PIXEL	p1[ndim]			#I input point
PIXEL	p2[ndim]			#O transformed output point
PIXEL	ltm[ndim,ndim]			#I linear transformation matrix
PIXEL	ltv[ndim]			#I linear translation vector
int	ndim				#I dimension of system

int	i, j
PIXEL	p3[MAX_DIM]

begin
	call amov$t (p1, p3, ndim)
	do j = 1, ndim {
	    p2[j] = ltv[j]
	    do i = 1, ndim
		p2[j] = p2[j] + ltm[i,j] * p3[i]
	}
end