rekt2line: Rectangle Line Overlap

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/rekt2line.R

Description

Find points on a rectangle closest to a set of points.

Usage

1
rekt2line(rekt, pnts)

Arguments

rekt

rectangle comprised of 4 points in counter clockwise direction.

pnts

set of points inside the rectangle

Details

Program is used for exploding symbols to the edge of the rectangle input

Value

list ofnew poistion x,y values

Author(s)

Jonathan M. Lees<jonathan.lees@unc.edu>

See Also

ExplodeSymbols

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
F1 = list(x=rnorm(20), y=rnorm(20))
r1 = range(F1$x)
r2 = range(F1$y)

r1 = c(r1[1]-0.1*diff(r1), r1[2]+0.1*diff(r1))
r2 = c(r2[1]-0.1*diff(r2), r2[2]+0.1*diff(r2))



rekt = list(x=c(r1[1], r1[2], r1[2], r1[1]), y=c(r2[1], r2[1], r2[2], r2[2]))
pnts = list(x1=rep(mean(r1), length(F1$x)), y1=rep(mean(r2), length(F1$y)),x2= F1$x, y2=F1$y)
NEW = rekt2line(rekt, pnts)

plot(range(c(F1$x, NEW$x)) , range(c(F1$y, NEW$y)), type='n')
rect(r1[1], r2[1], r1[2], r2[2], border=grey(.75), lty=2)

points(F1, pch=2, col='blue')
segments(F1$x, F1$y, NEW$x, NEW$y)
points(NEW, pch=3, col='red')

GEOmap documentation built on May 20, 2017, 1:49 a.m.

Search within the GEOmap package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.