summaryrefslogtreecommitdiff
path: root/include/JSystem/JGeometry.h
diff options
context:
space:
mode:
authorJcw87 <Jcw87@users.noreply.github.com>2026-01-11 19:00:04 -0800
committerGitHub <noreply@github.com>2026-01-11 19:00:04 -0800
commit2dd7e2ea62daaa33195b2adbca8b086ceaa6d464 (patch)
treed56016fab9d536e646ebde852dd8ef2ad81ba732 /include/JSystem/JGeometry.h
parent6e76f12dd3b49acc9b682eeb811dbec64bc3519c (diff)
J2DGraph debug (#3028)
* J2DGraph debug * J2DGraph debug
Diffstat (limited to 'include/JSystem/JGeometry.h')
-rw-r--r--include/JSystem/JGeometry.h34
1 files changed, 24 insertions, 10 deletions
diff --git a/include/JSystem/JGeometry.h b/include/JSystem/JGeometry.h
index c13d838082..d04192b07b 100644
--- a/include/JSystem/JGeometry.h
+++ b/include/JSystem/JGeometry.h
@@ -447,6 +447,14 @@ struct TVec2 {
y += other.y;
}
+ bool equals(const TVec2<T>& other) const {
+ bool result = false;
+ if (this->x == other.x && this->y == other.y) {
+ result = true;
+ }
+ return result;
+ }
+
bool isAbove(const TVec2<T>& other) const {
return (x >= other.x) && (y >= other.y) ? true : false;
}
@@ -463,6 +471,10 @@ struct TVec2 {
return TUtil<f32>::sqrt(squared());
}
+ bool operator==(const TVec2<T>& other) const {
+ return equals(other);
+ }
+
T x;
T y;
};
@@ -497,6 +509,18 @@ template<> struct TBox<TVec2<f32> > {
return isValid();
}
+ void absolute() {
+ if (this->isValid()) {
+ return;
+ }
+
+ TBox<TVec2<f32> > box(*this);
+ this->i.setMin(box.i);
+ this->i.setMin(box.f);
+ this->f.setMax(box.i);
+ this->f.setMax(box.f);
+ }
+
TVec2<f32> i, f;
};
@@ -509,16 +533,6 @@ struct TBox2 : public TBox<TVec2<T> > {
}
TBox2(f32 x0, f32 y0, f32 x1, f32 y1) { set(x0, y0, x1, y1); }
- void absolute() {
- if (!this->isValid()) {
- TBox2<T> box(*this);
- this->i.setMin(box.i);
- this->i.setMin(box.f);
- this->f.setMax(box.i);
- this->f.setMax(box.f);
- }
- }
-
void set(const TBox<TVec2<T> >& other) { set(other.i, other.f); }
void set(const TVec2<f32>& i, const TVec2<f32>& f) { this->i.set(i), this->f.set(f); }
void set(f32 x0, f32 y0, f32 x1, f32 y1) { this->i.set(x0, y0); this->f.set(x1, y1); }