/** * Calculates the centroid for a 2D geometry. The centroid represents the geometric center of mass, * where the mass is equally distributed at each point/vertex of the geometry. * For example, the centroid of a straight line is the midpoint. The centroid of a point is the point itself. * It is not guaranteed to be within or on the geometry. The centroid of a donut polygon is * the center of the hole, which is outside the polygon. The centroid of a curved polyline is not located on the line itself, but will be some distance away from it. * * ![Centroid operator](https://developers.arcgis.com/javascript/latest/assets/references/core/operators/centroid.png "Centroid operator") * * @since 4.31 * @see [labelPointOperator](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/labelPointOperator/) * @see [Sample - Geometry operator - centroid analysis](https://developers.arcgis.com/javascript/latest/sample-code/geometry-operator-centroid/) * @see [Centroid - wikipedia](https://en.wikipedia.org/wiki/Centroid) */ import type Point from "../Point.js"; import type { GeometryUnion } from "../types.js"; /** * Performs the centroid operation on a geometry. * * @param geometry - The geometry in which to calculate the centroid. * @returns The centroid of the geometry. * @example * // Return the centroid of a polygon * const centroid = centroidOperator.execute(polygon); * console.log(`x: ${centroid.x}, y: ${centroid.y}`); */ export function execute(geometry: GeometryUnion): Point; /** * Indicates if the operator supports input geometries that contain curves. * The value will always be `true`. */ export const supportsCurves: boolean;