circum.RdThis function returns the circumcircle of a triangle and some additonal values used to determine them.
circum(x, y)This is an interface to the Fortran function CIRCUM found in TRIPACK.
'x' coordinate of center
'y' coordinate of center
circumcircle radius
signed area of riangle (positive iff nodes are numbered counter clock wise)
ratio "radius of inscribed circle"/"radius of circumcircle", varies between 0 and 0.5
0 means collinear points, 0.5 equilateral trangle.
https://math.fandom.com/wiki/Circumscribed_circle#Coordinates_of_circumcenter, visited march 2022.
This function is mainly intended to be used by circumcircle.
circum(c(0,1,0),c(0,0,1))
#> $x
#> [1] 0.5
#>
#> $y
#> [1] 0.5
#>
#> $aspect.ratio
#> [1] 0.4142136
#>
#> $x
#> [1] 0.5
#>
#> $y
#> [1] 0.5
#>
#> $radius
#> [1] 0.7071067
#>
#> $signed.area
#> [1] -0.5000001
#>
tr <- list()
tr$t1 <-list(x=c(0,1,0),y=c(0,0,1))
tr$t2 <-list(x=c(0.5,0.9,0.7),y=c(0.2,0.9,1))
tr$t3 <-list(x=c(0.05,0,0.3),y=c(0.2,0.7,0.1))
plot(0,0,type="n",xlim=c(-0.5,1.5),ylim=c(-0.5,1.5))
for(i in 1:3){
x <- tr[[i]]$x
y <- tr[[i]]$y
points(x,y,pch=c("1","2","3"),xlim=c(-0.5,1.5),ylim=c(-0.5,1.5))
cc =circum(x,y)
lines(c(x,x[1]),c(y,y[1]))
points(cc$x,cc$y)
if(cc$signed.area<0)
circles(cc$x,cc$y,cc$radius,col="blue",lty="dotted")
else
circles(cc$x,cc$y,cc$radius,col="red",lty="dotted")
}