R/voronoi.findrejectsites.R

Defines functions voronoi.findrejectsites

Documented in voronoi.findrejectsites

voronoi.findrejectsites <- function(voronoi.obj, xmin, xmax, ymin, ymax)
{
  ## Given a voronoi object, find the reject sites, i.e. those sites
  ## with one of their vertices outside the bounded rectangle given by
  ## (xmin,ymin) and (xm ax,ymax).
  ## Return a vector `rejects': site N is a reject iff rejects[i] is T.
  nsites <- length(voronoi.obj$tri$x)
  rejects <- logical(nsites)
  outsiders <- ((voronoi.obj$x > xmax) | (voronoi.obj$x < xmin) |
                (voronoi.obj$y > ymax) | (voronoi.obj$y < ymin))


  ## In the list below, each site could be rejected more than once.
  rejects[c(voronoi.obj$p1[outsiders], voronoi.obj$p2[outsiders], voronoi.obj$p3[outsiders])] <- TRUE;

  rejects
}

Try the tripack package in your browser

Any scripts or data that you put into this service are public.

tripack documentation built on Oct. 21, 2024, 5:07 p.m.