You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: libraries/math/src/aabb/coreHelpers.ts
+2-21Lines changed: 2 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -111,28 +111,9 @@ export class AABBUtils {
111
111
* @returns - The BlockVolume containing the source AABB.
112
112
*/
113
113
staticgetBlockVolume(aabb: AABB): BlockVolume{
114
-
constfrom=this.getMin(aabb);
115
-
from.x=Math.floor(from.x);
116
-
from.y=Math.floor(from.y);
117
-
from.z=Math.floor(from.z);
118
-
119
-
// Could be added to Vector3Utils
120
-
constto=this.getMax(aabb);
121
-
to.x=Math.floor(to.x);
122
-
to.y=Math.floor(to.y);
123
-
to.z=Math.floor(to.z);
124
-
114
+
constfrom=Vector3Utils.floor(this.getMin(aabb));
115
+
constto=Vector3Utils.ceil(this.getMax(aabb));
125
116
returnnewBlockVolume(from,to);
126
-
127
-
/*
128
-
GetBlockVolume(box: AABB): BlockVolumeBase
129
-
We get the smallest block volume that includes all of the bounding box
130
-
The collision code uses (floor(min - 1), floor(max + 1), we should probably continue using this calculation
131
-
We could also use (floor(min), ceil(max))
132
-
There might be some floating point errors like <1.0, 1.0>, <4.000001, 4.00001> and <1.0, 1.0>, <3.99999, 3.99999> returning different Block Volumes
133
-
Perhaps handle that specific edge case by doing a nearEqual comparison (0.00001 diff)
134
-
ToBeCloseTo check this out later as a reference of what already exists for checking if a float is close to a target number --> (vitest/packages/expect/src/jest-expect.ts at 34f67546df3848c66bcdfa48f5221717d498b965 · vitest-dev/vitest · GitHub), and use math.round()
0 commit comments