Graphviz 13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
arith.h
Go to the documentation of this file.
1
3/*************************************************************************
4 * Copyright (c) 2011 AT&T Intellectual Property
5 * All rights reserved. This program and the accompanying materials
6 * are made available under the terms of the Eclipse Public License v1.0
7 * which accompanies this distribution, and is available at
8 * https://www.eclipse.org/legal/epl-v10.html
9 *
10 * Contributors: Details at https://graphviz.org
11 *************************************************************************/
12
13/* geometric functions (e.g. on points and boxes) with application to, but
14 * no specific dependence on graphs */
15
16#pragma once
17
18#include <limits.h>
19#include <math.h>
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25#ifdef MIN
26#undef MIN
27#endif
28#define MIN(a,b) ((a)<(b)?(a):(b))
29
30#ifdef MAX
31#undef MAX
32#endif
33#define MAX(a,b) ((a)>(b)?(a):(b))
34
35#ifdef BETWEEN
36#undef BETWEEN
37#endif
38#define BETWEEN(a,b,c) (((a) <= (b)) && ((b) <= (c)))
39
40#ifndef M_PI
41#define M_PI 3.14159265358979323846
42#endif
43
44#ifndef SQRT2
45#define SQRT2 1.41421356237309504880
46#endif
47
48#define ROUND(f) ((f>=0)?(int)(f + .5):(int)(f - .5))
49#define RADIANS(deg) ((deg)/180.0 * M_PI)
50#define DEGREES(rad) ((rad)/M_PI * 180.0)
51
52#define SQR(a) ((a) * (a))
53
54#ifdef __cplusplus
55}
56#endif