From fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 8 Jul 2015 20:46:52 -0400 Subject: Initial commit --- sys/mwcs/gen/mwv1trand.x | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 sys/mwcs/gen/mwv1trand.x (limited to 'sys/mwcs/gen/mwv1trand.x') diff --git a/sys/mwcs/gen/mwv1trand.x b/sys/mwcs/gen/mwv1trand.x new file mode 100644 index 00000000..3c3ac124 --- /dev/null +++ b/sys/mwcs/gen/mwv1trand.x @@ -0,0 +1,32 @@ +include "../mwcs.h" + +# MW_V1TRAN -- Optimized 1D coordinate transformation for an array of points. + +procedure mw_v1trand (a_ct, x1, x2, npts) + +pointer a_ct #I pointer to CTRAN descriptor +double x1[ARB] #I coordinates in input system +double x2[ARB] #O coordinates in output system +int npts + +int i +pointer ct +double scale, offset +errchk mw_ctrand + +begin + # Get real or double version of descriptor. + ct = CT_D(a_ct) + + scale = Memd[CT_LTM(ct)] + offset = Memd[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_ctrand (a_ct, x1[i], x2[i], 1) + } +end -- cgit