1 /*****************************************************************************
2 ** This is part of the CTSim program
3 ** Copyright (C) 1983-2000 Kevin Rosenberg
5 ** $Id: kmath.h,v 1.11 2000/06/09 01:35:33 kevin Exp $
7 ** Revision 1.11 2000/06/09 01:35:33 kevin
8 ** Convert MPI structure to C++ class
10 ** Revision 1.10 2000/06/07 00:59:38 kevin
13 ** Revision 1.9 2000/05/08 20:00:48 kevin
16 ** Revision 1.8 2000/05/07 12:46:19 kevin
17 ** made c++ compatible
19 ** Revision 1.7 2000/05/04 18:16:34 kevin
20 ** renamed filter definitions
22 ** Revision 1.6 2000/05/02 20:00:25 kevin
23 ** *** empty log message ***
25 ** Revision 1.5 2000/05/02 15:31:39 kevin
28 ** Revision 1.4 2000/04/30 19:17:35 kevin
29 ** Set up include files for conditional INTERACTIVE_GRAPHICS
31 ** Revision 1.3 2000/04/28 14:14:16 kevin
32 ** *** empty log message ***
35 ** This program is free software; you can redistribute it and/or modify
36 ** it under the terms of the GNU General Public License (version 2) as
37 ** published by the Free Software Foundation.
39 ** This program is distributed in the hope that it will be useful,
40 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
41 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
42 ** GNU General Public License for more details.
44 ** You should have received a copy of the GNU General Public License
45 ** along with this program; if not, write to the Free Software
46 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
47 ******************************************************************************/
48 /******************************************************************************
51 * Header file containing definitions for numerical app's
52 * Date Started: Nov 84
54 *****************************************************************************/
64 #endif /* __cplusplus */
66 #define PI 3.14159265358979323846
67 #define HALFPI 1.57079632679489661923 /* PI divided by 2 */
68 #define QUARTPI 0.78539816339744830962 /* PI divided by 4 */
69 #define I_PI 0.31830988618379067154 /* Inverse of PI */
70 #define I_PID2 0.63661977236758134308 /* Inverse of PID2 */
72 #define TWOPI 6.28318530717958647692
73 #define SQRT2 1.414213562373095049
75 #define F_EPSILON 1.0E-6
76 #define D_EPSILON 1.0E-10
78 #define DEG_TO_RAD(x) (x*(PI/180.))
79 #define RAD_TO_DEG(x) (x*(180./PI))
82 #define ASSUMEDZERO 1E-10
84 typedef double GRFMTX_2D[3][3];
85 typedef double GRFMTX_3D[4][4];
88 int clip_rect(double *x1, double *y1, double *x2, double *y2, const double rect[4]);
89 int clip_segment(double *x1, double *y1, double *x2, double *y2, const double u, const double v);
90 int clip_sector(double *x1, double *y1, double *x2, double *y2, const double u, const double v);
91 int clip_circle(double *x1, double *y1, double *x2, double *y2, const double cx, const double cy, const double radius, double t1, double t2);
92 int clip_triangle(double *x1, double *y1, double *x2, double *y2, const double u, const double v, const int clip_xaxis);
95 long int lnearest(double x);
98 double fmax(const double a, const double b);
99 void minmax_dvector(const double array[], const int pts, double *xmin, double *xmax);
102 double norm_ang(double theta);
105 double simpson(const double xmin, const double xmax, const double *y, const int np);
108 void indent_mtx2(GRFMTX_2D m);
109 void xlat_mtx2(GRFMTX_2D m, const double x, const double y);
110 void scale_mtx2(GRFMTX_2D m, const double sx, const double sy);
111 void rot_mtx2(GRFMTX_2D m, const double theta);
112 void mult_mtx2(GRFMTX_2D m1, GRFMTX_2D m2, GRFMTX_2D result);
113 void xform_mtx2(GRFMTX_2D m, double *x, double *y);
114 void rotate2d(double x[], double y[], int pts, double angle);
115 void xlat2d(double x[], double y[], int pts, double xoffset, double yoffset);
116 void scale2d(double x[], double y[], int pts, double xfact, double yfact);
120 #endif /* __cplusplus */