summaryrefslogtreecommitdiff
path: root/src/types
diff options
context:
space:
mode:
authorKiritoDv <kiritodev01@gmail.com>2026-03-23 21:23:59 -0600
committerKiritoDv <kiritodev01@gmail.com>2026-03-23 21:23:59 -0600
commit75f64161cb4addcbc6e29732df8d9b519a62c43f (patch)
tree92e2b17bd8c41af42bdf24a6eb4b7b08b90254f6 /src/types
parent654b451ddc6cf25db201b2c858948f430784cc5f (diff)
Implemented clang-format
Diffstat (limited to 'src/types')
-rw-r--r--src/types/Vec3D.cpp65
1 files changed, 39 insertions, 26 deletions
diff --git a/src/types/Vec3D.cpp b/src/types/Vec3D.cpp
index ab263f8..8962c1e 100644
--- a/src/types/Vec3D.cpp
+++ b/src/types/Vec3D.cpp
@@ -6,7 +6,7 @@ static int GetPrecision(float f) {
int shift = 1;
float approx = std::round(f);
- while(f != approx && p < 12 ){
+ while (f != approx && p < 12) {
shift *= 10;
p++;
approx = std::round(f * shift) / shift;
@@ -18,16 +18,17 @@ static int GetMagnitude(float f) {
int w = 1;
float a = std::abs(f);
- if(a >= 1) {
+ if (a >= 1) {
w += std::log10(a);
- }
- if(f < 0) {
+ }
+ if (f < 0) {
w++;
}
return w;
}
-Vec3f::Vec3f(float xv, float yv, float zv) : x(xv), y(yv), z(zv) {}
+Vec3f::Vec3f(float xv, float yv, float zv) : x(xv), y(yv), z(zv) {
+}
int Vec3f::precision() {
auto px = GetPrecision(this->x);
@@ -45,14 +46,16 @@ int Vec3f::width() {
return std::max(wx, std::max(wy, wz)) + 1 + this->precision();
}
-std::ostream& operator<< (std::ostream& stream, const Vec3f& vec) {
+std::ostream& operator<<(std::ostream& stream, const Vec3f& vec) {
int width = stream.width();
- stream << std::setw(0) << "{" << std::setw(width) << vec.x << ", " << std::setw(width) << vec.y << ", " << std::setw(width) << vec.z << "}";
+ stream << std::setw(0) << "{" << std::setw(width) << vec.x << ", " << std::setw(width) << vec.y << ", "
+ << std::setw(width) << vec.z << "}";
return stream;
}
-Vec3s::Vec3s(int16_t xv, int16_t yv, int16_t zv) : x(xv), y(yv), z(zv) {}
+Vec3s::Vec3s(int16_t xv, int16_t yv, int16_t zv) : x(xv), y(yv), z(zv) {
+}
int Vec3s::width() {
auto wx = GetMagnitude(this->x);
@@ -62,14 +65,16 @@ int Vec3s::width() {
return std::max(wx, std::max(wy, wz));
}
-std::ostream& operator<< (std::ostream& stream, const Vec3s& vec) {
+std::ostream& operator<<(std::ostream& stream, const Vec3s& vec) {
int width = stream.width();
- stream << std::setw(0) << "{" << std::setw(width) << vec.x << ", " << std::setw(width) << vec.y << ", " << std::setw(width) << vec.z << "}";
+ stream << std::setw(0) << "{" << std::setw(width) << vec.x << ", " << std::setw(width) << vec.y << ", "
+ << std::setw(width) << vec.z << "}";
return stream;
}
-Vec3i::Vec3i(int32_t xv, int32_t yv, int32_t zv) : x(xv), y(yv), z(zv) {}
+Vec3i::Vec3i(int32_t xv, int32_t yv, int32_t zv) : x(xv), y(yv), z(zv) {
+}
int Vec3i::width() {
auto wx = GetMagnitude(this->x);
@@ -79,14 +84,16 @@ int Vec3i::width() {
return std::max(wx, std::max(wy, wz));
}
-std::ostream& operator<< (std::ostream& stream, const Vec3i& vec) {
+std::ostream& operator<<(std::ostream& stream, const Vec3i& vec) {
int width = stream.width();
- stream << std::setw(0) << "{" << std::setw(width) << vec.x << ", " << std::setw(width) << vec.y << ", " << std::setw(width) << vec.z << "}";
+ stream << std::setw(0) << "{" << std::setw(width) << vec.x << ", " << std::setw(width) << vec.y << ", "
+ << std::setw(width) << vec.z << "}";
return stream;
}
-Vec3iu::Vec3iu(uint32_t xv, uint32_t yv, uint32_t zv) : x(xv), y(yv), z(zv) {}
+Vec3iu::Vec3iu(uint32_t xv, uint32_t yv, uint32_t zv) : x(xv), y(yv), z(zv) {
+}
int Vec3iu::width() {
auto wx = GetMagnitude(this->x);
@@ -96,14 +103,16 @@ int Vec3iu::width() {
return std::max(wx, std::max(wy, wz));
}
-std::ostream& operator<< (std::ostream& stream, const Vec3iu& vec) {
+std::ostream& operator<<(std::ostream& stream, const Vec3iu& vec) {
int width = stream.width();
- stream << std::setw(0) << "{" << std::setw(width) << vec.x << ", " << std::setw(width) << vec.y << ", " << std::setw(width) << vec.z << "}";
+ stream << std::setw(0) << "{" << std::setw(width) << vec.x << ", " << std::setw(width) << vec.y << ", "
+ << std::setw(width) << vec.z << "}";
return stream;
}
-Vec2f::Vec2f(float xv, float zv) : x(xv), z(zv) {}
+Vec2f::Vec2f(float xv, float zv) : x(xv), z(zv) {
+}
int Vec2f::precision() {
auto px = GetPrecision(this->x);
@@ -116,17 +125,18 @@ int Vec2f::width() {
auto wx = GetMagnitude(this->x) + 1 + GetPrecision(this->x);
auto wz = GetMagnitude(this->z) + 1 + GetPrecision(this->z);
- return std::max(wx, wz);
+ return std::max(wx, wz);
}
-std::ostream& operator<< (std::ostream& stream, const Vec2f& vec) {
+std::ostream& operator<<(std::ostream& stream, const Vec2f& vec) {
int width = stream.width();
stream << std::setw(0) << "{" << std::setw(width) << vec.x << ", " << std::setw(width) << vec.z << "}";
return stream;
}
-Vec4f::Vec4f(float xv, float yv, float zv, float wv) : x(xv), y(yv), z(zv), w(wv) {}
+Vec4f::Vec4f(float xv, float yv, float zv, float wv) : x(xv), y(yv), z(zv), w(wv) {
+}
int Vec4f::width() {
auto wx = GetMagnitude(this->x) + 1 + GetPrecision(this->x);
@@ -134,7 +144,7 @@ int Vec4f::width() {
auto wz = GetMagnitude(this->z) + 1 + GetPrecision(this->z);
auto ww = GetMagnitude(this->w) + 1 + GetPrecision(this->w);
- return std::max(std::max(wy, ww), std::max(wx, wz));
+ return std::max(std::max(wy, ww), std::max(wx, wz));
}
int Vec4f::precision() {
@@ -146,14 +156,16 @@ int Vec4f::precision() {
return std::max(std::max(px, pw), std::max(py, pz));
}
-std::ostream& operator<< (std::ostream& stream, const Vec4f& vec) {
+std::ostream& operator<<(std::ostream& stream, const Vec4f& vec) {
int width = stream.width();
- stream << std::setw(0) << "{" << std::setw(width) << vec.x << ", " << std::setw(width) << vec.y << ", " << std::setw(width) << vec.z << ", " << std::setw(width) << vec.w << "}";
+ stream << std::setw(0) << "{" << std::setw(width) << vec.x << ", " << std::setw(width) << vec.y << ", "
+ << std::setw(width) << vec.z << ", " << std::setw(width) << vec.w << "}";
return stream;
}
-Vec4s::Vec4s(int16_t xv, int16_t yv, int16_t zv, int16_t wv) : x(xv), y(yv), z(zv), w(wv) {}
+Vec4s::Vec4s(int16_t xv, int16_t yv, int16_t zv, int16_t wv) : x(xv), y(yv), z(zv), w(wv) {
+}
int Vec4s::width() {
auto wx = GetMagnitude(this->x);
@@ -164,9 +176,10 @@ int Vec4s::width() {
return std::max(std::max(wx, ww), std::max(wy, wz));
}
-std::ostream& operator<< (std::ostream& stream, const Vec4s& vec) {
+std::ostream& operator<<(std::ostream& stream, const Vec4s& vec) {
int width = stream.width();
- stream << std::setw(0) << "{" << std::setw(width) << vec.x << ", " << std::setw(width) << vec.y << ", " << std::setw(width) << vec.z << ", " << std::setw(width) << vec.w << "}";
+ stream << std::setw(0) << "{" << std::setw(width) << vec.x << ", " << std::setw(width) << vec.y << ", "
+ << std::setw(width) << vec.z << ", " << std::setw(width) << vec.w << "}";
return stream;
}