コード例 #1
0
        static void TestEllipseBoxOnEllipse(Ellipse ell) {
            var b = ell.BoundingBox;
            var smallerBox = new Rectangle(ell.Start);
            const int steps = 1000;
            var del = (ell.ParEnd - ell.ParStart) / steps;
            for (int i = 1; i <= steps; i++)
                smallerBox.Add(ell[ell.ParStart + i * del]);
#if GDI_DEBUG_VIEWER
            if (!MsaglTestBase.DontShowTheDebugViewer()) {
                LayoutAlgorithmSettings.ShowDebugCurves(
                    new DebugCurve(100, 0.1, "purple", ell),
                    new DebugCurve(100, 0.1, "red", smallerBox.Perimeter()),
                    new DebugCurve(100, 0.05, "green", b.Perimeter()),
                    new DebugCurve(100, 0.1, "brown", new LineSegment(ell.Start, ell.End)),
                    new DebugCurve(100, 0.1, "black", new LineSegment(ell.Center, ell.Start)),
                    new DebugCurve(100, 0.1, "black", new LineSegment(ell.Center, ell.End)));
            }
#endif
            Assert.IsTrue(ApproximateComparer.CloseIntersections(b.LeftTop, smallerBox.LeftTop) && ApproximateComparer.CloseIntersections(b.RightBottom, smallerBox.RightBottom));
        }