Exemplo n.º 1
0
        public void CheckForCircleEventTest_PointsAReCircle_REturnsTrueFlagCircleDeets()
        {
            var sut         = new SweepTable();
            var circlecheck = sut.CalculateCircleEventCheck(new SiteEvent(new VoronoiPoint(1, 1)), new SiteEvent(new VoronoiPoint(1, 2)), new SiteEvent(new VoronoiPoint(2, 2)));

            Assert.IsTrue(circlecheck.isCircle);
        }
Exemplo n.º 2
0
        public void CheckForCircleEventTest_PointsRightTurnCircle_REturnsFalseFlag()
        {
            var sut         = new SweepTable();
            var circlecheck = sut.CalculateCircleEventCheck(new SiteEvent(new VoronoiPoint(3, 2)), new SiteEvent(new VoronoiPoint(2, 2)), new SiteEvent(new VoronoiPoint(2, 1)));

            Assert.IsFalse(circlecheck.isCircle);
        }
Exemplo n.º 3
0
        public void CheckForCircleEventTest_pointsAreLinear_ReturnsFalseCheckFlag()
        {
            var sut         = new SweepTable();
            var circlecheck = sut.CalculateCircleEventCheck(new SiteEvent(new VoronoiPoint(1, 1)), new SiteEvent(new VoronoiPoint(1, 2)), new SiteEvent(new VoronoiPoint(1, .5)));

            Assert.IsFalse(circlecheck.isCircle);
        }
Exemplo n.º 4
0
        public void AddToBeachLineTest_AddPointToNonExistantBeachLine_PointisnowBeachline()
        {
            var sut       = new SweepTable();
            var testevent = new SiteEvent(new VoronoiPoint(1, 1));

            sut.AddToBeachLine(testevent);
            Assert.AreSame(testevent, sut.BeachPoints.arcpoint);
            Assert.AreEqual(1, sut.BeachPoints.arcpoint.X);
        }
Exemplo n.º 5
0
        public void FinishEdgesTest_nowaitingpoints_returnsemptygraph()
        {
            var sut = new SweepTable {
                BeachPoints = new Arc()
            };

            Assert.IsInstanceOfType(sut.FinishEdges(), typeof(VoronoiMap));
            Assert.AreEqual(0, sut.FinishEdges().graph.Count);
        }
Exemplo n.º 6
0
        public void AddToBeachLineTest_AddNewPoint_TwoDifferentPointRefs()
        {
            var intpoints = new intersectingpoints();
            var sut       = new SweepTable {
                BeachPoints = intpoints.arc3
            };

            sut.AddToBeachLine(intpoints.testsite);
            Assert.IsFalse(ReferenceEquals(sut.BeachPoints.nextpoint.s1, sut.BeachPoints.s1));
        }
Exemplo n.º 7
0
        public void ParabolaIntersectionTest()
        {
            var sut = new SweepTable();
            var varparabolaresult = sut.ParabolaIntersection(new SiteEvent(new VoronoiPoint(3.75, 10)), new SiteEvent(new VoronoiPoint(4, 11)), 2.5);

            Assert.AreEqual(-.64579, varparabolaresult.Y, .0001);

            varparabolaresult = sut.ParabolaIntersection(new SiteEvent(new VoronoiPoint(4, 11)), new SiteEvent(new VoronoiPoint(5, 11)), 2.5);
            Assert.AreEqual(9.063508, varparabolaresult.Y, .0001);
        }
Exemplo n.º 8
0
        public void CheckCircleEventCheck_righthandcircle_returnsblankevent()
        {
            var pointa = new SiteEvent(new VoronoiPoint(10, 10));
            var pointb = new SiteEvent(new VoronoiPoint(20, 15));
            var pointc = new SiteEvent(new VoronoiPoint(15, 20));

            var sut         = new SweepTable();
            var circlecheck = sut.CalculateCircleEventCheck(pointa, pointb, pointc);

            Assert.IsFalse(circlecheck.isCircle);
        }
Exemplo n.º 9
0
        public void AddToBeachLineTest_AddPointBeachLineWith6Points_NewBeachLinewith3Points()
        {
            var intpoints = new intersectingpoints();

            var sut = new SweepTable {
                BeachPoints = intpoints.arc3
            };

            sut.AddToBeachLine(intpoints.testsite);
            Assert.AreSame(intpoints.testsite, intpoints.arc3.nextpoint.arcpoint);
        }
Exemplo n.º 10
0
        public void FindIntersectedArcTest_PointIsDifferentAsInspectedPoint_ReturnsSite()
        {
            var intpoints = new intersectingpoints();

            var sut = new SweepTable {
                BeachPoints = intpoints.arc3
            };
            var newsite = sut.FindIntersectedArc(new SiteEvent(new VoronoiPoint(2.5, 9)), intpoints.arc3);

            Assert.IsTrue(newsite.flag);
        }
Exemplo n.º 11
0
        public void CheckCircleEventCheck_sitesdifferent_returnscircleincenter()
        {
            var pointa = new SiteEvent(new VoronoiPoint(10, 10));
            var pointb = new SiteEvent(new VoronoiPoint(20, 15));
            var pointc = new SiteEvent(new VoronoiPoint(15, 20));

            var sut         = new SweepTable();
            var circlecheck = sut.CalculateCircleEventCheck(pointc, pointb, pointa);

            Assert.AreEqual(14.1666, circlecheck.o.X, 0.0001);
            Assert.AreEqual(14.1666, circlecheck.o.Y, 0.0001);
            Assert.AreEqual(20.05922, circlecheck.x, 0.0001);
        }
Exemplo n.º 12
0
        public void FindIntersectedArcTest_PointIsSameAsInspectedPoint_ReturnsNull()
        {
            var sut = new SweepTable();

            Assert.IsFalse(sut.FindIntersectedArc(new SiteEvent(new VoronoiPoint(1, 1)), new Arc(new SiteEvent(new VoronoiPoint(1, 1)))).flag);
        }
Exemplo n.º 13
0
        public void FindIntersectedArcTest_EmptyBreachList_ReturnsNull()
        {
            var sut = new SweepTable();

            Assert.IsFalse(sut.FindIntersectedArc(new SiteEvent(new VoronoiPoint(1, 1)), null).flag);
        }