Пример #1
0
        private void DoIntersectionTest(int i, double incidentAngleFactor)
        {
            var basePt = RandomCoordinate();

            double baseAngle = 2 * Math.PI * RandGen.NextDouble();

            var p1 = ComputeVector(basePt, baseAngle, 0.1 * SEG_LEN);
            var p2 = ComputeVector(basePt, baseAngle, 1.1 * SEG_LEN);

            double angleBetween = baseAngle + incidentAngleFactor * Math.PI;

            var q1 = ComputeVector(basePt, angleBetween, 0.1 * SEG_LEN);
            var q2 = ComputeVector(basePt, angleBetween, 1.1 * SEG_LEN);

            var intPt     = IntersectionAlgorithms.IntersectionBasic(p1, p2, q1, q2);
            var intPtDD   = CGAlgorithmsDD.Intersection(p1, p2, q1, q2);
            var intPtCB   = IntersectionAlgorithms.IntersectionCB(p1, p2, q1, q2);
            var intPtCond = IntersectionComputer.Intersection(p1, p2, q1, q2);

            if (Verbose)
            {
                Console.WriteLine(i + ":  Lines: "
                                  + WKTWriter.ToLineString(p1, p2) + "  -  "
                                  + WKTWriter.ToLineString(q1, q2));
            }

            PrintStats("DP    ", intPt, p1, p2, q1, q2);
            PrintStats("CB    ", intPtCB, p1, p2, q1, q2);
            PrintStats("Cond  ", intPtCond, p1, p2, q1, q2);
            PrintStats("DD    ", intPtDD, p1, p2, q1, q2);
        }
 public void RunCB()
 {
     var intPt = IntersectionAlgorithms.IntersectionCB(p0, p1, q0, q1);
 }