-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpo.R
51 lines (37 loc) · 960 Bytes
/
po.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
myplot <- function(dta, cntr){
#png(file = 'P:/College/Rollwala/Project/implementation/plot_check.png')
plot(x = dta$x,y = dta$y,
xlab = "X",
ylab = "Y",
xlim = c(1,10),
ylim = c(1,10),
main = "Plotting Check"
)
plot(x = cntr$x,y = cntr$y,
xlab = "X",
ylab = "Y",
xlim = c(1,10),
ylim = c(1,10),
main = "Plotting Check",
pch = 19,
col = '#FF0000'
)
dev.off()
}
distance <- name <- function(v1, c) {
#Euclidean Distance
ans = 0
if ((typeof(v1) == 'list') && (typeof(c) == 'list') && (length(v1) == length(c))){
for (indx in 1:length(v1)) {
ans <- ans + ((v1[[indx]] - c[[indx]])^2)
}
return(ans ^ 0.5)
}
return(-1)
}
minD <- function(n){
if(is.integer(n)){
return(sqrt(2 * n))
}
stop("minD(n) : n must be an integer")
}