public void TestDouglasPeuckerSquiggle()
        {
            var simplifier = new RamerDouglasPeuckerSimplifier();

            var line = new List <Vector2>
            {
                new(0.0f, 0f),
                new(0.5f, 0.05f),
                new(1.0f, 0f),
                new(1.5f, -0.05f),
                new(2.0f, 0f),
            };

            Assert.That(simplifier.Simplify(line, 0.1f).Count, Is.EqualTo(2));
        }
예제 #2
0
        public void TestDouglasPeuckerBox()
        {
            // Box should still simplify to a box.
            var simplifier = new RamerDouglasPeuckerSimplifier();

            var line = new List <Vector2>
            {
                new(0.0f, 0f),
                new(0.0f, 1.0f),
                new(1.0f, 1.0f),
                new(1.0f, 0f),
            };

            Assert.That(simplifier.Simplify(line, 0.01f).Count, Is.EqualTo(4));
        }