Debian Codegraph @

engine/core/util/math/math.i

raw
1 /***************************************************************************
2 * Copyright (C) 2005-2019 by the FIFE team *
3 * http://www.fifengine.net *
4 * This file is part of FIFE. *
5 * *
6 * FIFE 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.1 of the License, or (at your option) any later version. *
10 * *
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. *
15 * *
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., *
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
20 ***************************************************************************/
21 %module fife
22
23 %{
24 #include "util/math/angles.h"
25 #include "util/math/fife_math.h"
26 %}
27
28 namespace FIFE {
29
30 template <class numT>
31 struct float_traits { };
32
33 template <typename T>
34 class Math {
35 public:
36 typedef T num_type;
37 typedef float_traits<num_type> traits_type;
38
39 static inline num_type epsilon();
40 static inline num_type zeroTolerance();
41 static inline num_type max();
42 static inline num_type pi();
43 static inline num_type twoPi();
44 static inline num_type halfPi();
45 static inline num_type inversePi();
46 static inline num_type inverseTwoPi();
47 static inline num_type degToRad();
48 static inline num_type radToDeg();
49 static inline num_type log2();
50 static inline num_type log10();
51 static inline num_type invLog2();
52 static inline num_type invLog10();
53
54 static T ACos(T _val);
55 static T ASin(T _val);
56 static T ATan(T _val);
57 static T ATan2(T _x, T _y);
58 static T Ceil(T _val);
59 static T Cos(T _val);
60 static T Exp(T _val);
61 static T FAbs(T _val);
62 static T Floor(T _val);
63 static T FMod (T _x, T _y);
64 static T InvSqrt(T _val);
65 static T Log(T _val);
66 static T Log2(T _val);
67 static T Log10(T _val);
68 static T Pow(T _base, T _exponent);
69 static T Sin(T _val);
70 static T Sqr(T _val);
71 static T Sqrt(T _val);
72 static T Tan(T _val);
73 };
74
75 int32_t getAngleBetween(const Location& loc1, const Location& loc2);
76 Location getFacing(const Location& loc, const int32_t angle);
77 int32_t getAngleBetween(const ExactModelCoordinate& emc1, const ExactModelCoordinate& emc2);
78 ExactModelCoordinate getFacing(const ExactModelCoordinate& emc, const int32_t angle);
79
80 typedef Math<float> Mathf;
81 typedef Math<double> Mathd;
82
83 %template(Mathf) Math<float>;
84 %template(Mathd) Math<double>;
85
86 }