library(PlaneGeometry)
The Exeter point is defined as follows on Wikipedia.
Let \(ABC\) be any given triangle. Let the medians through the vertices \(A\), \(B\), \(C\) meet the circumcircle of triangle \(ABC\) at \(A'\), \(B'\) and \(C'\) respectively. Let \(DEF\) be the triangle formed by the tangents at \(A\), \(B\), and \(C\) to the circumcircle of triangle \(ABC\). (Let \(D\) be the vertex opposite to the side formed by the tangent at the vertex \(A\), let \(E\) be the vertex opposite to the side formed by the tangent at the vertex \(B\), and let \(F\) be the vertex opposite to the side formed by the tangent at the vertex \(C\).) The lines through \(DA'\), \(EB'\) and \(FC'\) are concurrent. The point of concurrence is the Exeter point of triangle \(ABC\).
Let’s construct it with the PlaneGeometry
package. We do
not need to construct the triangle \(DEF\): it is the tangential
triangle of \(ABC\), and is
provided by the tangentialTriangle
method of the R6 class
Triangle
.
<- c(0,2); B <- c(5,4); C <- c(5,-1)
A <- Triangle$new(A, B, C)
t <- t$circumcircle()
circumcircle <- t$centroid()
centroid <- Line$new(A, centroid)
medianA <- Line$new(B, centroid)
medianB <- Line$new(C, centroid)
medianC <- intersectionCircleLine(circumcircle, medianA)[[2]]
Aprime <- intersectionCircleLine(circumcircle, medianB)[[2]]
Bprime <- intersectionCircleLine(circumcircle, medianC)[[1]]
Cprime <- t$tangentialTriangle()
DEF <- Line$new(DEF$A, Aprime)
lineDAprime <- Line$new(DEF$B, Bprime)
lineEBprime <- Line$new(DEF$C, Cprime)
lineFCprime <- intersectionLineLine(lineDAprime, lineEBprime) )
( ExeterPoint #> [1] 2.621359 1.158114
# check whether the Exeter point is also on (FC')
$includes(ExeterPoint)
lineFCprime#> [1] TRUE
Let’s draw a figure now.
<- par(mar = c(0,0,0,0))
opar plot(NULL, asp = 1, xlim = c(-2,9), ylim = c(-6,7),
xlab = NA, ylab = NA, axes = FALSE)
draw(t, lwd = 2, col = "black")
draw(circumcircle, lwd = 2, border = "cyan")
draw(Triangle$new(Aprime,Bprime,Cprime), lwd = 2, col = "green")
draw(DEF, lwd = 2, col = "blue")
draw(Line$new(ExeterPoint, DEF$A, FALSE, FALSE), lwd = 2, col = "red")
draw(Line$new(ExeterPoint, DEF$B, FALSE, FALSE), lwd = 2, col = "red")
draw(Line$new(ExeterPoint, DEF$C, FALSE, FALSE), lwd = 2, col = "red")
points(rbind(ExeterPoint), pch = 19, col = "red")
par(opar)
Let \(\mathcal{C}_1\), \(\mathcal{C}_2\) and \(\mathcal{C}_3\) be three circles with respective radii \(r_1\), \(r_2\) and \(r_3\) such that \(r_3 < r_1\) and \(r_3 < r_2\). How to construct some circles simultaneously tangent to these three circles?
<- Circle$new(c(0,0), 2)
C1 <- Circle$new(c(5,5), 3)
C2 <- Circle$new(c(6,-2), 1)
C3 # inversion swapping C1 and C3 with positive power
<- inversionSwappingTwoCircles(C1, C3, positive = TRUE)
iota1 # inversion swapping C2 and C3 with positive power
<- inversionSwappingTwoCircles(C2, C3, positive = TRUE)
iota2 # take an arbitrary point on C3
<- C3$pointFromAngle(0)
M # invert it with iota1 and iota2
<- iota1$invert(M); M2 <- iota2$invert(M)
M1 # take the circle C passing through M, M1, M2
<- Triangle$new(M,M1,M2)$circumcircle()
C # take the line passing through the two inversion poles
<- Line$new(iota1$pole, iota2$pole)
cl # take the radical axis of C and C3
<- C$radicalAxis(C3)
L # let H bet the intersection of these two lines
<- intersectionLineLine(L, cl)
H # take the circle Cp with diameter [HO3]
<- C3$center
O3 <- CircleAB(H, O3)
Cp # get the two intersection points T0 and T1 of C3 with Cp
<- intersectionCircleCircle(C3, Cp)
T0_and_T1 <- T0_and_T1[[1L]]; T1 <- T0_and_T1[[2L]]
T0 # invert T0 with respect to the two inversions
<- iota1$invert(T0); T0pp <- iota2$invert(T0)
T0p # the circle passing through T0 and its two images is a solution
<- Triangle$new(T0, T0p, T0pp)$circumcircle()
Csolution0 # invert T1 with respect to the two inversions
<- iota1$invert(T1); T1pp <- iota2$invert(T1)
T1p # the circle passing through T1 and its two images is another solution
<- Triangle$new(T1, T1p, T1pp)$circumcircle() Csolution1
<- par(mar = c(0,0,0,0))
opar plot(NULL, asp = 1, xlim = c(-4,9), ylim = c(-4,9),
xlab = NA, ylab = NA, axes = FALSE)
draw(C1, col = "yellow", border = "red")
draw(C2, col = "yellow", border = "red")
draw(C3, col = "yellow", border = "red")
draw(Csolution0, lwd = 2, border = "blue")
draw(Csolution1, lwd = 2, border = "blue")
par(opar)
There are several circles called “Apollonius circle”. We take the one defined as follows, with respect to a reference triangle: the circle which touches all three excircles of the reference triangle and encompasses them.
It can be constructed as the inversive image of the nine-point circle
with respect to the circle orthogonal to the excircles of the reference
triangle. This inversion can be obtained in PlaneGeometry
with the function inversionFixingThreeCircles
.
# reference triangle
<- Triangle$new(c(0,0), c(5,3), c(3,-1))
t # nine-point circle
<- t$orthicTriangle()$circumcircle()
npc # excircles
<- t$excircles()
excircles # inversion with respect to the circle orthogonal to the excircles
<- inversionFixingThreeCircles(excircles$A, excircles$B, excircles$C)
iota # Apollonius circle
<- iota$invertCircle(npc) ApolloniusCircle
Let’s do a figure:
<- par(mar = c(0,0,0,0))
opar plot(NULL, asp = 1, xlim = c(-10,14), ylim = c(-5, 18),
xlab = NA, ylab = NA, axes = FALSE)
draw(t, lwd = 2)
draw(excircles$A, lwd = 2, border = "blue")
draw(excircles$B, lwd = 2, border = "blue")
draw(excircles$C, lwd = 2, border = "blue")
draw(ApolloniusCircle, lwd = 2, border = "red")
par(opar)
The radius of the Apollonius circle is \(\frac{r^2+s^2}{4r}\) where \(r\) is the inradius of the triangle and \(s\) its semiperimeter. Let’s check this point:
<- t$inradius()
inradius <- sum(t$edges()) / 2
semiperimeter ^2 + semiperimeter^2) / (4*inradius)
(inradius#> [1] 11.15942
$radius
ApolloniusCircle#> [1] 11.15942
Let two circles intersecting at two points. How to fill the lapping area of the two circles?
<- c(2,5); circ1 <- Circle$new(O1, 2)
O1 <- c(4,4); circ2 <- Circle$new(O2, 3)
O2
<- par(mar = c(0,0,0,0))
opar plot(NULL, asp = 1, xlim = c(0,8), ylim = c(0,8), xlab = NA, ylab = NA)
draw(circ1, border = "purple", lwd = 2)
draw(circ2, border = "forestgreen", lwd = 2)
<- intersectionCircleCircle(circ1, circ2)
intersections <- intersections[[1]]; B <- intersections[[2]]
A points(rbind(A,B), pch = 19, col = c("red", "blue"))
<- Arg((A-O1)[1] + 1i*(A-O1)[2])
theta1 <- Arg((B-O1)[1] + 1i*(B-O1)[2])
theta2 <- Arc$new(O1, circ1$radius, theta1, theta2, FALSE)$path()
path1
<- Arg((A-O2)[1] + 1i*(A-O2)[2])
theta1 <- Arg((B-O2)[1] + 1i*(B-O2)[2])
theta2 <- Arc$new(O2, circ2$radius, theta2, theta1, FALSE)$path()
path2
polypath(rbind(path1,path2), col = "yellow")
par(opar)
In the help page of the Circle
R6 class
(?Circle
), we show how to draw a hyperbolic triangle with
the help of the method
orthogonalThroughTwoPointsOnCircle()
. Here we will use this
method to draw a hyperbolic tessellation.
<- function(depth, Thetas0, colors){
tessellation stopifnot(
>= 3,
depth is.numeric(Thetas0),
length(Thetas0) == 3L,
is.character(colors),
length(colors) >= depth
)
<- Circle$new(c(0,0), 3)
circ
<- lapply(seq_along(Thetas0), function(i){
arcs <- ifelse(i == length(Thetas0), 1L, i+1L)
ip1 $orthogonalThroughTwoPointsOnCircle(Thetas0[i], Thetas0[ip1],
circarc = TRUE)
})<- lapply(arcs, function(arc){
inversions $new(arc$center, arc$radius^2)
Inversion
})
<- vector("list", depth)
Ms
<- lapply(Thetas0, function(theta) c(cos(theta), sin(theta)))
Ms[[1L]]
<- vector("list", 3L)
Ms[[2L]] for(i in 1L:3L){
<- ifelse(i == 1L, 3L, i-1L)
im1 <- inversions[[i]]$invert(Ms[[1L]][[im1]])
M attr(M, "iota") <- i
<- M
Ms[[2L]][[i]]
}
for(d in 3L:depth){
<- length(Ms[[d-1L]])
n1 <- 2L*n1
n2 <- vector("list", n2)
Ms[[d]] <- 0L
k while(k < n2){
for(j in 1L:n1){
<- Ms[[d-1L]][[j]]
M for(i in 1L:3L){
if(i != attr(M, "iota")){
<- k + 1L
k <- inversions[[i]]$invert(M)
newM attr(newM, "iota") <- i
<- newM
Ms[[d]][[k]]
}
}
}
}
}
# plot ####
<- par(mar = c(0,0,0,0), bg = "black")
opar plot(NULL, asp = 1, xlim = c(-4,4), ylim = c(-4,4),
xlab = NA, ylab = NA, axes = FALSE)
draw(circ, border = "white")
invisible(lapply(arcs, draw, col = colors[1L], lwd = 2))
<- lapply(
Thetas rapply(Ms, function(M){
Arg(M[1L] + 1i*M[2L])
how="replace"),
},
unlist)
for(d in 2L:depth){
<- sort(unlist(Thetas[1L:d]))
thetas for(i in 1L:length(thetas)){
<- ifelse(i == length(thetas), 1L, i+1L)
ip1 <- circ$orthogonalThroughTwoPointsOnCircle(thetas[i], thetas[ip1],
arc arc = TRUE)
draw(arc, lwd = 2, col = colors[d])
}
}
par(opar)
invisible()
}
tessellation(
depth = 5L,
Thetas0 = c(0, 2, 3.8),
colors = viridisLite::viridis(5)
)
Here is a version which allows to fill the hyperbolic triangles:
<- function(depth, Thetas0, colors){
tessellation2 stopifnot(
>= 3,
depth is.numeric(Thetas0),
length(Thetas0) == 3L,
is.character(colors),
length(colors)-1L >= depth
)
<- Circle$new(c(0,0), 3)
circ
<- lapply(seq_along(Thetas0), function(i){
arcs <- ifelse(i == length(Thetas0), 1L, i+1L)
ip1 $orthogonalThroughTwoPointsOnCircle(Thetas0[i], Thetas0[ip1],
circarc = TRUE)
})<- lapply(arcs, function(arc){
inversions $new(arc$center, arc$radius^2)
Inversion
})
<- vector("list", depth)
Ms
<- lapply(Thetas0, function(theta) c(cos(theta), sin(theta)))
Ms[[1L]]
<- vector("list", 3L)
Ms[[2L]] for(i in 1L:3L){
<- ifelse(i == 1L, 3L, i-1L)
im1 <- inversions[[i]]$invert(Ms[[1L]][[im1]])
M attr(M, "iota") <- i
<- M
Ms[[2L]][[i]]
}
for(d in 3L:depth){
<- length(Ms[[d-1L]])
n1 <- 2L*n1
n2 <- vector("list", n2)
Ms[[d]] <- 0L
k while(k < n2){
for(j in 1L:n1){
<- Ms[[d-1L]][[j]]
M for(i in 1L:3L){
if(i != attr(M, "iota")){
<- k + 1L
k <- inversions[[i]]$invert(M)
newM attr(newM, "iota") <- i
<- newM
Ms[[d]][[k]]
}
}
}
}
}
# plot ####
<- par(mar = c(0,0,0,0), bg = "black")
opar plot(NULL, asp = 1, xlim = c(-4,4), ylim = c(-4,4),
xlab = NA, ylab = NA, axes = FALSE)
<- do.call(rbind, lapply(rev(arcs), function(arc) arc$path()))
path polypath(path, col = colors[1L])
invisible(lapply(arcs, function(arc){
<- arc$path()
path1 <- arc$startingPoint()
B <- arc$endingPoint()
A <- Arg(A[1L] + 1i*A[2L])
alpha1 <- Arg(B[1L] + 1i*B[2L])
alpha2 <- Arc$new(c(0,0), 3, alpha1, alpha2, FALSE)$path()
path2 polypath(rbind(path1,path2), col = colors[2L])
}))
<- lapply(
Thetas rapply(Ms, function(M){
Arg(M[1L] + 1i*M[2L])
how="replace"),
},
unlist)
for(d in 2L:depth){
<- sort(unlist(Thetas[1L:d]))
thetas for(i in 1L:length(thetas)){
<- ifelse(i == length(thetas), 1L, i+1L)
ip1 <- circ$orthogonalThroughTwoPointsOnCircle(thetas[i], thetas[ip1],
arc arc = TRUE)
<- arc$path()
path1 <- arc$startingPoint()
B <- arc$endingPoint()
A <- Arg(A[1L] + 1i*A[2L])
alpha1 <- Arg(B[1L] + 1i*B[2L])
alpha2 <- Arc$new(c(0,0), 3, alpha1, alpha2, FALSE)$path()
path2 polypath(rbind(path1,path2), col = colors[d+1L])
}
}
draw(circ, border = "white")
par(opar)
invisible()
}
tessellation2(
depth = 5L,
Thetas0 = c(0, 2, 3.8),
colors = viridisLite::viridis(6)
)
Let’s draw the director circle of an ellipse. We start by constructing the minimum bounding box of the ellipse.
<- Ellipse$new(c(1,1), 5, 2, 30)
ell <- ell$diameter(0)
majorAxis <- ell$diameter(pi/2)
minorAxis <- (majorAxis$B - majorAxis$A) / 2
v1 <- (minorAxis$B - minorAxis$A) / 2
v2 # sides of the minimum bounding box
<- majorAxis$translate(v2)
side1 <- majorAxis$translate(-v2)
side2 <- minorAxis$translate(v1)
side3 <- minorAxis$translate(-v1)
side4 # take a vertex of the bounding box
<- side1$A
A # director circle
<- CircleOA(ell$center, A) circ
Now let’s take a tangent \(T_1\) to the ellipse, construct the half-line directed by \(T_1\) with origin the point of tangency, determine the intersection point of this half-line with the director circle, and draw the perpendicular \(T_2\) of \(T_1\) passing by this intersection point. Then \(T_2\) is another tangent to the ellipse.
<- ell$tangent(0.3)
T1 <- T1$clone(deep = TRUE)
halfT1 $extendA <- FALSE
halfT1<- intersectionCircleLine(circ, halfT1, strict = TRUE)
I <- T1$perpendicular(I) T2
<- par(mar=c(0,0,0,0))
opar plot(NULL, asp = 1,
xlim = c(-3,6), ylim = c(-5,7), xlab = NA, ylab = NA)
# draw the ellipse
draw(ell, col = "blue")
# draw the bounding box
draw(side1, lwd = 2, col = "green")
draw(side2, lwd = 2, col = "green")
draw(side3, lwd = 2, col = "green")
draw(side4, lwd = 2, col = "green")
# draw the director circle
draw(circ, lwd = 2, border = "red")
# draw the two tangents
draw(T1); draw(T2)
# restore the graphical parameters
par(opar)
The PlaneGeometry
package has a function
SteinerChain
which generates a Steiner chain of
circles.
By applying an affine transformation to a Steiner chain, we can get an elliptical Steiner chain.
<- Circle$new(c(3,0), 3) # exterior circle
c0 <- SteinerChain(c0, 3, -0.2, 0.5)
circles # take an ellipse
<- Ellipse$new(c(-4,0), 4, 2.5, 140)
ell # take the affine transformation which maps the exterior circle to this ellipse
<- AffineMappingEllipse2Ellipse(c0, ell)
f # take the images of the Steiner circles by this transformation
<- lapply(circles, f$transformEllipse) ellipses
<- par(mar = c(0,0,0,0))
opar plot(NULL, asp = 1, xlim = c(-8,6), ylim = c(-4,4),
xlab = NA, ylab = NA, axes = FALSE)
# draw the Steiner chain
invisible(lapply(circles, draw, lwd = 2, col = "blue"))
draw(c0, lwd = 2)
# draw the elliptical Steiner chain
invisible(lapply(ellipses, draw, lwd = 2, col = "red", border = "forestgreen"))
draw(ell, lwd = 2, border = "forestgreen")
par(opar)
Here is how I got the animation below, by varying the
shift
parameter of the Steiner chain.
library(gifski)
<- Circle$new(c(3,0), 3)
c0 <- Ellipse$new(c(-4,0), 4, 2.5, 140)
ell <- AffineMappingEllipse2Ellipse(c0, ell)
f
<- function(shift){
fplot <- SteinerChain(c0, 3, -0.2, shift)
circles <- lapply(circles, f$transformEllipse)
ellipses <- par(mar = c(0,0,0,0))
opar plot(NULL, asp = 1, xlim = c(-8,0), ylim = c(-4,4),
xlab = NA, ylab = NA, axes = FALSE)
invisible(lapply(ellipses, draw, lwd = 2, col = "blue", border = "black"))
draw(ell, lwd = 2)
par(opar)
invisible()
}
<- seq(0, 3, length.out = 100)[-1L]
shift_
save_gif(
for(shift in shift_){
fplot(shift)
},"SteinerChainElliptical.gif",
512, 512, 1/12, res = 144
)