@galacean/engine-math 0.0.0-experimental-2.0-spine.0 → 0.0.0-experimental-2.0-game.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +13 -7
- package/dist/main.js.map +1 -1
- package/dist/module.js +13 -7
- package/dist/module.js.map +1 -1
- package/package.json +1 -1
- package/types/BoundingBox.d.ts +2 -0
package/dist/main.js
CHANGED
|
@@ -841,16 +841,20 @@ BoundingSphere._tempVec30 = new Vector3();
|
|
|
841
841
|
* @param matrix - The transform to apply to the bounding box
|
|
842
842
|
* @param out - The transformed bounding box
|
|
843
843
|
*/ BoundingBox.transform = function transform(source, matrix, out) {
|
|
844
|
-
//
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
844
|
+
// https://zeux.io/2010/10/17/aabb-from-obb-with-component-wise-abs/
|
|
845
|
+
var center = BoundingBox._tempVec30;
|
|
846
|
+
var extent = BoundingBox._tempVec31;
|
|
847
|
+
source.getCenter(center);
|
|
848
|
+
source.getExtent(extent);
|
|
849
|
+
Vector3.transformCoordinate(center, matrix, center);
|
|
850
|
+
var x = extent.x, y = extent.y, z = extent.z;
|
|
849
851
|
var e = matrix.elements;
|
|
850
852
|
// prettier-ignore
|
|
851
853
|
var e0 = e[0], e1 = e[1], e2 = e[2], e4 = e[4], e5 = e[5], e6 = e[6], e8 = e[8], e9 = e[9], e10 = e[10];
|
|
852
|
-
|
|
853
|
-
|
|
854
|
+
extent.set((e0 === 0 ? 0 : Math.abs(x * e0)) + (e4 === 0 ? 0 : Math.abs(y * e4)) + (e8 === 0 ? 0 : Math.abs(z * e8)), (e1 === 0 ? 0 : Math.abs(x * e1)) + (e5 === 0 ? 0 : Math.abs(y * e5)) + (e9 === 0 ? 0 : Math.abs(z * e9)), (e2 === 0 ? 0 : Math.abs(x * e2)) + (e6 === 0 ? 0 : Math.abs(y * e6)) + (e10 === 0 ? 0 : Math.abs(z * e10)));
|
|
855
|
+
// set min、max
|
|
856
|
+
Vector3.subtract(center, extent, out.min);
|
|
857
|
+
Vector3.add(center, extent, out.max);
|
|
854
858
|
};
|
|
855
859
|
/**
|
|
856
860
|
* Calculate a bounding box that is as large as the total combined area of the two specified boxes.
|
|
@@ -865,6 +869,8 @@ BoundingSphere._tempVec30 = new Vector3();
|
|
|
865
869
|
};
|
|
866
870
|
return BoundingBox;
|
|
867
871
|
}();
|
|
872
|
+
BoundingBox._tempVec30 = new Vector3();
|
|
873
|
+
BoundingBox._tempVec31 = new Vector3();
|
|
868
874
|
|
|
869
875
|
/**
|
|
870
876
|
* Contains static methods to help in determining intersections, containment, etc.
|