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

  >  Docs Center  >  Libraries  >  Motley  >  MGH_POLYBOX






  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.


  Graphics, Region of Interest, Geometry

Calling Sequence

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

Return Value

  The function returns a [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.
  poly (input, numeric array)
    A [2,m] array defining the polygon to be clipped.
  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
  COUNT (output, integer)
    The number of vertices in the clipped polygon.


  The polygon is clipped to each edge in turn using the Sutherland-Hodgman
  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.
  Mark Hadfield, 2013-06:
    - Changed calls to MGH_POLYCLIP to account for its new argument order.
    - Argument order of this function changed similarly.

© 2019 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us