1
/* LIBGIMP - The GIMP Library
2
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU Lesser General Public
8
* License as published by the Free Software Foundation; either
9
* version 2 of the License, or (at your option) any later version.
11
* This library is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* Lesser General Public License for more details.
16
* You should have received a copy of the GNU Lesser General Public
17
* License along with this library; if not, write to the
18
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19
* Boston, MA 02111-1307, USA.
22
#ifndef __GIMP_MATH_H__
23
#define __GIMP_MATH_H__
35
#include <libgimpmath/gimpmathtypes.h>
37
#include <libgimpmath/gimpmatrix.h>
38
#include <libgimpmath/gimpmd5.h>
39
#include <libgimpmath/gimpvector.h>
43
/* Some portability enhancing stuff. For use both by the gimp app
44
* as well as plug-ins and modules.
46
* Include this instead of just <math.h>.
49
/* Use RINT() instead of rint() */
51
#define RINT(x) rint(x)
53
#define RINT(x) floor ((x) + 0.5)
56
#define ROUND(x) ((int) ((x) + 0.5))
59
#define SQR(x) ((x) * (x))
61
/* Limit a (0->511) int to 255 */
62
#define MAX255(a) ((a) | (((a) & 256) - (((a) & 256) >> 8)))
64
/* Clamp a >>int32<<-range int between 0 and 255 inclusive */
65
#define CLAMP0255(a) CLAMP(a,0,255)
67
#define gimp_deg_to_rad(angle) ((angle) * (2.0 * G_PI) / 360.0)
68
#define gimp_rad_to_deg(angle) ((angle) * 360.0 / (2.0 * G_PI))
73
#endif /* __GIMP_MATH_H__ */