11 #include "Profiler/KapProfiler.hpp"
28 Vector2(
float x = 0.0f,
float y = 0.0f) : x(x), y(y) {
37 PROFILER_FUNC_START();
42 PROFILER_FUNC_START();
55 return Vector2(getX() + vec.getX(), y + vec.getY());
58 Vector2 operator+(
float const& f) {
66 PROFILER_FUNC_START();
72 Vector2 &operator+=(
float const& f) {
73 PROFILER_FUNC_START();
80 PROFILER_FUNC_START();
88 PROFILER_FUNC_START();
90 return Vector2(x - vec.getX(), y - vec.getY());
93 Vector2 operator-(
float const& f) {
94 PROFILER_FUNC_START();
103 PROFILER_FUNC_START();
109 Vector2 &operator-=(
float const& f) {
110 PROFILER_FUNC_START();
117 PROFILER_FUNC_START();
125 PROFILER_FUNC_START();
127 return Vector2(x * vec.getX(), y * vec.getY());
130 Vector2 operator*(
float const& f) {
131 PROFILER_FUNC_START();
140 PROFILER_FUNC_START();
146 Vector2 &operator*=(
float const& f) {
147 PROFILER_FUNC_START();
154 PROFILER_FUNC_START();
162 PROFILER_FUNC_START();
164 return Vector2(x / vec.getX(), y / vec.getY());
167 Vector2 operator/(
float const& f) {
168 PROFILER_FUNC_START();
177 PROFILER_FUNC_START();
183 Vector2 &operator/=(
float const& f) {
184 PROFILER_FUNC_START();
191 PROFILER_FUNC_START();
206 bool operator==(
Vector2 const& vec) {
207 PROFILER_FUNC_START();
208 if (vec.getX() != x) {
212 if (vec.getY() != y) {
219 bool operator!=(
Vector2 const& vec) {
220 PROFILER_FUNC_START();
222 return !(*
this == vec);
230 PROFILER_FUNC_START();
235 std::string to_string()
const {
236 PROFILER_FUNC_START();
237 std::string res =
"{";
239 res += std::to_string(x) +
"; ";
240 res += std::to_string(y) +
"}";
254 Vector3(
float x = 0.0f,
float y = 0.0f,
float z = 0.0f) : x(x), y(y), z(z) {
261 void setX(
float _x) {
262 PROFILER_FUNC_START();
266 void setY(
float _y) {
267 PROFILER_FUNC_START();
271 void setZ(
float _z) {
272 PROFILER_FUNC_START();
288 return Vector3(x + vec.getX(), y + vec.getY(), z + vec.getZ());
291 Vector3 operator+(
float const& f) {
292 return Vector3(x + f, y + f, z + f);
299 PROFILER_FUNC_START();
306 PROFILER_FUNC_START();
312 Vector3 &operator+=(
float const& f) {
313 PROFILER_FUNC_START();
321 PROFILER_FUNC_START();
323 return Vector3(x - vec.getX(), y - vec.getY(), z - vec.getZ());
328 Vector3 operator-(
float const& f) {
329 PROFILER_FUNC_START();
331 return Vector3(x - f, y - f, z - f);
336 PROFILER_FUNC_START();
343 PROFILER_FUNC_START();
349 Vector3 &operator-=(
float const& f) {
350 PROFILER_FUNC_START();
358 PROFILER_FUNC_START();
360 return Vector3(x * vec.getX(), y * vec.getY(), z * vec.getZ());
365 Vector3 operator*(
float const& f) {
366 PROFILER_FUNC_START();
368 return Vector3(x * f, y * f, z * f);
373 PROFILER_FUNC_START();
380 PROFILER_FUNC_START();
386 Vector3 &operator*=(
float const& f) {
387 PROFILER_FUNC_START();
395 PROFILER_FUNC_START();
397 return Vector3(x / vec.getX(), y / vec.getY(), z / vec.getZ());
402 Vector3 operator/(
float const& f) {
403 PROFILER_FUNC_START();
405 return Vector3(x / f, y / f, z / f);
410 PROFILER_FUNC_START();
417 PROFILER_FUNC_START();
423 Vector3 &operator/=(
float const& f) {
424 PROFILER_FUNC_START();
441 bool operator==(
Vector3 const& vec) {
442 PROFILER_FUNC_START();
443 if (vec.getX() != x) {
447 if (vec.getY() != y) {
451 if (vec.getZ() != z) {
458 bool operator!=(
Vector3 const& vec) {
459 PROFILER_FUNC_START();
461 return !(*
this == vec);
469 PROFILER_FUNC_START();
474 std::string to_string()
const {
475 PROFILER_FUNC_START();
476 std::string res =
"{";
478 res += std::to_string(x) +
"; ";
479 res += std::to_string(y) +
"; ";
480 res += std::to_string(z) +
"}";