r247: *** empty log message ***
[ctsim.git] / libctgraphics / ctm.cpp
diff --git a/libctgraphics/ctm.cpp b/libctgraphics/ctm.cpp
deleted file mode 100644 (file)
index ec61c29..0000000
+++ /dev/null
@@ -1,230 +0,0 @@
-/*****************************************************************************
-**  This is part of the CTSim program
-**  Copyright (C) 1983-2000 Kevin Rosenberg
-**
-**  $Id: ctm.cpp,v 1.2 2000/06/19 19:04:05 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
-**  published by the Free Software Foundation.
-**
-**  This program is distributed in the hope that it will be useful,
-**  but WITHOUT ANY WARRANTY; without even the implied warranty of
-**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-**  GNU General Public License for more details.
-**
-**  You should have received a copy of the GNU General Public License
-**  along with this program; if not, write to the Free Software
-**  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-******************************************************************************/
-
-/*-----------------------------------------------------------------------------
- * FILE IDENTIFICATION
- *
- *     Name:       ctm.c
- *     Function:   Current Transform Matrix routine for graphic library
- *     Programmer: Kevin Rosenberg
- *     Date Started:   1-22-85
- *
- * FUNCTION SUMMARY
- *     ctm_xlat_pre_2 ()
- *     ctm_xlat_post_2 ()
- *     ctm_scale_pre_2 ()
- *     ctm_scale_post_2 ()
- *     ctm_rotate_pre_2 ()
- *     ctm_rotate_post_2 ()
- *
- * NOTES
- *     The indices on the 2d matrix are opposite of the cartesian order used
- *     in the sdf_2d files.  Here, the 1st index is the row & and 2nd is the
- *     column
- *---------------------------------------------------------------------------*/
-
-#include "ctsupport.h"
-#include <math.h>
-#include "sgp.h"
-
-
-/*---------------------------------------------------------------------------*/
-/*                             Geometric Operations                         */
-/*---------------------------------------------------------------------------*/
-
-void
-ctm_xlat_pre_2 (double x, double y)
-{
-    GRFMTX_2D m;
-
-    xlat_gmtx_2 (m, x, y);
-    ctm_pre_mult_2 (m);
-}
-
-
-void 
-ctm_xlat_post_2 (double x, double y)
-{
-    GRFMTX_2D m;
-
-    xlat_gmtx_2 (m, x, y);
-    ctm_post_mult_2 (m);
-}
-
-
-void 
-ctm_scale_pre_2 (double sx, double sy)
-{
-    GRFMTX_2D m;
-
-    scale_gmtx_2 (m, sx, sy);
-    ctm_pre_mult_2 (m);
-}
-
-
-void 
-ctm_scale_post_2 (double sx, double sy)
-{
-    GRFMTX_2D m;
-
-    scale_gmtx_2 (m, sx, sy);
-    ctm_post_mult_2 (m);
-}
-
-
-void 
-ctm_rotate_pre_2 (double theta)
-{
-    GRFMTX_2D m;
-
-    rotate_gmtx_2 (m, theta);
-    ctm_pre_mult_2 (m);
-}
-
-
-void 
-ctm_rotate_post_2 (double theta)
-{
-    GRFMTX_2D m;
-
-    rotate_gmtx_2 (m, theta);
-    ctm_post_mult_2 (m);
-}
-
-
-void 
-ctm_shear_pre_2 (double shrx, double shry)
-{
-    GRFMTX_2D m;
-
-    shear_gmtx_2 (m, shrx, shry);
-    ctm_pre_mult_2 (m);
-}
-
-
-void 
-ctm_shear_post_2 (double shrx, double shry)
-{
-    GRFMTX_2D m;
-
-    shear_gmtx_2 (m, shrx, shry);
-    ctm_post_mult_2 (m);
-}
-
-/*---------------------------------------------------------------------------*/
-/*                     Low-Level Internal Functions                         */
-/*---------------------------------------------------------------------------*/
-
-
-void 
-xlat_gmtx_2 (GRFMTX_2D m, double x, double y)
-{
-    ident_gmtx_2 (m);
-    m[2][0] = x;
-    m[2][1] = y;
-}
-
-
-void 
-scale_gmtx_2 (GRFMTX_2D m, double sx, double sy)
-{
-    ident_gmtx_2 (m);
-    m[0][0] = sx;
-    m[1][1] = sy;
-}
-
-
-void 
-shear_gmtx_2 (GRFMTX_2D m, double shrx, double shry)
-{
-    ident_gmtx_2 (m);
-    m[1][0] = shrx;
-    m[0][1] = shry;
-}
-
-void 
-rotate_gmtx_2 (GRFMTX_2D m, double theta)
-{
-    double s, c;
-
-    s = sin (theta);
-    c = cos (theta);
-
-    ident_gmtx_2 (m);
-
-    m[0][0] =  c;  m[0][1] = s;
-    m[1][0] = -s;  m[1][1] = c;
-}
-
-
-void 
-ident_gmtx_2 (GRFMTX_2D m)
-{
-    m[0][0] = 1.;  m[0][1] = 0.;  m[0][2] = 0.;
-    m[1][0] = 0.;  m[1][1] = 1.;  m[1][2] = 0.;
-    m[2][0] = 0.;  m[2][1] = 0.;  m[2][2] = 1.;
-}
-
-
-void 
-mult_gmtx_2 (GRFMTX_2D a, GRFMTX_2D b, GRFMTX_2D c)
-{
-    int row, col, calc;
-
-    for (row = 0; row < 3; row++)
-       for (col = 0; col < 3; col++) {
-           c[row][col] = 0.;
-           for (calc = 0; calc < 3; calc++)
-               c[row][col] += a[row][calc] * b[calc][col];
-       }
-}
-
-void 
-invert_gmtx_2 (GRFMTX_2D a, GRFMTX_2D b)
-{
-    double determ;
-
-    determ = determ_gmtx_2 (a);
-    if (fabs(determ) < 1E-6)
-       sys_error (ERR_WARNING, "Determinant = %lg [invert_gmtx_2]", determ);
-
-    b[0][0] =  (a[1][1] * a[2][2] - a[2][1] * a[1][2]) / determ;
-    b[1][0] = -(a[1][0] * a[2][2] - a[2][0] * a[1][2]) / determ;
-    b[2][0] =  (a[1][0] * a[2][1] - a[2][0] * a[1][1]) / determ;
-
-    b[0][1] = -(a[0][1] * a[2][2] - a[2][1] * a[0][2]) / determ;
-    b[1][1] =  (a[0][0] * a[2][2] - a[2][0] * a[0][2]) / determ;
-    b[2][1] = -(a[0][0] * a[2][1] - a[2][0] * a[0][1]) / determ;
-
-    b[0][2] =  (a[0][1] * a[1][2] - a[1][1] * a[0][2]) / determ;
-    b[1][2] = -(a[0][0] * a[1][2] - a[1][0] * a[0][2]) / determ;
-    b[2][2] =  (a[0][0] * a[1][1] - a[1][0] * a[0][1]) / determ;
-}
-
-
-double 
-determ_gmtx_2 (GRFMTX_2D a)
-{
-    return
-       (a[0][0] * a[1][1] * a[2][2] - a[0][0] * a[2][1] * a[1][2] -
-        a[0][1] * a[1][0] * a[2][2] + a[0][1] * a[2][0] * a[1][2] +
-        a[0][2] * a[1][0] * a[2][1] - a[0][2] * a[2][0] * a[1][1]);
-}
-