inside.swin {ads}R Documentation

Test whether points are inside a sampling window

Description

Function inside.swin tests whether points lie inside or outside a given sampling window.

Usage

inside.swin(x, y, w, bdry=TRUE)

Arguments

x

a vector of x coordinates of points.

y

a vector of y coordinates of points.

w

an object of class "swin" (see swin) defining the sampling window.

bdry

by default bdry = TRUE. If FALSE, points located on the boundary of the sampling window are considered to be outside.

Value

A logical vector whose ith entry is TRUE if the corresponding point (x[i],y[i]) is inside w, FALSE otherwise.

Note

For "complex" sampling windows, points inside the triangles to remove or on their boundary, are considered outside.

Author(s)

Raphael.Pelissier@ird.fr

See Also

swin.

Examples

  data(BPoirier)
  BP <- BPoirier
  wr <- swin(BP$rect)
  sum(inside.swin(BP$trees$x, BP$trees$y, wr))
  
  wc <- swin(c(55,45,45))
  sum(inside.swin(BP$trees$x, BP$trees$y, wc))
  
  wrt <- swin(BP$rect, triangles=BP$tri1)
  sum(inside.swin(BP$trees$x, BP$trees$y,wrt))

[Package ads version 1.5-10 Index]