Mercurial > hg > camir-ismir2012
comparison toolboxes/graph_visualisation/include/graphviz/arith.h @ 0:cc4b1211e677 tip
initial commit to HG from
Changeset:
646 (e263d8a21543) added further path and more save "camirversion.m"
| author | Daniel Wolff |
|---|---|
| date | Fri, 19 Aug 2016 13:07:06 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:cc4b1211e677 |
|---|---|
| 1 /* $Id: arith.h,v 1.16 2009/06/03 01:10:51 ellson Exp $ $Revision: 1.16 $ */ | |
| 2 /* vim:set shiftwidth=4 ts=8: */ | |
| 3 | |
| 4 /********************************************************** | |
| 5 * This software is part of the graphviz package * | |
| 6 * http://www.graphviz.org/ * | |
| 7 * * | |
| 8 * Copyright (c) 1994-2004 AT&T Corp. * | |
| 9 * and is licensed under the * | |
| 10 * Common Public License, Version 1.0 * | |
| 11 * by AT&T Corp. * | |
| 12 * * | |
| 13 * Information and Software Systems Research * | |
| 14 * AT&T Research, Florham Park NJ * | |
| 15 **********************************************************/ | |
| 16 | |
| 17 /* geometric functions (e.g. on points and boxes) with application to, but | |
| 18 * no specific dependance on graphs */ | |
| 19 | |
| 20 #ifndef GV_ARITH_H | |
| 21 #define GV_ARITH_H | |
| 22 | |
| 23 /* for sincos */ | |
| 24 #ifndef _GNU_SOURCE | |
| 25 #define _GNU_SOURCE 1 | |
| 26 #endif | |
| 27 | |
| 28 #include <limits.h> | |
| 29 #ifdef HAVE_VALUES_H | |
| 30 #include <values.h> | |
| 31 #endif | |
| 32 #include <math.h> | |
| 33 | |
| 34 #ifdef __cplusplus | |
| 35 extern "C" { | |
| 36 #endif | |
| 37 | |
| 38 #ifdef MIN | |
| 39 #undef MIN | |
| 40 #endif | |
| 41 #define MIN(a,b) ((a)<(b)?(a):(b)) | |
| 42 | |
| 43 #ifdef MAX | |
| 44 #undef MAX | |
| 45 #endif | |
| 46 #define MAX(a,b) ((a)>(b)?(a):(b)) | |
| 47 | |
| 48 #ifdef ABS | |
| 49 #undef ABS | |
| 50 #endif | |
| 51 #define ABS(a) ((a) >= 0 ? (a) : -(a)) | |
| 52 | |
| 53 #define AVG(a,b) ((a + b) / 2) | |
| 54 #define SGN(a) (((a)<0)? -1 : 1) | |
| 55 #define CMP(a,b) (((a)<(b)) ? -1 : (((a)>(b)) ? 1 : 0)) | |
| 56 | |
| 57 #ifndef INT_MAX | |
| 58 #define INT_MAX ((int)(~(unsigned)0 >> 1)) | |
| 59 #endif | |
| 60 | |
| 61 #ifndef INT_MIN | |
| 62 #define INT_MIN (-INT_MAX - 1) | |
| 63 #endif | |
| 64 | |
| 65 #ifndef MAXSHORT | |
| 66 #define MAXSHORT (0x7fff) | |
| 67 #endif | |
| 68 | |
| 69 #ifndef MAXDOUBLE | |
| 70 #define MAXDOUBLE 1.7976931348623157e+308 | |
| 71 #endif | |
| 72 | |
| 73 #ifndef MAXFLOAT | |
| 74 #define MAXFLOAT ((float)3.40282347e+38) | |
| 75 #endif | |
| 76 | |
| 77 #ifdef BETWEEN | |
| 78 #undef BETWEEN | |
| 79 #endif | |
| 80 #define BETWEEN(a,b,c) (((a) <= (b)) && ((b) <= (c))) | |
| 81 | |
| 82 #ifndef M_PI | |
| 83 #define M_PI 3.14159265358979323846 | |
| 84 #endif | |
| 85 | |
| 86 #ifndef SQRT2 | |
| 87 #define SQRT2 1.41421356237309504880 | |
| 88 #endif | |
| 89 | |
| 90 #define ROUND(f) ((f>=0)?(int)(f + .5):(int)(f - .5)) | |
| 91 #define RADIANS(deg) ((deg)/180.0 * M_PI) | |
| 92 #define DEGREES(rad) ((rad)/M_PI * 180.0) | |
| 93 | |
| 94 #define SQR(a) ((a) * (a)) | |
| 95 | |
| 96 #ifdef HAVE_SINCOS | |
| 97 extern void sincos(double x, double *s, double *c); | |
| 98 #else | |
| 99 # define sincos(x,s,c) *s = sin(x); *c = cos(x) | |
| 100 #endif | |
| 101 | |
| 102 #ifdef __cplusplus | |
| 103 } | |
| 104 #endif | |
| 105 | |
| 106 #endif |
