Determine the circumcircle (and some other characteristics) of a triangle
circum.RdThis function returns the circumcircle of a triangle and some additonal values used to determine them.
Value
- x
'x' coordinate of center
- y
'y' coordinate of center
- radius
circumcircle radius
- signed.area
signed area of riangle (positive iff nodes are numbered counter clock wise)
- aspect.ratio
ratio "radius of inscribed circle"/"radius of circumcircle", varies between 0 and 0.5
0 means collinear points, 0.5 equilateral trangle.
References
https://math.fandom.com/wiki/Circumscribed_circle#Coordinates_of_circumcenter, visited march 2022.
Note
This function is mainly intended to be used by circumcircle.
Examples
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")
}