Welcome to the L3 Harris Geospatial documentation center. Here you will find reference guides and help documents.
﻿

MGH_POLYBOX

MGH_POLYBOX

## Purpose

Clip an arbitrary polygon on the X-Y plane to a box (a rectangle
defined by X and Y limits) using the Sutherland-Hodgman algorithm.

## Category

Graphics, Region of Interest, Geometry

## Calling Sequence

result = MGH_POLYBOX(xclip, yclip, polin, COUNT=count)

## Return Value

The function returns [2,n] array defining the clipped polygon. The
second dimension will equal the value of the COUNT argument, except
where this is 0 in which the return value is -1.

## Positional Parameters

xclip (input, numeric vector)
A 2-element vector specifying the clipping values in the X direction
yclip (input, numeric vector)
A 2-element vector specifying the clipping values in the Y direction
polin (input, numeric array)
A [2,m] array defining the polygon to be clipped.

## Keyword Parameters

COUNT (output, integer)
The number of vertices in the clipped polygon.

## Procedure

The polygon is clipped to each edge in turn using the Sutherland-Hodgman
algorithm.
This function is based on JD Smith's POLYCLIP function. He can take all
of the credit and none of the blame.