public void CreateBoundingSphere() { var boundingSphere = new BoundingSphere(Vector3D.One, 2.0f); Assert.AreEqual(Vector3D.One, boundingSphere.Center); Assert.AreEqual(2.0f, boundingSphere.Radius); }
public void IntersectBoundingSphereWithBoundingSphere() { var sphere1 = new BoundingSphere(Vector3D.Zero, 1.0f); var sphere2 = new BoundingSphere(Vector3D.One, 1.0f); Assert.IsTrue(sphere1.IsColliding(sphere2)); }
public bool IsColliding(BoundingSphere other) { float combinedRadii = Radius + other.Radius; return Center.DistanceSquared(other.Center) < combinedRadii * combinedRadii; }
public void TestBoundingSphere() { var actor = new MockActor(Vector3D.One, 1.0f); var sphere = new BoundingSphere(Vector3D.One, 1.0f); Assert.AreEqual(sphere, actor.GetBoundingSphere()); }
public void IntersectBoundingBoxWithBoundingSphere() { var boundingBox = new BoundingBox(Vector3D.Zero, Vector3D.One); var sphere = new BoundingSphere(Vector3D.Zero, 0.5f); Assert.IsTrue(boundingBox.IsColliding(sphere)); }