X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=libctsupport%2Fxform.cpp;h=219eb9b7c1bca2d515adec5653a77900d5ad865b;hb=739e435359d44546dd812fff8c86b815a214d587;hp=8d58f766a4dfdcbbb0e19b48aeffe9fde4de7964;hpb=99dd1d6ed10db1f669a5fe6af71225a50fc0ddfb;p=ctsim.git diff --git a/libctsupport/xform.cpp b/libctsupport/xform.cpp index 8d58f76..219eb9b 100644 --- a/libctsupport/xform.cpp +++ b/libctsupport/xform.cpp @@ -2,7 +2,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: xform.cpp,v 1.1 2000/06/19 02:58:08 kevin Exp $ +** $Id: xform.cpp,v 1.4 2000/12/04 04:44:03 kevin Exp $ ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License (version 2) as @@ -18,7 +18,8 @@ ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ******************************************************************************/ -#include "kmath.h" +#include "ctsupport.h" + /* NAME * rotate2d Rotates an array of 2 dimensional vectors @@ -121,24 +122,25 @@ rot_mtx2 (GRFMTX_2D m, const double theta) } void -mult_mtx2 (GRFMTX_2D m1, GRFMTX_2D m2, GRFMTX_2D result) +mult_mtx2 (const GRFMTX_2D m1, const GRFMTX_2D m2, GRFMTX_2D result) { GRFMTX_2D temp; - for (int row = 0; row < 3; row++) + for (int row = 0; row < 3; row++) { for (int col = 0; col < 3; col++) { temp[row][col] = 0; for (int calc = 0; calc < 3; calc++) - temp[row][col] += m1[row][calc] * m2[calc][col]; - } - - for (int row = 0; row < 3; row++) + temp[row][col] += m1[row][calc] * m2[calc][col]; + } + } + + for (int r = 0; r < 3; r++) for (int col = 0; col < 3; col++) - result[row][col] = temp[row][col]; + result[r][col] = temp[r][col]; } void -xform_mtx2 (GRFMTX_2D m, double& x, double& y) +xform_mtx2 (const GRFMTX_2D m, double& x, double& y) { double xt = x * m[0][0] + y * m[1][0] + m[2][0]; double yt = x * m[0][1] + y * m[1][1] + m[2][1];