-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_visualize_split.R
53 lines (43 loc) · 1.25 KB
/
run_visualize_split.R
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
41
42
43
44
45
46
47
48
49
50
51
52
53
#! /usr/local/bin/Rscript --vanilla
source('configuration.R')
source('visualization.R')
frame <- 1.3
definition <- list(
k=1,
mu=circular(1, template="clock24"),
kappa=0.5,
weight=1
)
weight <- definition$weight
rho <- A1(definition$kappa)
alpha <- rho*cos(definition$mu)
beta <- rho*sin(definition$mu)
file <- "figures/original.pdf"
pdf(file, width=4, height=5)
par(mar=c(0, 0, 0, 0))
plot(circular(NA, rotation="clock", zero=pi/2), xlim=c(-frame, frame), ylim=c(-frame, frame))
CurveForParameters(definition, add=TRUE)
lines(c(0, beta), c(0, alpha))
dev.off()
weight1 <- 0.3
weight2 <- weight - weight1
alpha1 <- 0.6
beta1 <- -0.1
rho1 <- sqrt(alpha1^2 + beta1^2)
alpha2 <- (alpha*weight - alpha1*weight1)/weight2
beta2 <- (beta*weight - beta1*weight1)/weight2
rho2 <- sqrt(alpha2^2 + beta2^2)
definition1 <- list(
k=2,
mu=circular(c(atan2(beta1, alpha1), atan2(beta2, alpha2)), template="clock24"),
kappa=c(A1inv(rho1), A1inv(rho2)),
weight=c(weight1, weight2)
)
file <- "figures/split.pdf"
pdf(file, width=4, height=5)
par(mar=c(0, 0, 0, 0))
plot(circular(NA, rotation="clock", zero=pi/2), xlim=c(-frame, frame), ylim=c(-frame, frame))
CurvesForParameters(definition1, add=TRUE)
lines(c(0, beta1), c(0, alpha1))
lines(c(0, beta2), c(0, alpha2))
dev.off()