GCC Code Coverage Report


Directory: source/
File: source/utils/ecs_vector.c
Date: 2023-12-18 09:27:49
Exec Total Coverage
Lines: 162 162 100.0%
Branches: 0 0 -%

Line Branch Exec Source
1 /*
2 * Filename: ecs_vector.c
3 * Path: source/utils
4 * Created Date: Saturday, September 30th 2023, 6:38:31 pm
5 * Author: osvegn
6 *
7 * Copyright (c) 2023 ECS
8 */
9
10 #include "utils/ecs_vector.h"
11
12 /// ecs_vector2i
13
14 1 void set_vector2i(ecs_vector2i_t *vector, int x, int y)
15 {
16 1 vector->x = x;
17 1 vector->y = y;
18 1 }
19
20 1 ecs_vector2i_t *add_vector2i(ecs_vector2i_t *a, ecs_vector2i_t *b)
21 {
22 1 a->x += b->x;
23 1 a->y += b->y;
24 1 return a;
25 }
26
27 1 ecs_vector2i_t *add_vector2i_value(ecs_vector2i_t *a, int value)
28 {
29 1 a->x += value;
30 1 a->y += value;
31 1 return a;
32 }
33
34 1 ecs_vector2i_t *sub_vector2i(ecs_vector2i_t *a, ecs_vector2i_t *b)
35 {
36 1 a->x -= b->x;
37 1 a->y -= b->y;
38 1 return a;
39 }
40
41 1 ecs_vector2i_t *sub_vector2i_value(ecs_vector2i_t *a, int value)
42 {
43 1 a->x -= value;
44 1 a->y -= value;
45 1 return a;
46 }
47
48 1 ecs_vector2i_t *mul_vector2i(ecs_vector2i_t *a, ecs_vector2i_t *b)
49 {
50 1 a->x *= b->x;
51 1 a->y *= b->y;
52 1 return a;
53 }
54
55 1 ecs_vector2i_t *mul_vector2i_value(ecs_vector2i_t *a, int value)
56 {
57 1 a->x *= value;
58 1 a->y *= value;
59 1 return a;
60 }
61
62 1 ecs_vector2i_t *div_vector2i(ecs_vector2i_t *a, ecs_vector2i_t *b)
63 {
64 1 a->x /= b->x;
65 1 a->y /= b->y;
66 1 return a;
67 }
68
69 1 ecs_vector2i_t *div_vector2i_value(ecs_vector2i_t *a, int value)
70 {
71 1 a->x /= value;
72 1 a->y /= value;
73 1 return a;
74 }
75
76 /// ecs_vector3i
77
78 1 void set_vector3i(ecs_vector3i_t *vector, int x, int y, int z)
79 {
80 1 vector->x = x;
81 1 vector->y = y;
82 1 vector->z = z;
83 1 }
84
85 1 ecs_vector3i_t *add_vector3i(ecs_vector3i_t *a, ecs_vector3i_t *b)
86 {
87 1 a->x += b->x;
88 1 a->y += b->y;
89 1 a->z += b->z;
90 1 return a;
91 }
92
93 1 ecs_vector3i_t *add_vector3i_value(ecs_vector3i_t *a, int value)
94 {
95 1 a->x += value;
96 1 a->y += value;
97 1 a->z += value;
98 1 return a;
99 }
100
101 1 ecs_vector3i_t *sub_vector3i(ecs_vector3i_t *a, ecs_vector3i_t *b)
102 {
103 1 a->x -= b->x;
104 1 a->y -= b->y;
105 1 a->z -= b->z;
106 1 return a;
107 }
108
109 1 ecs_vector3i_t *sub_vector3i_value(ecs_vector3i_t *a, int value)
110 {
111 1 a->x -= value;
112 1 a->y -= value;
113 1 a->z -= value;
114 1 return a;
115 }
116
117 1 ecs_vector3i_t *mul_vector3i(ecs_vector3i_t *a, ecs_vector3i_t *b)
118 {
119 1 a->x *= b->x;
120 1 a->y *= b->y;
121 1 a->z *= b->z;
122 1 return a;
123 }
124
125 1 ecs_vector3i_t *mul_vector3i_value(ecs_vector3i_t *a, int value)
126 {
127 1 a->x *= value;
128 1 a->y *= value;
129 1 a->z *= value;
130 1 return a;
131 }
132
133 1 ecs_vector3i_t *div_vector3i(ecs_vector3i_t *a, ecs_vector3i_t *b)
134 {
135 1 a->x /= b->x;
136 1 a->y /= b->y;
137 1 a->z /= b->z;
138 1 return a;
139 }
140
141 1 ecs_vector3i_t *div_vector3i_value(ecs_vector3i_t *a, int value)
142 {
143 1 a->x /= value;
144 1 a->y /= value;
145 1 a->z /= value;
146 1 return a;
147 }
148
149 /// ecs_vector2f
150
151 1 void set_vector2f(ecs_vector2f_t *vector, double x, double y)
152 {
153 1 vector->x = x;
154 1 vector->y = y;
155 1 }
156
157 1 ecs_vector2f_t *add_vector2f(ecs_vector2f_t *a, ecs_vector2f_t *b)
158 {
159 1 a->x += b->x;
160 1 a->y += b->y;
161 1 return a;
162 }
163
164 1 ecs_vector2f_t *add_vector2f_value(ecs_vector2f_t *a, double value)
165 {
166 1 a->x += value;
167 1 a->y += value;
168 1 return a;
169 }
170
171 1 ecs_vector2f_t *sub_vector2f(ecs_vector2f_t *a, ecs_vector2f_t *b)
172 {
173 1 a->x -= b->x;
174 1 a->y -= b->y;
175 1 return a;
176 }
177
178 1 ecs_vector2f_t *sub_vector2f_value(ecs_vector2f_t *a, double value)
179 {
180 1 a->x -= value;
181 1 a->y -= value;
182 1 return a;
183 }
184
185 1 ecs_vector2f_t *mul_vector2f(ecs_vector2f_t *a, ecs_vector2f_t *b)
186 {
187 1 a->x *= b->x;
188 1 a->y *= b->y;
189 1 return a;
190 }
191
192 1 ecs_vector2f_t *mul_vector2f_value(ecs_vector2f_t *a, double value)
193 {
194 1 a->x *= value;
195 1 a->y *= value;
196 1 return a;
197 }
198
199 1 ecs_vector2f_t *div_vector2f(ecs_vector2f_t *a, ecs_vector2f_t *b)
200 {
201 1 a->x /= b->x;
202 1 a->y /= b->y;
203 1 return a;
204 }
205
206 1 ecs_vector2f_t *div_vector2f_value(ecs_vector2f_t *a, double value)
207 {
208 1 a->x /= value;
209 1 a->y /= value;
210 1 return a;
211 }
212
213 /// ecs_vector3f
214
215 1 void set_vector3f(ecs_vector3f_t *vector, double x, double y, double z)
216 {
217 1 vector->x = x;
218 1 vector->y = y;
219 1 vector->z = z;
220 1 }
221
222 1 ecs_vector3f_t *add_vector3f(ecs_vector3f_t *a, ecs_vector3f_t *b)
223 {
224 1 a->x += b->x;
225 1 a->y += b->y;
226 1 a->z += b->z;
227 1 return a;
228 }
229
230 1 ecs_vector3f_t *add_vector3f_value(ecs_vector3f_t *a, double value)
231 {
232 1 a->x += value;
233 1 a->y += value;
234 1 a->z += value;
235 1 return a;
236 }
237
238 1 ecs_vector3f_t *sub_vector3f(ecs_vector3f_t *a, ecs_vector3f_t *b)
239 {
240 1 a->x -= b->x;
241 1 a->y -= b->y;
242 1 a->z -= b->z;
243 1 return a;
244 }
245
246 1 ecs_vector3f_t *sub_vector3f_value(ecs_vector3f_t *a, double value)
247 {
248 1 a->x -= value;
249 1 a->y -= value;
250 1 a->z -= value;
251 1 return a;
252 }
253
254 1 ecs_vector3f_t *mul_vector3f(ecs_vector3f_t *a, ecs_vector3f_t *b)
255 {
256 1 a->x *= b->x;
257 1 a->y *= b->y;
258 1 a->z *= b->z;
259 1 return a;
260 }
261
262 1 ecs_vector3f_t *mul_vector3f_value(ecs_vector3f_t *a, double value)
263 {
264 1 a->x *= value;
265 1 a->y *= value;
266 1 a->z *= value;
267 1 return a;
268 }
269
270 1 ecs_vector3f_t *div_vector3f(ecs_vector3f_t *a, ecs_vector3f_t *b)
271 {
272 1 a->x /= b->x;
273 1 a->y /= b->y;
274 1 a->z /= b->z;
275 1 return a;
276 }
277
278 1 ecs_vector3f_t *div_vector3f_value(ecs_vector3f_t *a, double value)
279 {
280 1 a->x /= value;
281 1 a->y /= value;
282 1 a->z /= value;
283 1 return a;
284 }
285