Search Results for

    Show / Hide Table of Contents

    Class Centroid

    Computes the centroid of a Geometry of any dimension. For collections the centroid is computed for the collection of non-empty elements of highest dimension. The centroid of an empty geometry is null

    Inheritance
    object
    Centroid
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: NetTopologySuite.Algorithm
    Assembly: NetTopologySuite.dll
    Syntax
    public class Centroid
    Remarks

    Algorithm

    • Dimension 2 - the centroid ic computed as a weighted sum of the centroids of a decomposition of the area into (possibly overlapping) triangles. Holes and multipolygons are handled correctly. See http://www.faqs.org/faqs/graphics/algorithms-faq/ for further details of the basic approach.
    • Dimension 1 - Computes the average of the midpoints of all line segments weighted by the segment length. Zero-length lines are treated as points.
    • Dimension 0 - Compute the average coordinate over all points. Repeated points are all included in the average
    If the input geometries are empty, a null Coordinate is returned.

    Constructors

    | Edit this page View Source

    Centroid(Geometry)

    Creates a new instance for computing the centroid of a geometry

    Declaration
    public Centroid(Geometry geom)
    Parameters
    Type Name Description
    Geometry geom

    Methods

    | Edit this page View Source

    GetCentroid()

    Gets the computed centroid.

    Declaration
    public Coordinate GetCentroid()
    Returns
    Type Description
    Coordinate

    The computed centroid, or null if the input is empty

    | Edit this page View Source

    GetCentroid(Geometry)

    Computes the centroid point of a geometry.

    Declaration
    public static Coordinate GetCentroid(Geometry geom)
    Parameters
    Type Name Description
    Geometry geom

    The geometry to use

    Returns
    Type Description
    Coordinate

    The centroid point, or null if the geometry is empty

    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX