X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;ds=sidebyside;f=include%2Fkmath.h;h=5bac1bec41ded693c220315fe65c325c5808568b;hb=07b93dbf2b66fa23c5378ab0fa42f9a7f0083380;hp=636339a33483a97495b76f910f7758d56a12a16c;hpb=13838bda88b63a2535b5baaf7197006767de4b8e;p=ctsim.git diff --git a/include/kmath.h b/include/kmath.h index 636339a..5bac1be 100644 --- a/include/kmath.h +++ b/include/kmath.h @@ -1,16 +1,53 @@ +/***************************************************************************** +** This is part of the CTSim program +** Copyright (C) 1983-2000 Kevin Rosenberg +** +** $Id: kmath.h,v 1.10 2000/06/07 00:59:38 kevin Exp $ +** $Log: kmath.h,v $ +** Revision 1.10 2000/06/07 00:59:38 kevin +** added imagefiles +** +** Revision 1.9 2000/05/08 20:00:48 kevin +** ANSI C changes +** +** Revision 1.8 2000/05/07 12:46:19 kevin +** made c++ compatible +** +** Revision 1.7 2000/05/04 18:16:34 kevin +** renamed filter definitions +** +** Revision 1.6 2000/05/02 20:00:25 kevin +** *** empty log message *** +** +** Revision 1.5 2000/05/02 15:31:39 kevin +** code cleaning +** +** Revision 1.4 2000/04/30 19:17:35 kevin +** Set up include files for conditional INTERACTIVE_GRAPHICS +** +** Revision 1.3 2000/04/28 14:14:16 kevin +** *** empty log message *** +** +** +** 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 - * - * File Name: NUMR.H - * Author: Kevin Rosenberg - * Purpose: Header file containing definitions for numerical app's + * PURPOSE + * Header file containing definitions for numerical app's * Date Started: Nov 84 * - * DESCRIPTION - * - * MODIFICATION LOG - * *****************************************************************************/ #ifndef _H_kmath @@ -19,6 +56,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + #define PI 3.14159265358979323846 #define HALFPI 1.57079632679489661923 /* PI divided by 2 */ #define QUARTPI 0.78539816339744830962 /* PI divided by 4 */ @@ -40,11 +81,12 @@ /* codes for C data types */ #define DT_CHAR 1 -#define DT_INT 2 +#define DT_INT 2 #define DT_LONG 3 #define DT_FLOAT 4 #define DT_DOUBLE 5 -#define DT_STRING 6 +#define DT_UINT32 6 +#define DT_STRING 7 typedef char *CMTX_1D; typedef CMTX_1D *CMTX_2D; @@ -62,6 +104,9 @@ typedef double *DMTX_1D; typedef DMTX_1D *DMTX_2D; typedef DMTX_2D *DMTX_3D; +typedef double GRFMTX_2D[3][3]; +typedef double GRFMTX_3D[4][4]; + union elem_val_un { /* holds an element value */ char c; int i; @@ -138,51 +183,58 @@ typedef struct matrix_st *MTXP; ))))) */ +/* clip.c */ +int clip_rect(double *x1, double *y1, double *x2, double *y2, const double rect[4]); +int clip_segment(double *x1, double *y1, double *x2, double *y2, const double u, const double v); +int clip_sector(double *x1, double *y1, double *x2, double *y2, const double u, const double v); +int clip_circle(double *x1, double *y1, double *x2, double *y2, const double cx, const double cy, const double radius, double t1, double t2); +int clip_triangle(double *x1, double *y1, double *x2, double *y2, const double u, const double v, const int clip_xaxis); -/* calc_x.c */ -int calc_x(double *x, const double xmin, const double xmax, const int n); -/* calcpoly.c */ -void calcpoly(const double *a, const int degree, const double *x, double *y, const int n); -/* gauss.c */ -int gauss(double **a, double *b, double *x, const int num); /* lnearest.c */ long int lnearest(double x); -/* lsfit.c */ -int lsfit(double *x, double *y, int n, int degree, double *coeff, FILE *fp); -/* matprt.c */ -void matprt(const double **m, const int row, const int col, FILE *fp); + +/* minmax.c */ +double fmax(const double a, const double b); +void minmax_dvector(const double array[], const int pts, double *xmin, double *xmax); + /* mtx_disp.c */ void mtx_show(const MTX *mtx); void mtx_prt(const MTX *mtx, FILE *fp); int mtx_prt_elem(const MTX *mtx, FILE *fp, unsigned int x, unsigned int y, unsigned int z); + /* mtx_elem.c */ int mtx_get_elem(const MTX *mtx, MTX_ELEM_VAL *me, const int x, const int y, const int z); int mtx_put_elem(MTX *mtx, const MTX_ELEM_VAL *me, unsigned int x, unsigned int y, unsigned int z); + /* mtx_inp.c */ int mtx_inp_elem(const char *prompt, MTX_ELEM_VAL *mev, const int dtype); + /* mtx_main.c */ MTX *mtx_init(const unsigned int order, const unsigned int elem_type, const unsigned int nx, const unsigned int ny, const unsigned int nz); MTX *mtx_clr(MTX *mtx); int mtx_free(MTX *mtx); int mtx_elem_size(const int dt); int mtx_check(const MTX *mtx, const char *func_name); + /* norm_ang.c */ double norm_ang(double theta); -/* pntprt.c */ -void pntprt(const double *x, const double *y, const int n, FILE *fp); -/* pntread.c */ -int pntread(double *x, double *y, int *num, const int maxn, FILE *fp); -/* poly.c */ -double poly(const double *a, const int degree, const double x); + /* simpson.c */ double simpson(const double xmin, const double xmax, const double *y, const int np); -/* stddev.c */ -double stddev(const double *y1, const double *y2, const int n, const int df_lost); -/* vectprt.c */ -void vectprt(const double *v, const int n, FILE *fp); -/* vectread.c */ -int vectread(double *v, int *n, const int maxn, FILE *fp); -/* vectsort.c */ -int vectsort(int num_vec, const int dtype, const int num_pts, char *vec1, char *vec2, char *vec3); + +/* xform.c */ +void indent_mtx2(GRFMTX_2D m); +void xlat_mtx2(GRFMTX_2D m, const double x, const double y); +void scale_mtx2(GRFMTX_2D m, const double sx, const double sy); +void rot_mtx2(GRFMTX_2D m, const double theta); +void mult_mtx2(GRFMTX_2D m1, GRFMTX_2D m2, GRFMTX_2D result); +void xform_mtx2(GRFMTX_2D m, double *x, double *y); +void rotate2d(double x[], double y[], int pts, double angle); +void xlat2d(double x[], double y[], int pts, double xoffset, double yoffset); +void scale2d(double x[], double y[], int pts, double xfact, double yfact); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ #endif