HTML automatically generated with rman
Table of Contents

Name

tabpolygon - select points from a table that are either inside or outside a polygon

Synopsis

tabpolygon [parameter=value]

Description

tabpolygon uses two columns from a table as the X and Y coordinates of a series of points in a plane, and allows you to define a polygon in that coordinate system and output only lines whose points would lie either inside or outside that polygon.

Optionally rejected lines can be output as comments, which keeps the linecount of input and output the same.

Parameters

The following parameters are recognized in any order if the keyword is also given:
in=
Input file name (table). No default
xcol=
X coordinate column [1]
ycol=
Y coordinate column [2]
polygon=
The (minimum 3) pairs of X,Y that define the polygon. These must be in the same coordinate system as the one in the X and Y columns, and the last point is automatically closed connected to the first point to close the polygon. There is no check for self-intersecting polygons such as the figure 8. No default.
inside=
Select inside of region to be output? [t]
comment=
Also copy comment lines?. If true, comment lines, as well as points failing to match the inside/outside polygon criterion, will be output, but commented using the usual # symbol.. Default : f

Examples

Here is how points in two (assumed disjoint) regions are identified, and the remnant in the 3rd table.
  % tabpolygon in=points_all.tab   polygon=@region1.pol            > points_1.tab
  % tabpolygon in=points_all.tab   polygon=@region1.pol inside=f   > points_not_1.tab
  % tabpolygon in=points_not_1.tab polygon=@region2.pol            > points_2.tab
  % tabpolygon in=points_not_1.tab polygon=@region2.pol inside=f   > points_3.tab

Caveats

Boolean operations on multiple regions is cumbersome or impossible at the moment.

See Also

tabmath(1NEMO)

Files

src/kernel/tab/tabpolygon.c    source code

Author

Peter Teuben

Update History


05-Mar-13    V0.1 Created        PJT


Table of Contents