Пример #1
0
        public void CleanupNotRequired()
        {
            IList <Vector2D> positions = new List <Vector2D>();

            positions.Add(new Vector2D(0, 0));
            positions.Add(new Vector2D(1, 1));
            positions.Add(new Vector2D(1, 0));

            GraphicsAssert.ListsAreEqual(positions, SimplePolygonAlgorithms.Cleanup(positions));
        }
Пример #2
0
        public void WindingOrderClockwiseTriangle()
        {
            IList <Vector2D> positions = new List <Vector2D>();

            positions.Add(new Vector2D(0, 0));
            positions.Add(new Vector2D(1, 1));
            positions.Add(new Vector2D(1, 0));

            Assert.AreEqual(PolygonWindingOrder.Clockwise, SimplePolygonAlgorithms.ComputeWindingOrder(positions));
            Assert.AreEqual(-0.5, SimplePolygonAlgorithms.ComputeArea(positions));
        }
Пример #3
0
        public void WindingOrderCounterclockwiseDiamond()
        {
            IList <Vector2D> positions = new List <Vector2D>();

            positions.Add(new Vector2D(0, -0.5));
            positions.Add(new Vector2D(0.5, 0));
            positions.Add(new Vector2D(0, 0.5));
            positions.Add(new Vector2D(-0.5, 0));

            Assert.AreEqual(PolygonWindingOrder.Counterclockwise, SimplePolygonAlgorithms.ComputeWindingOrder(positions));
            Assert.AreEqual(0.5, SimplePolygonAlgorithms.ComputeArea(positions));
        }
Пример #4
0
        public void WindingOrderOnEllipsoid()
        {
            IList <Vector3D> positions = new List <Vector3D>();

            positions.Add(Ellipsoid.UnitSphere.ToVector3D(Trig.ToRadians(new Geodetic3D(0, 0))));
            positions.Add(Ellipsoid.UnitSphere.ToVector3D(Trig.ToRadians(new Geodetic3D(1, 0))));
            positions.Add(Ellipsoid.UnitSphere.ToVector3D(Trig.ToRadians(new Geodetic3D(1, 1))));

            EllipsoidTangentPlane  plane            = new EllipsoidTangentPlane(Ellipsoid.UnitSphere, positions);
            ICollection <Vector2D> positionsOnPlane = plane.ComputePositionsOnPlane(positions);

            Assert.AreEqual(PolygonWindingOrder.Counterclockwise, SimplePolygonAlgorithms.ComputeWindingOrder(positionsOnPlane));
        }
Пример #5
0
        public void CleanupRequired()
        {
            IList <Vector2D> positions = new List <Vector2D>();

            positions.Add(new Vector2D(0, 0));
            positions.Add(new Vector2D(0, 0));
            positions.Add(new Vector2D(1, 0));
            positions.Add(new Vector2D(1, 1));
            positions.Add(new Vector2D(0, 0));

            IList <Vector2D> cleanedPositions = SimplePolygonAlgorithms.Cleanup(positions);

            Assert.AreEqual(3, cleanedPositions.Count);
            Assert.AreEqual(new Vector2D(1, 0), cleanedPositions[0]);
            Assert.AreEqual(new Vector2D(1, 1), cleanedPositions[1]);
            Assert.AreEqual(new Vector2D(0, 0), cleanedPositions[2]);
        }
Пример #6
0
 public void WindingOrderEmpty()
 {
     SimplePolygonAlgorithms.ComputeWindingOrder(new List <Vector2D>());
 }
Пример #7
0
 public void WindingOrderNull()
 {
     SimplePolygonAlgorithms.ComputeWindingOrder(null);
 }
Пример #8
0
 public void CleanupOrderEmpty()
 {
     SimplePolygonAlgorithms.Cleanup(new List <Vector2D>());
 }
Пример #9
0
 public void CleanupOrderNull()
 {
     SimplePolygonAlgorithms.Cleanup <Vector2D>(null);
 }