Esempio n. 1
0
        public Polygon(params Vector2[] vertices)
        {
            Vertices = new Vector2[vertices.Length];
            Normals  = new Vector2[vertices.Length];

            // re-center the polygon so that the centroid is on the origin.
            CalculateCentroid();
            if (!Vector2Extensions.AlmostZero(Centroid))
            {
                for (int i = 0; i < vertices.Length; i++)
                {
                    Vertices[i] = Vertices[i] - Centroid;
                }
            }
            CalculateCentroid();
        }