Exemple #1
0
        static public void Run()
        {
            //var tri = new Tri(planes);
            var tri = new FullTri(0, 0, 1, 0, 0, 1);

            Debug.Assert(tri.TestPoint(new Point2(.1, .1)));
            Debug.Assert(!tri.TestPoint(new Point2(-.1, .1)));
            Debug.Assert(!tri.TestPoint(new Point2(.1, -.1)));
            Debug.Assert(!tri.TestPoint(new Point2(1, 1)));

            double a = AreaMeasure.Calc(tri);

            Debug.Assert(Math.Abs(a - .5) < .01);

            tri = new FullTri(0, 0, 10, 0, 0, 20);
            Debug.Assert(tri.TestPoint(new Point2(2, 2)));
            a = AreaMeasure.Calc(tri);
            Debug.Assert(Math.Abs(a - 100) < 1);

            tri = new FullTri(0 - 1, 0 + 2, 1 - 1, 0 + 2, 0 - 1, 1 + 2);
            a   = AreaMeasure.Calc(tri);
            Debug.Assert(Math.Abs(a - .5) < .01);

            tri = new FullTri(-3, -2, 6, -7, -2, 5);
            a   = AreaMeasure.Calc(tri);
            Debug.Assert(Math.Abs(a - 34) < .1);
        }
Exemple #2
0
        static void ThreedianCalc(FullTri tri)
        {
            double a = AreaMeasure.Calc(tri);

            var threed = tri.CreateThreedian();

            var    del = tri.PtMax - tri.PtMin;
            double ta  = AreaMeasure.Calc(threed, del.x, del.y, tri.PtMin.x, tri.PtMin.y);

            var ratio = ta / a;

            Console.WriteLine(string.Format("Full Area: {0} Threed Area: {1} Ratio: {2}", a, ta, ratio));
        }