# pnp: Check if a point is within a polygon (2D) In recexcavAAR: 3D Reconstruction of Archaeological Excavations

## Description

`pnp` is able to determine if a point is within a polygon in 2D space. The polygon is described by its corner points. The points must be in a correct drawing order.

Based on this solution: Copyright (c) 1970-2003, Wm. Randolph Franklin http://wrf.ecse.rpi.edu/pmwiki/pmwiki.php/Main/Software#toc24

## Usage

 `1` ```pnp(vertx, verty, testx, testy) ```

## Arguments

 `vertx` vector of x axis values of polygon corner points `verty` vector of y axis values of polygon corner points `testx` x axis value of point of interest `testy` y axis value of point of interest

## Value

boolean value - TRUE, if the point is within the polygon. Otherwise FALSE.

Other pnpfuncs: `pnpmulti`
 ``` 1 2 3 4 5 6 7 8 9 10``` ```df <- data.frame( x = c(1,1,2,2), y = c(1,2,1,2) ) pnp(df\$x, df\$y, 1.5, 1.5) pnp(df\$x, df\$y, 2.5, 2.5) # caution: false-negatives in edge-cases: pnp(df\$x, df\$y, 2, 1.5) ```