Skip to main content
Version: Next

getRegionCenterFromPoints

Callable

  • getRegionCenterFromPoints(points: Point2D[], regionType: RegionType): Point2D

  • Computes a region center from raw control points.

    Line-like regions use the midpoint between their two endpoints. Polygonal regions use the center of their control-point bounding box. Center-based regions use their first control point. Invalid or incomplete inputs fall back to the first control point when available, otherwise {x: 0, y: 0}.


    Parameters

    • points: Point2D[]

      Region control points in image pixel coordinates.

    • regionType: RegionType

      Type of the region represented by the control points.

    Returns Point2D

    The computed center point in image pixel coordinates.