示例#1
0
        public void TestRectangleTransformedMaximum()
        {
            var rect = new Rectangle(0, 0, 100, 10);
            var mat = Matrix.Rotation(90);
            var transformedRect = rect.TransformedMaximum(mat);

            double eps = 0.00000001;
            Assert.True(Math.Abs(transformedRect.Left - -10) < eps);
            Assert.True(Math.Abs(transformedRect.Top - 0) < eps);
            Assert.True(Math.Abs(transformedRect.Right - 0) < eps);
            Assert.True(Math.Abs(transformedRect.Bottom - 100) < eps);
        }
示例#2
0
        public void TestMatrixInverted2()
        {
            var a = new Rectangle(0, 0, 1024, 768);
            var mat = Matrix.Translation(100, 0);
            var b = a.TransformedMaximum(mat);

            Assert.True(b.Left == 100);
            Assert.True(b.Top == 0);
            Assert.True(b.Right == 1024 + 100);
            Assert.True(b.Bottom == 768);

            mat = mat.Inverted();
            var c = b.TransformedMaximum(mat);

            Assert.True(c == a);
        }