找回密码
 快速注册
搜索
查看: 36|回复: 0

[R] PlaneGeometry package

[复制链接]

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

hbghlyj 发表于 2022-6-22 03:01 |阅读模式
cran.r-project.org/web/packages/PlaneGeometry/
github.com/stla/PlaneGeometry

Examples
cran.r-project.org/web/packages/PlaneGeometry/vignettes/examples.html
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.

  1. A <- c(0,2); B <- c(5,4); C <- c(5,-1)
  2. t <- Triangle$new(A, B, C)
  3. circumcircle <- t$circumcircle()
  4. centroid <- t$centroid()
  5. medianA <- Line$new(A, centroid)
  6. medianB <- Line$new(B, centroid)
  7. medianC <- Line$new(C, centroid)
  8. Aprime <- intersectionCircleLine(circumcircle, medianA)[[2]]
  9. Bprime <- intersectionCircleLine(circumcircle, medianB)[[2]]
  10. Cprime <- intersectionCircleLine(circumcircle, medianC)[[1]]
  11. DEF <- t$tangentialTriangle()
  12. lineDAprime <- Line$new(DEF$A, Aprime)
  13. lineEBprime <- Line$new(DEF$B, Bprime)
  14. lineFCprime <- Line$new(DEF$C, Cprime)
  15. ( ExeterPoint <- intersectionLineLine(lineDAprime, lineEBprime) )
  16. #> [1] 2.621359 1.158114
  17. # check whether the Exeter point is also on (FC')
  18. lineFCprime$includes(ExeterPoint)
  19. #> [1] TRUE
复制代码

Let’s draw a figure now.
  1. opar <- par(mar = c(0,0,0,0))
  2. plot(NULL, asp = 1, xlim = c(-2,9), ylim = c(-6,7),
  3.      xlab = NA, ylab = NA, axes = FALSE)
  4. draw(t, lwd = 2, col = "black")
  5. draw(circumcircle, lwd = 2, border = "cyan")
  6. draw(Triangle$new(Aprime,Bprime,Cprime), lwd = 2, col = "green")
  7. draw(DEF, lwd = 2, col = "blue")
  8. draw(Line$new(ExeterPoint, DEF$A, FALSE, FALSE), lwd = 2, col = "red")
  9. draw(Line$new(ExeterPoint, DEF$B, FALSE, FALSE), lwd = 2, col = "red")
  10. draw(Line$new(ExeterPoint, DEF$C, FALSE, FALSE), lwd = 2, col = "red")
  11. points(rbind(ExeterPoint), pch = 19, col = "red")
复制代码

index.png

手机版|悠闲数学娱乐论坛(第3版)

GMT+8, 2025-3-4 15:46

Powered by Discuz!

× 快速回复 返回顶部 返回列表