Use the Util.getAxialAlignedBoundingBox helper function more

There's a couple of spots in the code-base that effectively re-implement this helper function, which seems like unnecessary repetition.
This commit is contained in:
Jonas Jenwald 2023-05-31 09:32:19 +02:00
parent 071e6bc7e7
commit d3c0928121
3 changed files with 14 additions and 27 deletions

View file

@ -730,10 +730,10 @@ class Util {
// Applies the transform to the rectangle and finds the minimum axially
// aligned bounding box.
static getAxialAlignedBoundingBox(r, m) {
const p1 = Util.applyTransform(r, m);
const p2 = Util.applyTransform(r.slice(2, 4), m);
const p3 = Util.applyTransform([r[0], r[3]], m);
const p4 = Util.applyTransform([r[2], r[1]], m);
const p1 = this.applyTransform(r, m);
const p2 = this.applyTransform(r.slice(2, 4), m);
const p3 = this.applyTransform([r[0], r[3]], m);
const p4 = this.applyTransform([r[2], r[1]], m);
return [
Math.min(p1[0], p2[0], p3[0], p4[0]),
Math.min(p1[1], p2[1], p3[1], p4[1]),