Example #1
0
        public void GetFlatEnclosingRectangle_Paper_45Degrees()
        {
            //assign
            Geometry.MarginOfError   = 0.001;
            Geometry.CoordinatePlane = Geometry.CoordinatePlanes.Paper;
            WPoint     topLeftCorner = new WPoint(10, 5);
            double     width         = 12;
            double     height        = 4;
            double     rotation      = 45;
            WRectangle rectangle     = new WRectangle(width, height, topLeftCorner, rotation);
            //act
            WRectangle result = rectangle.GetFlatEnclosingRectangle();

            //assert
            Assert.AreEqual(new WPoint(10, 13.485), result.Corner);
            Assert.IsTrue(Geometry.WithinMarginOfError(21.313 - 10, result.Width));
            Assert.IsTrue(Geometry.WithinMarginOfError(13.485 - 2.171, result.Height));
            Assert.IsTrue(result.IsFlat);
        }