doc: updated copyright
[adg.git] / src / cpml / cpml-utils.c
blobc76180c86b281968c5f2588b67892967a25aac44
1 /* CPML - Cairo Path Manipulation Library
2 * Copyright (C) 2007,2008,2009,2010,2011,2012,2013 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-utils
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.
29 * Since: 1.0
30 **/
33 #include "cpml-internal.h"
34 #include <math.h>
37 /**
38 * CPML_GNUC_CONST:
40 * To be appended at the end of a function to notice the compiler (gcc)
41 * that the return value is constant.
43 * The coded is an adaptation of the #G_GNUC_CONST macro defined by
44 * glib-2.18.3 in <filename>glib/gmacros.h</filename>.
46 * Since: 1.0
47 **/
50 /**
51 * cpml_angle:
52 * @angle: an angle in radians
54 * Normalizes @angle, that is returns the equivalent radians value
55 * between the range %M_PI (inclusive) and %-M_PI (exclusive).
57 * Returns: an equivalent value in radians
59 * Since: 1.0
60 **/
61 double
62 cpml_angle(double angle)
64 while (angle > M_PI)
65 angle -= M_PI * 2;
67 while (angle <= -M_PI)
68 angle += M_PI * 2;
70 return angle;