Esempio n. 1
0
        public void PointIsOutsideBoundingBox()
        {
            var box = new BoundingBox2D(
                Vector2.Zero,
                new Vector2(0.0f, 10.0f),
                new Vector2(10.0f, 10.0f),
                new Vector2(10.0f, 0.0f));

            var point = new Vector2(15.0f, 5.0f);

            Assert.AreEqual(false, box.Contains(point));
        }
Esempio n. 2
0
        public void PointIsInBoundingBoxBorders()
        {
            var box = new BoundingBox2D(
                Vector2.Zero,
                new Vector2(0.0f, 10.0f),
                new Vector2(10.0f, 10.0f),
                new Vector2(10.0f, 0.0f));

            var point = new Vector2(0.0f, 5.0f);

            Assert.AreEqual(true, box.Contains(point));
        }
Esempio n. 3
0
        public void PointIsInRotatedBoundingBox()
        {
            var box = new BoundingBox2D(
                Vector2.Zero,
                new Vector2(0.0f, 10.0f),
                new Vector2(10.0f, 10.0f),
                new Vector2(10.0f, 0.0f));

            box = box.GetRotated(45.0f);

            var point = new Vector2(0.5f, 5.0f);

            Assert.AreEqual(true, box.Contains(point));
        }
Esempio n. 4
0
 public void RenderBoundingBox(BoundingBox2D box, Color color, float thickness = 1.0f)
 {
     _xnaGD._spriteBatch.DrawLine(box.Point1, box.Point2, color, thickness);
     _xnaGD._spriteBatch.DrawLine(box.Point2, box.Point3, color, thickness);
     _xnaGD._spriteBatch.DrawLine(box.Point3, box.Point4, color, thickness);
     _xnaGD._spriteBatch.DrawLine(box.Point4, box.Point1, color, thickness);
 }