コード例 #1
0
        public void FirstPointIsIdenticalWithUpperLeftCorner()
        {
            HorizontalStepper hs    = new HorizontalStepper(this.polygon, this.colorTranslation);
            List <Step>       steps = hs.CalculateFillSteps();

            Assert.AreEqual(this.polygon.Vertices[0], steps[0].Point);
        }
コード例 #2
0
        public void OutlineHasAtLeastAsManyStepsAsPolygonHasVertices()
        {
            HorizontalStepper h = new HorizontalStepper(this.polygon, this.colorTranslation);
            var outlineSteps    = h.CalculateOutlineSteps();

            Assert.IsTrue(outlineSteps.Count >= this.polygon.Vertices.Count + 1);
        }
コード例 #3
0
        public void FillStartsWithOutline()
        {
            HorizontalStepper h = new HorizontalStepper(this.polygon, this.colorTranslation);
            var fillSteps       = h.CalculateFillSteps();
            var outlineSteps    = h.CalculateOutlineSteps();

            Assert.AreEqual(fillSteps.First().Point, outlineSteps.Last().Point);
        }
コード例 #4
0
        public void FindsFiveIntersectionsForMediumHeightInverse()
        {
            this.colorTranslation.LineHeight = 0.45;
            HorizontalStepper hs    = new HorizontalStepper(this.inverseTriangle, this.colorTranslation);
            List <Step>       steps = hs.CalculateFillSteps();

            Assert.AreEqual(5, steps.Count);
        }
コード例 #5
0
        public void FindsThreeIntersectionsForLargeHeight()
        {
            this.colorTranslation.LineHeight = 0.9;
            HorizontalStepper hs    = new HorizontalStepper(this.triangle, this.colorTranslation);
            List <Step>       steps = hs.CalculateFillSteps();

            Assert.AreEqual(3, steps.Count);
        }
コード例 #6
0
        public void OutlineHasMoreStepsThanPolygonHasVerticesForSmallSteplength()
        {
            this.colorTranslation.MaxStepLength = this.polygon.Vertices[0].Distance(this.polygon.Vertices[1]) / 2;
            HorizontalStepper h = new HorizontalStepper(this.polygon, this.colorTranslation);
            var outlineSteps    = h.CalculateOutlineSteps();

            Assert.IsTrue(outlineSteps.Count > this.polygon.Vertices.Count + 1);
        }
コード例 #7
0
        public void Angle0IsIdenticalWithHorizontal()
        {
            var ct = new ColorTranslation();

            ct.LineHeight = 0.234;

            Polygon           p  = this.createDefaultPolygon();
            HorizontalStepper hs = new HorizontalStepper(p, ct);
            AngleStepper      a  = new AngleStepper(p, ct);


            List <Step> stepsHorizontal = hs.CalculateFillSteps();
            List <Step> stepsAngle      = a.CalculateFillSteps();

            CollectionAssert.AreEqual(stepsHorizontal, stepsAngle);
        }
コード例 #8
0
        public void StepsCountainNoDoubles()
        {
            HorizontalStepper hs = new HorizontalStepper(this.polygon, this.colorTranslation);

            List <Step> steps = hs.CalculateFillSteps();

            bool isRepeated = false;
            var  set        = new HashSet <Tuple <double, double> >();

            foreach (var x in steps)
            {
                if (!set.Add(new Tuple <double, double>(x.Point.X, x.Point.Y)))
                {
                    isRepeated = true;
                    break;
                }
            }

            Assert.IsFalse(isRepeated);
        }