예제 #1
0
        /// <summary>
        /// Calculates the area of a polygon.
        /// </summary>
        /// <param name="vertices">The vertices of the polygon.</param>
        /// <returns>The area.</returns>
        public static Scalar GetArea(Vector2D[] vertices)
        {
            Scalar result;

            BoundingPolygon.GetArea(vertices, out result);
            return(result);
        }
예제 #2
0
        public static Scalar GetAreaOfRange(Vector2D[][] polygons)
        {
            if (polygons == null)
            {
                throw new ArgumentNullException("polygons");
            }
            if (polygons.Length == 0)
            {
                throw new ArgumentOutOfRangeException("polygons");
            }
            Scalar result = 0;
            Scalar temp;

            Vector2D[] polygon;
            for (int index = 0; index < polygons.Length; ++index)
            {
                polygon = polygons[index];
                if (polygon == null)
                {
                    throw new ArgumentNullException("polygons");
                }
                BoundingPolygon.GetArea(polygon, out temp);
                result += temp;
            }
            return(result);
        }