Debian Codegraph @

src/cdogs/mathc/REFERENCE.md

raw symbols SCIP
1 # MATHC Reference
2
3 ## Utils
4
5 ```c
6 #define MPI
7 #define MPI_2
8 #define MPI_4
9 ```
10
11 Constant values of Pi, Pi divided by 2, and Pi divided by 4.
12
13 ```c
14 #define VEC2_SIZE 2
15 #define VEC3_SIZE 3
16 #define QUAT_SIZE 4
17 #define MAT3_SIZE 9
18 #define MAT4_SIZE 16
19 ```
20
21 Syntactic-sugar macros used for variable declaration.
22
23 ```c
24 #define MFLT_EPSILON
25 ```
26
27 Smaller error margin for float-point comparison.
28
29 ```c
30 bool nearly_equal(mfloat_t a, mfloat_t b, mfloat_t epsilon);
31 ```
32
33 Used to compare two `mfloat_t` variables with an error margin `epsilon`. The standard header `<float.h>` comes with the macro `FLT_EPSILON` that can be used as the error margin. Greater values are also acceptable in most cases, such as `FLT_EPSILON * 10.0f` and `FLT_EPSILON * 100.0f`.
34
35 Returns `true` if the values are accepted as equal and `false` otherwise.
36
37 ```c
38 mfloat_t to_radians(mfloat_t degrees);
39 ```
40
41 Return the angle `degrees` in radians.
42
43 ```c
44 mfloat_t to_degrees(mfloat_t radians);
45 ```
46
47 Return the angle `radians` in degrees.
48
49 # LICENSE
50
51 The source code of this project is licensed under the terms of the ZLIB license:
52
53 Copyright (C) 2016 Felipe Ferreira da Silva
54
55 This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
56
57 Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
58
59 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
60 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
61 3. This notice may not be removed or altered from any source distribution.