Skip to content
This repository has been archived by the owner on Sep 7, 2019. It is now read-only.

Commit

Permalink
Stopgap change to AABB to prevent errors with degenerate AABBs (see #10)
Browse files Browse the repository at this point in the history
  • Loading branch information
EliaGorokhovsky committed Dec 27, 2018
1 parent 51bfead commit 450e91a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion source/d2d/math/AxisAlignedBoundingBox.d
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,24 @@ class AxisAlignedBoundingBox(T, uint dimensions) {
}

@property Vector!(T, 2) bottomLeft() {
if (this.vertices.length < 4) {
return this.topLeft;
}
return this.vertices[3];
}

@property Vector!(T, 2) bottomRight() {
if (this.vertices.length == 2) {
return this.topRight;
}
if (this.vertices.length == 1) {
return this.topLeft;
}
return this.vertices[2];
}

}

/**
* Gets all the vertices of the AABB
*/
Expand Down

0 comments on commit 450e91a

Please sign in to comment.