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