data(circtest)
# smallest circle:
circumcircle(circtest,num.touch=2,plot=TRUE)
# smallest circle with maximum touching points (3):
circumcircle(circtest,num.touch=3,plot=TRUE)
# some stress test for this function,
data(circtest2)
# circtest2 was generated by:
# 100 random points almost one a circle:
# alpha <- runif(100,0,2*pi)
# x <- cos(alpha)
# y <- sin(alpha)
# circtest2<-list(x=cos(alpha)+runif(100,0,0.1),
# y=sin(alpha)+runif(100,0,0.1))
#
circumcircle(circtest2,plot=TRUE)
Run the code above in your browser using DataLab