|
@@ -6,7 +6,7 @@ module BABYLON {
|
|
/**
|
|
/**
|
|
* Gets the 8 vectors representing the bounding box in local space
|
|
* Gets the 8 vectors representing the bounding box in local space
|
|
*/
|
|
*/
|
|
- public vectors: Vector3[] = [Vector3.Zero(), Vector3.Zero(), Vector3.Zero(), Vector3.Zero(), Vector3.Zero(), Vector3.Zero(), Vector3.Zero(), Vector3.Zero()];
|
|
|
|
|
|
+ public vectors: Vector3[] = Tools.BuildArray(8, Vector3.Zero);
|
|
/**
|
|
/**
|
|
* Gets the center of the bounding box in local space
|
|
* Gets the center of the bounding box in local space
|
|
*/
|
|
*/
|
|
@@ -26,11 +26,11 @@ module BABYLON {
|
|
/**
|
|
/**
|
|
* Gets the OBB (object bounding box) directions
|
|
* Gets the OBB (object bounding box) directions
|
|
*/
|
|
*/
|
|
- public directions: Vector3[] = [Vector3.Zero(), Vector3.Zero(), Vector3.Zero()];
|
|
|
|
|
|
+ public directions: Vector3[] = Tools.BuildArray(3, Vector3.Zero);
|
|
/**
|
|
/**
|
|
* Gets the 8 vectors representing the bounding box in world space
|
|
* Gets the 8 vectors representing the bounding box in world space
|
|
*/
|
|
*/
|
|
- public vectorsWorld: Vector3[] = [Vector3.Zero(), Vector3.Zero(), Vector3.Zero(), Vector3.Zero(), Vector3.Zero(), Vector3.Zero(), Vector3.Zero(), Vector3.Zero()];
|
|
|
|
|
|
+ public vectorsWorld: Vector3[] = Tools.BuildArray(8, Vector3.Zero);
|
|
/**
|
|
/**
|
|
* Gets the minimum vector in world space
|
|
* Gets the minimum vector in world space
|
|
*/
|
|
*/
|
|
@@ -203,15 +203,15 @@ module BABYLON {
|
|
var delta = -Epsilon;
|
|
var delta = -Epsilon;
|
|
|
|
|
|
if (this.maximumWorld.x - point.x < delta || delta > point.x - this.minimumWorld.x) {
|
|
if (this.maximumWorld.x - point.x < delta || delta > point.x - this.minimumWorld.x) {
|
|
- return false;
|
|
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
|
|
|
|
if (this.maximumWorld.y - point.y < delta || delta > point.y - this.minimumWorld.y) {
|
|
if (this.maximumWorld.y - point.y < delta || delta > point.y - this.minimumWorld.y) {
|
|
- return false;
|
|
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
|
|
|
|
if (this.maximumWorld.z - point.z < delta || delta > point.z - this.minimumWorld.z) {
|
|
if (this.maximumWorld.z - point.z < delta || delta > point.z - this.minimumWorld.z) {
|
|
- return false;
|
|
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
|
|
|
|
return true;
|
|
return true;
|
|
@@ -234,15 +234,15 @@ module BABYLON {
|
|
*/
|
|
*/
|
|
public intersectsMinMax(min: Vector3, max: Vector3): boolean {
|
|
public intersectsMinMax(min: Vector3, max: Vector3): boolean {
|
|
if (this.maximumWorld.x < min.x || this.minimumWorld.x > max.x) {
|
|
if (this.maximumWorld.x < min.x || this.minimumWorld.x > max.x) {
|
|
- return false;
|
|
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
|
|
|
|
if (this.maximumWorld.y < min.y || this.minimumWorld.y > max.y) {
|
|
if (this.maximumWorld.y < min.y || this.minimumWorld.y > max.y) {
|
|
- return false;
|
|
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
|
|
|
|
if (this.maximumWorld.z < min.z || this.minimumWorld.z > max.z) {
|
|
if (this.maximumWorld.z < min.z || this.minimumWorld.z > max.z) {
|
|
- return false;
|
|
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
|
|
|
|
return true;
|
|
return true;
|
|
@@ -258,15 +258,15 @@ module BABYLON {
|
|
*/
|
|
*/
|
|
public static Intersects(box0: BoundingBox, box1: BoundingBox): boolean {
|
|
public static Intersects(box0: BoundingBox, box1: BoundingBox): boolean {
|
|
if (box0.maximumWorld.x < box1.minimumWorld.x || box0.minimumWorld.x > box1.maximumWorld.x) {
|
|
if (box0.maximumWorld.x < box1.minimumWorld.x || box0.minimumWorld.x > box1.maximumWorld.x) {
|
|
- return false;
|
|
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
|
|
|
|
if (box0.maximumWorld.y < box1.minimumWorld.y || box0.minimumWorld.y > box1.maximumWorld.y) {
|
|
if (box0.maximumWorld.y < box1.minimumWorld.y || box0.minimumWorld.y > box1.maximumWorld.y) {
|
|
- return false;
|
|
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
|
|
|
|
if (box0.maximumWorld.z < box1.minimumWorld.z || box0.minimumWorld.z > box1.maximumWorld.z) {
|
|
if (box0.maximumWorld.z < box1.minimumWorld.z || box0.minimumWorld.z > box1.maximumWorld.z) {
|
|
- return false;
|
|
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
|
|
|
|
return true;
|
|
return true;
|
|
@@ -321,7 +321,7 @@ module BABYLON {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (inCount === 0) {
|
|
if (inCount === 0) {
|
|
- return false;
|
|
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return true;
|
|
return true;
|