TestRotation: utility function to test validity of rotation

Description Usage Arguments Author(s) Examples

Description

utility function to test validity of rotation

Usage

1
2
3
4
TestRotation(x, angles = c(0, 30, 45, 60), center = c(0, 0), 


    OVERLAY = FALSE)

Arguments

x

data frame to be rotated

angles

angles to rotate over

center

center of rotation; another possible choice would be colMeans(x[,c("X","Y")])

OVERLAY

should the partition be overlaid graphically?

Author(s)

Markus Loecher

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
TestRotation()


 


TestRotation(center=c(2,2))


 


N= 250


x1 = cbind.data.frame(X=runif(N),Y=runif(N), violent = 0)


x2 = cbind.data.frame(X=runif(N),Y=runif(N,0.45,0.55), violent = 1)


x = rbind.data.frame(x1,x2)-c(0.5,0.5)


TestRotation(x, center=c(-0.5,-0.5))





cm=colMeans(x)


y1 = Rotate(x,a=0,center=cm)


y2 = Rotate(y1,a=0,center=cm,inverseRot=TRUE)


mean(abs(unlist(y2-x)))

TreeHotspots documentation built on May 2, 2019, 5:17 p.m.