|
@@ -18325,71 +18325,69 @@ var BABYLON;
|
|
|
|
|
|
//# sourceMappingURL=babylon.node.js.map
|
|
//# sourceMappingURL=babylon.node.js.map
|
|
|
|
|
|
-var BABYLON;
|
|
|
|
-(function (BABYLON) {
|
|
|
|
- var BoundingSphere = /** @class */ (function () {
|
|
|
|
- /**
|
|
|
|
- * Creates a new bounding sphere
|
|
|
|
- * @param min defines the minimum vector (in local space)
|
|
|
|
- * @param max defines the maximum vector (in local space)
|
|
|
|
- */
|
|
|
|
- function BoundingSphere(min, max) {
|
|
|
|
- this._tempRadiusVector = BABYLON.Vector3.Zero();
|
|
|
|
- this.reConstruct(min, max);
|
|
|
|
- }
|
|
|
|
- /**
|
|
|
|
- * Recreates the entire bounding sphere from scratch
|
|
|
|
- * @param min defines the new minimum vector (in local space)
|
|
|
|
- * @param max defines the new maximum vector (in local space)
|
|
|
|
- */
|
|
|
|
- BoundingSphere.prototype.reConstruct = function (min, max) {
|
|
|
|
- this.minimum = min.clone();
|
|
|
|
- this.maximum = max.clone();
|
|
|
|
- var distance = BABYLON.Vector3.Distance(min, max);
|
|
|
|
- this.center = BABYLON.Vector3.Lerp(min, max, 0.5);
|
|
|
|
- this.radius = distance * 0.5;
|
|
|
|
- this.centerWorld = BABYLON.Vector3.Zero();
|
|
|
|
- this._update(BABYLON.Matrix.Identity());
|
|
|
|
- };
|
|
|
|
- // Methods
|
|
|
|
- BoundingSphere.prototype._update = function (world) {
|
|
|
|
- BABYLON.Vector3.TransformCoordinatesToRef(this.center, world, this.centerWorld);
|
|
|
|
- BABYLON.Vector3.TransformNormalFromFloatsToRef(1.0, 1.0, 1.0, world, this._tempRadiusVector);
|
|
|
|
- this.radiusWorld = Math.max(Math.abs(this._tempRadiusVector.x), Math.abs(this._tempRadiusVector.y), Math.abs(this._tempRadiusVector.z)) * this.radius;
|
|
|
|
- };
|
|
|
|
- BoundingSphere.prototype.isInFrustum = function (frustumPlanes) {
|
|
|
|
- for (var i = 0; i < 6; i++) {
|
|
|
|
- if (frustumPlanes[i].dotCoordinate(this.centerWorld) <= -this.radiusWorld)
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- return true;
|
|
|
|
- };
|
|
|
|
- BoundingSphere.prototype.intersectsPoint = function (point) {
|
|
|
|
- var x = this.centerWorld.x - point.x;
|
|
|
|
- var y = this.centerWorld.y - point.y;
|
|
|
|
- var z = this.centerWorld.z - point.z;
|
|
|
|
- var distance = Math.sqrt((x * x) + (y * y) + (z * z));
|
|
|
|
- if (Math.abs(this.radiusWorld - distance) < BABYLON.Epsilon)
|
|
|
|
- return false;
|
|
|
|
- return true;
|
|
|
|
- };
|
|
|
|
- // Statics
|
|
|
|
- BoundingSphere.Intersects = function (sphere0, sphere1) {
|
|
|
|
- var x = sphere0.centerWorld.x - sphere1.centerWorld.x;
|
|
|
|
- var y = sphere0.centerWorld.y - sphere1.centerWorld.y;
|
|
|
|
- var z = sphere0.centerWorld.z - sphere1.centerWorld.z;
|
|
|
|
- var distance = Math.sqrt((x * x) + (y * y) + (z * z));
|
|
|
|
- if (sphere0.radiusWorld + sphere1.radiusWorld < distance)
|
|
|
|
- return false;
|
|
|
|
- return true;
|
|
|
|
- };
|
|
|
|
- return BoundingSphere;
|
|
|
|
- }());
|
|
|
|
- BABYLON.BoundingSphere = BoundingSphere;
|
|
|
|
-})(BABYLON || (BABYLON = {}));
|
|
|
|
-
|
|
|
|
|
|
+var BABYLON;
|
|
|
|
+(function (BABYLON) {
|
|
|
|
+ var BoundingSphere = /** @class */ (function () {
|
|
|
|
+ /**
|
|
|
|
+ * Creates a new bounding sphere
|
|
|
|
+ * @param min defines the minimum vector (in local space)
|
|
|
|
+ * @param max defines the maximum vector (in local space)
|
|
|
|
+ */
|
|
|
|
+ function BoundingSphere(min, max) {
|
|
|
|
+ this._tempRadiusVector = BABYLON.Vector3.Zero();
|
|
|
|
+ this.reConstruct(min, max);
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
|
|
+ * Recreates the entire bounding sphere from scratch
|
|
|
|
+ * @param min defines the new minimum vector (in local space)
|
|
|
|
+ * @param max defines the new maximum vector (in local space)
|
|
|
|
+ */
|
|
|
|
+ BoundingSphere.prototype.reConstruct = function (min, max) {
|
|
|
|
+ this.minimum = min.clone();
|
|
|
|
+ this.maximum = max.clone();
|
|
|
|
+ var distance = BABYLON.Vector3.Distance(min, max);
|
|
|
|
+ this.center = BABYLON.Vector3.Lerp(min, max, 0.5);
|
|
|
|
+ this.radius = distance * 0.5;
|
|
|
|
+ this.centerWorld = BABYLON.Vector3.Zero();
|
|
|
|
+ this._update(BABYLON.Matrix.Identity());
|
|
|
|
+ };
|
|
|
|
+ // Methods
|
|
|
|
+ BoundingSphere.prototype._update = function (world) {
|
|
|
|
+ BABYLON.Vector3.TransformCoordinatesToRef(this.center, world, this.centerWorld);
|
|
|
|
+ BABYLON.Vector3.TransformNormalFromFloatsToRef(1.0, 1.0, 1.0, world, this._tempRadiusVector);
|
|
|
|
+ this.radiusWorld = Math.max(Math.abs(this._tempRadiusVector.x), Math.abs(this._tempRadiusVector.y), Math.abs(this._tempRadiusVector.z)) * this.radius;
|
|
|
|
+ };
|
|
|
|
+ BoundingSphere.prototype.isInFrustum = function (frustumPlanes) {
|
|
|
|
+ for (var i = 0; i < 6; i++) {
|
|
|
|
+ if (frustumPlanes[i].dotCoordinate(this.centerWorld) <= -this.radiusWorld)
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
|
|
+ };
|
|
|
|
+ BoundingSphere.prototype.intersectsPoint = function (point) {
|
|
|
|
+ var x = this.centerWorld.x - point.x;
|
|
|
|
+ var y = this.centerWorld.y - point.y;
|
|
|
|
+ var z = this.centerWorld.z - point.z;
|
|
|
|
+ var distance = Math.sqrt((x * x) + (y * y) + (z * z));
|
|
|
|
+ if (this.radiusWorld < distance)
|
|
|
|
+ return false;
|
|
|
|
+ return true;
|
|
|
|
+ };
|
|
|
|
+ // Statics
|
|
|
|
+ BoundingSphere.Intersects = function (sphere0, sphere1) {
|
|
|
|
+ var x = sphere0.centerWorld.x - sphere1.centerWorld.x;
|
|
|
|
+ var y = sphere0.centerWorld.y - sphere1.centerWorld.y;
|
|
|
|
+ var z = sphere0.centerWorld.z - sphere1.centerWorld.z;
|
|
|
|
+ var distance = Math.sqrt((x * x) + (y * y) + (z * z));
|
|
|
|
+ if (sphere0.radiusWorld + sphere1.radiusWorld < distance)
|
|
|
|
+ return false;
|
|
|
|
+ return true;
|
|
|
|
+ };
|
|
|
|
+ return BoundingSphere;
|
|
|
|
+ }());
|
|
|
|
+ BABYLON.BoundingSphere = BoundingSphere;
|
|
|
|
+})(BABYLON || (BABYLON = {}));
|
|
//# sourceMappingURL=babylon.boundingSphere.js.map
|
|
//# sourceMappingURL=babylon.boundingSphere.js.map
|
|
-
|
|
|
|
var BABYLON;
|
|
var BABYLON;
|
|
(function (BABYLON) {
|
|
(function (BABYLON) {
|
|
var BoundingBox = /** @class */ (function () {
|
|
var BoundingBox = /** @class */ (function () {
|