UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

55 lines (50 loc) 1.79 kB
/** * Calculates the convex hull of 2D geometries. * A convex hull is the smallest convex polygon that encloses a group of geometries or vertices. * The hull is typically a polygon but can also be a polyline or a point in degenerate cases. * * ![Convex hull operator](https://developers.arcgis.com/javascript/latest/assets/references/core/operators/convexHull.png "Convex hull operator") * * @since 4.31 */ import type { GeometryUnion, GeometryWithoutMeshUnion } from "../types.js"; export interface Options { /** * Indicates if the convex hull geometries should be merged. * Set to `true` to merge the geometries into a single geometry. * * @default false */ merge?: boolean; } /** * Calculates the convex hull geometry. * * @param geometry - The input geometry. * @returns Returns the convex hull geometry or null. * @example * // Create a convex hull around a polygon. * const convexHull = convexHullOperator.execute(polygon); */ export function execute(geometry: GeometryUnion): GeometryWithoutMeshUnion | null | undefined; /** * Calculates the convex hull. * * @param geometries - The input geometries. * All the geometries must have the same spatial reference. * @param options - Additional options. * @returns Returns the convex hull geometries or null. */ export function executeMany(geometries: GeometryUnion[], options?: Options): (GeometryWithoutMeshUnion | null | undefined)[]; /** * Checks if a geometry is convex. * * @param geometry - The input geometry. * @returns Returns `true` if the geometry is convex. */ export function isConvex(geometry: GeometryUnion): boolean; /** * Indicates if the operator supports input geometries that contain curves. * The value will always be `true`. */ export const supportsCurves: boolean;