Example #1
0
        public void ShouldBeStabilizedAfterFiveOfSamePoint()
        {
            var filter = new PointStabilizationFilter(2, 5);

            filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5));
            filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5));
            filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5));
            filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5));
            filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5));
            Assert.IsTrue(filter.HasStabilizedPoint);
        }
Example #2
0
        public void ShouldNotBeStabilizedAfter4StablePointsAndOneOutOfTolerance()
        {
            var filter = new PointStabilizationFilter(2, 5);

            filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5));
            filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5));
            filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5));
            filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5));
            filter.Add(new Core.Models.Drawing.Point2D <double>(8, 8));
            Assert.IsFalse(filter.HasStabilizedPoint);
            Assert.AreEqual(1, filter.PointCount);
        }
Example #3
0
        public void StabilizedPointShouldBeSameAsInputValue()
        {
            var filter = new PointStabilizationFilter(2, 5);

            filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5));
            filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5));
            filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5));
            filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5));
            filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5));
            Assert.AreEqual(5, filter.StabilizedPoint.X);
            Assert.AreEqual(5, filter.StabilizedPoint.Y);
        }
Example #4
0
        public void ShouldNotBeStabilizedAfterSinglePoint()
        {
            var filter = new PointStabilizationFilter(2, 5);

            filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5));
            Assert.IsFalse(filter.HasStabilizedPoint);
        }
Example #5
0
        public void ShouldBeStabilizedIf6thPointInToleranceButDifferent()
        {
            var filter = new PointStabilizationFilter(2, 5);

            filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5));
            filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5));
            filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5));
            filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5));
            filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5));
            filter.Add(new Core.Models.Drawing.Point2D <double>(6.1, 4.75));

            Assert.IsTrue(filter.HasStabilizedPoint);
        }
Example #6
0
        public void ShouldNotBeStabilizedIfStabilizedThen6thPointIsOutOfToleranceButDifferent()
        {
            var filter = new PointStabilizationFilter(2, 5);

            filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5));
            filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5));
            filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5));
            filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5));
            filter.Add(new Core.Models.Drawing.Point2D <double>(5, 5));
            Assert.IsTrue(filter.HasStabilizedPoint);
            filter.Add(new Core.Models.Drawing.Point2D <double>(8, 4.75));

            Assert.IsFalse(filter.HasStabilizedPoint);
        }