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