>  Docs Center  >  Libraries  >  Motley  >  MGH_POLYBOX
Libraries

MGH_POLYBOX

MGH_POLYBOX

Name


  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.

Modification History


  Mark Hadfield, 2001-10:
    I wrote thsi first as a stand-alone function, based on JD Smith's
    POLYCLIP, then modified it so that it just calls MGH_POLYCLIP
    up to 4 times.
  Mark Hadfield, 2005-12:
    Moved to Motley library. Updated.



© 2024 NV5 Geospatial Solutions, Inc. |  Legal
   Contact Us