/// <summary> /// </summary> /// <param name="boundingInfo"> /// </param> /// <param name="precise"> /// </param> /// <returns> /// </returns> public virtual bool intersects(BoundingInfo boundingInfo, bool precise) { if (this.boundingSphere.centerWorld == null || boundingInfo.boundingSphere.centerWorld == null) { return(false); } if (!BoundingSphere.Intersects(this.boundingSphere, boundingInfo.boundingSphere)) { return(false); } if (!BoundingBox.Intersects(this.boundingBox, boundingInfo.boundingBox)) { return(false); } if (!precise) { return(true); } var box0 = this.boundingBox; var box1 = boundingInfo.boundingBox; if (!this.axisOverlap(box0.directions[0], box0, box1)) { return(false); } if (!this.axisOverlap(box0.directions[1], box0, box1)) { return(false); } if (!this.axisOverlap(box0.directions[2], box0, box1)) { return(false); } if (!this.axisOverlap(box1.directions[0], box0, box1)) { return(false); } if (!this.axisOverlap(box1.directions[1], box0, box1)) { return(false); } if (!this.axisOverlap(box1.directions[2], box0, box1)) { return(false); } if (!this.axisOverlap(Vector3.Cross(box0.directions[0], box1.directions[0]), box0, box1)) { return(false); } if (!this.axisOverlap(Vector3.Cross(box0.directions[0], box1.directions[1]), box0, box1)) { return(false); } if (!this.axisOverlap(Vector3.Cross(box0.directions[0], box1.directions[2]), box0, box1)) { return(false); } if (!this.axisOverlap(Vector3.Cross(box0.directions[1], box1.directions[0]), box0, box1)) { return(false); } if (!this.axisOverlap(Vector3.Cross(box0.directions[1], box1.directions[1]), box0, box1)) { return(false); } if (!this.axisOverlap(Vector3.Cross(box0.directions[1], box1.directions[2]), box0, box1)) { return(false); } if (!this.axisOverlap(Vector3.Cross(box0.directions[2], box1.directions[0]), box0, box1)) { return(false); } if (!this.axisOverlap(Vector3.Cross(box0.directions[2], box1.directions[1]), box0, box1)) { return(false); } if (!this.axisOverlap(Vector3.Cross(box0.directions[2], box1.directions[2]), box0, box1)) { return(false); } return(true); }
/// <summary> /// </summary> /// <param name="minimum"> /// </param> /// <param name="maximum"> /// </param> public BoundingInfo(Vector3 minimum, Vector3 maximum) { this.boundingBox = new BoundingBox(minimum, maximum); this.boundingSphere = new BoundingSphere(minimum, maximum); }