[AdgTransformationMode] Renamed to AdgTransformMode
[adg.git] / cpml / cpml-util.c
blob13f88f6e1a3a4cc33c97da7a34b71dd6754f22c5
1 /* CPML - Cairo Path Manipulation Library
2 * Copyright (C) 2008, 2009 Nicola Fontana <ntd at entidi.it>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
21 /**
22 * SECTION:cpml-util
23 * @Section_Id:utilities
24 * @title: Utilities
25 * @short_description: Assorted macros and functions
27 * Collection of macros and functions that do not fit inside any other topic.
28 **/
31 #include "cpml-util.h"
32 #include <math.h>
35 /**
36 * CPML_GNUC_CONST:
38 * To be appended at the end of a function to notice the compiler (gcc)
39 * that the return value is constant.
41 * The coded is an adaptation of the #G_GNUC_CONST macro defined by
42 * glib-2.18.3 in <filename>glib/gmacros.h</filename>.
43 **/
45 /**
46 * CAIRO_HAS_ARC_SUPPORT:
48 * Defined to 1 if cairo has arc support. Actually (cairo-1.8.8) cairo
49 * does not have arc support so it is expected this define will be always
50 * undefined.
51 **/
53 /**
54 * CAIRO_PATH_ARC_TO:
56 * The code of an arc-to primitive. This is expected to be defined by
57 * cairo whenever (and if) cairo will support arc primitives. Actually
58 * it resolves to an harcoded %100 constant.
60 * Check out the #CpmlArc section for further information.
61 **/
64 /**
65 * cpml_angle:
66 * @angle: an angle in radians
68 * Normalizes @angle, that is returns the equivalent radians value
69 * between the range %M_PI (inclusive) and %-M_PI (exclusive).
71 * Returns: an equivalent value in radians
72 **/
73 double
74 cpml_angle(double angle)
76 while (angle > M_PI)
77 angle -= M_PI * 2;
79 while (angle <= -M_PI)
80 angle += M_PI * 2;
82 return angle;