Namespace: DeltaEngine.Datatypes
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Tests: DeltaEngine.Tests.Datatypes.BoundingBoxTests
5 unit tests call DeltaEngine.Datatypes.BoundingBox.Intersect(DeltaEngine.Datatypes.Ray)
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax
Parameters
- ray
- Type: DeltaEngine.Datatypes Ray
Return Value
Type: Nullable Vector3DRemarks
Examples
[Test] public void IntersectBoundingBoxWithBoundingBox() { var box1 = new BoundingBox(Vector3D.Zero, Vector3D.One); var box2 = new BoundingBox(Vector3D.One / 2, Vector3D.One); Assert.IsTrue(box1.IsColliding(box2)); var box3 = new BoundingBox(Vector3D.One * 2, Vector3D.One); Assert.IsFalse(box1.IsColliding(box3)); }
[Test] public void IntersectBoundingBoxWithBoundingSphere() { var boundingBox = new BoundingBox(Vector3D.Zero, Vector3D.One); var sphere = new BoundingSphere(Vector3D.Zero, 0.5f); Assert.IsTrue(boundingBox.IsColliding(sphere)); }
[Test] public void IntersectBoundingBoxWithRay() { var boundingBox = new BoundingBox(Vector3D.One * -0.5f, Vector3D.One * 0.5f); var ray = new Ray(Vector3D.UnitY * 2.0f, -Vector3D.UnitY); Assert.AreEqual(new Vector3D(0.0f, 0.5f, 0.0f), boundingBox.Intersect(ray)); }
See Also