[OrientedBoundingBox] Add proper equals and toString

Signed-off-by: Irmo van den Berge <irmo.vandenberge@mailbox.org>
This commit is contained in:
Irmo van den Berge committed 2026-05-25 23:11:48 +02:00
1 parent ab491d4aaf
commit 1ef5561794
2 files changed
+20 -1

No files matched your search

@@ -216,6 +216,25 @@ public class OrientedBoundingBox {
cachedVertices = null;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
} else if (o instanceof OrientedBoundingBox) {
OrientedBoundingBox other = (OrientedBoundingBox) o;
return this.orientation.equals(other.orientation) &&
this.position.equals(other.position) &&
this.radius.equals(other.radius);
} else {
return false;
}
}
@Override
public String toString() {
return "OBB{pos=" + position + ", size=" + radius.clone().multiply(2.0) + ", ori=" + orientation + "}";
}
/**
* Tests whether a point vector is inside this bounding box. Equivalent to testing
* {@link #distanceToPoint(Vector)} is inside.
@@ -507,7 +507,7 @@ public class Quaternion implements Rotatable, Cloneable {
@Override
public String toString() {
return "{" + this.x + ", " + this.y + ", " + this.z + ", " + this.w + "}";
return "{x=" + this.x + ", y=" + this.y + ", z=" + this.z + ", w=" + this.w + "}";
}
/**