X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=include%2Fctsupport.h;h=60a6c2c40adb2fd6acc476895b2aae76e6b48abb;hp=58274ee3039a9e37c7157a73f3dbcb7a70eef987;hb=ee0105d74fec9d6bfd236e22e9e1d315e46c568e;hpb=3e346e67f7f7a331919a32439b0f54a4d53d3029 diff --git a/include/ctsupport.h b/include/ctsupport.h index 58274ee..60a6c2c 100644 --- a/include/ctsupport.h +++ b/include/ctsupport.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: ctsupport.h,v 1.5 2000/06/28 15:25:34 kevin Exp $ +** $Id: ctsupport.h,v 1.8 2000/12/06 01:46:43 kevin Exp $ ** ** ** This program is free software; you can redistribute it and/or modify @@ -191,7 +191,7 @@ char *td_day_name(int n); // Math Section -#include +#include #define PI 3.14159265358979323846 #define HALFPI 1.57079632679489661923 /* PI divided by 2 */ @@ -222,6 +222,9 @@ template inline T nearest (double x) { return (x > 0 ? static_cast(x+0.5) : static_cast(x-0.5)); } +inline int imax (int a, int b) +{ return (a >= b ? a : b); } + template inline T clamp (T value, T lowerBounds, T upperBounds) { return (value >= upperBounds ? upperBounds : (value <= lowerBounds ? lowerBounds : value )); } @@ -248,7 +251,7 @@ inline void minmax_array (const T* array, const int n, T& min, T& max) ////////////////////////////////////////////////////////////// // clip.cpp -int clip_rect (double& x1, double& y1, double& x2, double& y2, const double rect[4]); +bool 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); @@ -271,25 +274,6 @@ double normalizeAngle (double theta); double integrateSimpson (const double xmin, const double xmax, const double *y, const int np); -// Console I/O Section - -#define C_BLACK 0 /* color codes */ -#define C_BLUE 1 -#define C_GREEN 2 -#define C_CYAN 3 -#define C_RED 4 -#define C_MAGENTA 5 -#define C_BROWN 6 -#define C_WHITE 7 -#define C_GREY 8 -#define C_LTBLUE 9 -#define C_LTGREEN 10 -#define C_LTCYAN 11 -#define C_LTRED 12 -#define C_LTMAGENTA 13 -#define C_YELLOW 14 -#define C_LTWHITE 15 - /*----------------------------------------------------------------------*/ /* screen character codes */