Exemplo n.º 1
0
        /// <summary>
        /// Compute the centroid of the polygon.
        /// </summary>
        /// <param name="shell">The coordinates of the polygon shell.</param>
        /// <returns>The centroid of the polygon.</returns>
        public static Coordinate ComputeCentroid(IReadOnlyList <Coordinate> shell)
        {
            PolygonCentroidAlgorithm algorithm = new PolygonCentroidAlgorithm(shell);

            algorithm.Compute();

            return(algorithm.Result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Compute the centroid of the polygon.
        /// </summary>
        /// <param name="shell">The coordinates of the polygon shell.</param>
        /// <param name="holes">The collection of coordinates representing the polygon holes.</param>
        /// <returns>The centroid of the polygon.</returns>
        public static Coordinate ComputeCentroid(IReadOnlyList <Coordinate> shell, IEnumerable <IReadOnlyList <Coordinate> > holes)
        {
            PolygonCentroidAlgorithm algorithm = new PolygonCentroidAlgorithm(shell, holes);

            algorithm.Compute();

            return(algorithm.Result);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Compute the centroid of the polygon.
        /// </summary>
        /// <param name="source">The polygon.</param>
        /// <returns>The centroid of the polygon.</returns>
        public static Coordinate ComputeCentroid(IBasicPolygon source)
        {
            PolygonCentroidAlgorithm algorithm = new PolygonCentroidAlgorithm(source);

            algorithm.Compute();

            return(algorithm.Result);
        }