>  Docs Center  >  Libraries  >  Motley  >  MGH_PNPOLY
Libraries

MGH_PNPOLY

MGH_PNPOLY

Name


  MGH_PNPOLY

Purpose


  Determine whether a point or set of points is inside a polygon.

Calling Sequence


  Result = MGH_PNPOLY(XP, YP, X, Y)

Inputs


  XP,YP: Vectors of X, Y positions defining the polygon.
  X,Y: X, Y position(s) defining the point(s) to be tested. Can
              be vectors.

Outputs


  The function returns an array of the same shape as X. Each element
  is 0 if the point is outside the polygon, 1 if it is inside the polygon.
  The comp.graphics.algorithms has the following to say about points
  on the boundary:
      "It returns 1 for strictly interior points, 0 for strictly exterior,
      and 0 or 1 for points on the boundary. The boundary behavior is
      complex but determined; in particular, for a partition of a region
      into polygons, each point is "in" exactly one polygon. (See p.243
      of [O'Rourke (C)] for a discussion of boundary behavior.)"

Procedure


  Ray-crossing technique of WR Franklin from Comp.graphics.algorithms FAQ.

References


    * "Misc Notes - WR Franklin", http://www.ecse.rpi.edu/Homepages/wrf/misc.html:
      includes a reference (broken @ Jul 2001) to his point-in-polygon code.
    * Comp.graphics.algorithms FAQ, http://www.faqs.org/faqs/graphics/algorithms-faq/:
      See subject 2.03
###########################################################################
  This software is provided subject to the following conditions:
  1. NIWA makes no representations or warranties regarding the
    accuracy of the software, the use to which the software may
    be put or the results to be obtained from the use of the
    software. Accordingly NIWA accepts no liability for any loss
    or damage (whether direct of indirect) incurred by any person
    through the use of or reliance on the software.
  2. NIWA is to be acknowledged as the original author of the
    software where the software is used or presented in any form.
###########################################################################

Modification History


  Mark Fardal, Nov 1999:
      Written as PNPOLY.
  Mark Fardal, Jul 2001:
      Added header.
  Mark Hadfield, Jul 2001:
      Renamed MGH_PNPOLY. Output now matches input in shape, not just size.



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