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<[email protected]>

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 30, 2017, 3:58 a.m.