J2DGraph debug (#3028)

* J2DGraph debug

* J2DGraph debug
This commit is contained in:
Jcw87
2026-01-11 19:00:04 -08:00
committed by GitHub
parent 6e76f12dd3
commit 2dd7e2ea62
27 changed files with 1200 additions and 931 deletions
+24 -10
View File
@@ -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); }