Triangle | R Documentation |
A triangle has three vertices. They are named A, B, C.
A
get or set the vertex A
B
get or set the vertex B
C
get or set the vertex C
new()
Create a new Triangle
object.
Triangle$new(A, B, C)
A, B, C
vertices
A new Triangle
object.
t <- Triangle$new(c(0,0), c(1,0), c(1,1)) t t$C t$C <- c(2,2) t
print()
Show instance of a triangle object
Triangle$print(...)
...
ignored
Triangle$new(c(0,0), c(1,0), c(1,1))
flatness()
Flatness of the triangle.
Triangle$flatness()
A number between 0 and 1. A triangle is flat when its flatness is 1.
a()
Length of the side BC
.
Triangle$a()
b()
Length of the side AC
.
Triangle$b()
c()
Length of the side AB
.
Triangle$c()
edges()
The lengths of the sides of the triangle.
Triangle$edges()
A named numeric vector.
perimeter()
Perimeter of the triangle.
Triangle$perimeter()
The perimeter of the triangle.
orientation()
Determine the orientation of the triangle.
Triangle$orientation()
An integer: 1 for counterclockwise, -1 for clockwise, 0 for collinear.
contains()
Determine whether a point lies inside the reference triangle.
Triangle$contains(M)
M
a point
isAcute()
Determines whether the reference triangle is acute.
Triangle$isAcute()
'TRUE' if the triangle is acute (or right), 'FALSE' otherwise.
angleA()
Angle at the vertex A.
Triangle$angleA()
The angle at the vertex A in radians.
angleB()
Angle at the vertex B.
Triangle$angleB()
The angle at the vertex B in radians.
angleC()
Angle at the vertex C.
Triangle$angleC()
The angle at the vertex C in radians.
angles()
The three angles of the triangle.
Triangle$angles()
A named vector containing the values of the angles in radians.
X175()
Isoperimetric point, also known as the X(175) triangle center; this is the center of the outer Soddy circle.
Triangle$X175()
VeldkampIsoperimetricPoint()
Isoperimetric point in the sense of Veldkamp.
Triangle$VeldkampIsoperimetricPoint()
The isoperimetric point in the sense of Veldkamp, if it exists. Otherwise, returns 'NULL'.
centroid()
Centroid.
Triangle$centroid()
orthocenter()
Orthocenter.
Triangle$orthocenter()
area()
Area of the triangle.
Triangle$area()
incircle()
Incircle of the triangle.
Triangle$incircle()
A Circle
object.
inradius()
Inradius of the reference triangle.
Triangle$inradius()
incenter()
Incenter of the reference triangle.
Triangle$incenter()
excircles()
Excircles of the triangle.
Triangle$excircles()
A list with the three excircles, Circle
objects.
excentralTriangle()
Excentral triangle of the reference triangle.
Triangle$excentralTriangle()
A Triangle
object.
BevanPoint()
Bevan point. This is the circumcenter of the excentral triangle.
Triangle$BevanPoint()
medialTriangle()
Medial triangle. Its vertices are the mid-points of the sides of the reference triangle.
Triangle$medialTriangle()
orthicTriangle()
Orthic triangle. Its vertices are the feet of the altitudes of the reference triangle.
Triangle$orthicTriangle()
incentralTriangle()
Incentral triangle.
Triangle$incentralTriangle()
It is the triangle whose vertices are the intersections of the reference triangle's angle bisectors with the respective opposite sides.
A Triangle
object.
NagelTriangle()
Nagel triangle (or extouch triangle) of the reference triangle.
Triangle$NagelTriangle(NagelPoint = FALSE)
NagelPoint
logical, whether to return the Nagel point as attribute
A Triangle
object.
t <- Triangle$new(c(0,-2), c(0.5,1), c(3,0.6)) lineAB <- Line$new(t$A, t$B) lineAC <- Line$new(t$A, t$C) lineBC <- Line$new(t$B, t$C) NagelTriangle <- t$NagelTriangle(NagelPoint = TRUE) NagelPoint <- attr(NagelTriangle, "Nagel point") excircles <- t$excircles() opar <- par(mar = c(0,0,0,0)) plot(0, 0, type="n", asp = 1, xlim = c(-1,5), ylim = c(-3,3), xlab = NA, ylab = NA, axes = FALSE) draw(t, lwd = 2) draw(lineAB); draw(lineAC); draw(lineBC) draw(excircles$A, border = "orange") draw(excircles$B, border = "orange") draw(excircles$C, border = "orange") draw(NagelTriangle, lwd = 2, col = "red") draw(Line$new(t$A, NagelTriangle$A, FALSE, FALSE), col = "blue") draw(Line$new(t$B, NagelTriangle$B, FALSE, FALSE), col = "blue") draw(Line$new(t$C, NagelTriangle$C, FALSE, FALSE), col = "blue") points(rbind(NagelPoint), pch = 19) par(opar)
NagelPoint()
Nagel point of the triangle.
Triangle$NagelPoint()
GergonneTriangle()
Gergonne triangle of the reference triangle.
Triangle$GergonneTriangle(GergonnePoint = FALSE)
GergonnePoint
logical, whether to return the Gergonne point as an attribute
The Gergonne triangle is also known as the intouch triangle or the contact triangle. This is the triangle made of the three tangency points of the incircle.
A Triangle
object.
GergonnePoint()
Gergonne point of the reference triangle.
Triangle$GergonnePoint()
tangentialTriangle()
Tangential triangle of the reference triangle. This is the triangle formed by the lines tangent to the circumcircle of the reference triangle at its vertices. It does not exist for a right triangle.
Triangle$tangentialTriangle()
A Triangle
object.
symmedialTriangle()
Symmedial triangle of the reference triangle.
Triangle$symmedialTriangle()
A Triangle
object.
t <- Triangle$new(c(0,-2), c(0.5,1), c(3,0.6)) symt <- t$symmedialTriangle() symmedianA <- Line$new(t$A, symt$A, FALSE, FALSE) symmedianB <- Line$new(t$B, symt$B, FALSE, FALSE) symmedianC <- Line$new(t$C, symt$C, FALSE, FALSE) K <- t$symmedianPoint() opar <- par(mar = c(0,0,0,0)) plot(NULL, asp = 1, xlim = c(-1,5), ylim = c(-3,3), xlab = NA, ylab = NA, axes = FALSE) draw(t, lwd = 2) draw(symmedianA, lwd = 2, col = "blue") draw(symmedianB, lwd = 2, col = "blue") draw(symmedianC, lwd = 2, col = "blue") points(rbind(K), pch = 19, col = "red") par(opar)
symmedianPoint()
Symmedian point of the reference triangle.
Triangle$symmedianPoint()
A point.
circumcircle()
Circumcircle of the reference triangle.
Triangle$circumcircle()
A Circle
object.
circumcenter()
Circumcenter of the reference triangle.
Triangle$circumcenter()
circumradius()
Circumradius of the reference triangle.
Triangle$circumradius()
BrocardCircle()
The Brocard circle of the reference triangle (also known as the seven-point circle).
Triangle$BrocardCircle()
A Circle
object.
BrocardPoints()
Brocard points of the reference triangle.
Triangle$BrocardPoints()
A list of two points, the first Brocard point and the second Brocard point.
LemoineCircleI()
The first Lemoine circle of the reference triangle.
Triangle$LemoineCircleI()
A Circle
object.
LemoineCircleII()
The second Lemoine circle of the reference triangle (also known as the cosine circle)
Triangle$LemoineCircleII()
A Circle
object.
LemoineTriangle()
The Lemoine triangle of the reference triangle.
Triangle$LemoineTriangle()
A Triangle
object.
LemoineCircleIII()
The third Lemoine circle of the reference triangle.
Triangle$LemoineCircleIII()
A Circle
object.
ParryCircle()
Parry circle of the reference triangle.
Triangle$ParryCircle()
A Circle
object.
outerSoddyCircle()
Soddy outer circle of the reference triangle.
Triangle$outerSoddyCircle()
A Circle
object.
pedalTriangle()
Pedal triangle of a point with respect to the reference
triangle. The pedal triangle of a point P
is the triangle whose
vertices are the feet of the perpendiculars from P
to the sides
of the reference triangle.
Triangle$pedalTriangle(P)
P
a point
A Triangle
object.
CevianTriangle()
Cevian triangle of a point with respect to the reference triangle.
Triangle$CevianTriangle(P)
P
a point
A Triangle
object.
MalfattiCircles()
Malfatti circles of the triangle.
Triangle$MalfattiCircles(tangencyPoints = FALSE)
tangencyPoints
logical, whether to retourn the tangency points of the Malfatti circles as an attribute.
A list with the three Malfatti circles, Circle
objects.
t <- Triangle$new(c(0,0), c(2,0.5), c(1.5,2)) Mcircles <- t$MalfattiCircles(TRUE) plot(NULL, asp = 1, xlim = c(0,2.5), ylim = c(0,2.5), xlab = NA, ylab = NA) grid() draw(t, col = "blue", lwd = 2) invisible(lapply(Mcircles, draw, col = "green", border = "red")) invisible(lapply(attr(Mcircles, "tangencyPoints"), function(P){ points(P[1], P[2], pch = 19) }))
AjimaMalfatti1()
First Ajima-Malfatti point of the triangle.
Triangle$AjimaMalfatti1()
AjimaMalfatti2()
Second Ajima-Malfatti point of the triangle.
Triangle$AjimaMalfatti2()
equalDetourPoint()
Equal detour point of the triangle.
Triangle$equalDetourPoint(detour = FALSE)
detour
logical, whether to return the detour as an attribute
Also known as the X(176) triangle center.
trilinearToPoint()
Point given by trilinear coordinates.
Triangle$trilinearToPoint(x, y, z)
x, y, z
trilinear coordinates
The point with trilinear coordinates x:y:z
with respect to
the reference triangle.
t <- Triangle$new(c(0,0), c(2,1), c(5,7)) incircle <- t$incircle() t$trilinearToPoint(1, 1, 1) incircle$center
pointToTrilinear()
Give the trilinear coordinates of a point with respect to the reference triangle.
Triangle$pointToTrilinear(P)
P
a point
The trilinear coordinates, a numeric vector of length 3.
isogonalConjugate()
Isogonal conjugate of a point with respect to the reference triangle.
Triangle$isogonalConjugate(P)
P
a point
A point, the isogonal conjugate of P
.
rotate()
Rotate the triangle.
Triangle$rotate(alpha, O, degrees = TRUE)
alpha
angle of rotation
O
center of rotation
degrees
logical, whether alpha
is given in degrees
A Triangle
object.
translate()
Translate the triangle.
Triangle$translate(v)
v
the vector of translation
A Triangle
object.
SteinerEllipse()
The Steiner ellipse (or circumellipse) of the reference triangle. This is the ellipse passing through the three vertices of the triangle and centered at the centroid of the triangle.
Triangle$SteinerEllipse()
An Ellipse
object.
t <- Triangle$new(c(0,0), c(2,0.5), c(1.5,2)) ell <- t$SteinerEllipse() plot(NULL, asp = 1, xlim = c(0,2.5), ylim = c(-0.7,2.4), xlab = NA, ylab = NA) draw(t, col = "blue", lwd = 2) draw(ell, border = "red", lwd =2)
SteinerInellipse()
The Steiner inellipse (or midpoint ellipse) of the reference triangle. This is the ellipse tangent to the sides of the triangle at their midpoints, and centered at the centroid of the triangle.
Triangle$SteinerInellipse()
An Ellipse
object.
t <- Triangle$new(c(0,0), c(2,0.5), c(1.5,2)) ell <- t$SteinerInellipse() plot(NULL, asp = 1, xlim = c(0,2.5), ylim = c(-0.1,2.4), xlab = NA, ylab = NA) draw(t, col = "blue", lwd = 2) draw(ell, border = "red", lwd =2)
MandartInellipse()
The Mandart inellipse of the reference triangle. This is the unique ellipse tangent to the triangle's sides at the contact points of its excircles
Triangle$MandartInellipse()
An Ellipse
object.
randomPoints()
Random points on or in the reference triangle.
Triangle$randomPoints(n, where = "in")
n
an integer, the desired number of points
where
"in"
to generate inside the triangle,
"on"
to generate on the sides of the triangle
The generated points in a two columns matrix with n
rows.
hexylTriangle()
Hexyl triangle.
Triangle$hexylTriangle()
plot()
Plot a Triangle
object.
Triangle$plot(add = FALSE, ...)
add
Boolean, whether to add the plot to the current plot
...
named arguments passed to polygon
Nothing, called for plotting only.
trgl <- Triangle$new(c(0, 0), c(1, 0), c(0.5, sqrt(3)/2)) trgl$plot(col = "yellow", border = "red")
clone()
The objects of this class are cloneable with this method.
Triangle$clone(deep = FALSE)
deep
Whether to make a deep clone.
The Steiner ellipse is also the smallest area ellipse which passes
through the vertices of the triangle, and thus can be obtained with
the function EllipseFromThreeBoundaryPoints
. We can also
note that the major axis of the Steiner ellipse is the Deming
least squares line of the three triangle vertices.
TriangleThreeLines
to define a triangle by three lines.
# incircle and excircles
A <- c(0,0); B <- c(1,2); C <- c(3.5,1)
t <- Triangle$new(A, B, C)
incircle <- t$incircle()
excircles <- t$excircles()
JA <- excircles$A$center
JB <- excircles$B$center
JC <- excircles$C$center
JAJBJC <- Triangle$new(JA, JB, JC)
A_JA <- Line$new(A, JA, FALSE, FALSE)
B_JB <- Line$new(B, JB, FALSE, FALSE)
C_JC <- Line$new(C, JC, FALSE, FALSE)
opar <- par(mar = c(0,0,0,0))
plot(NULL, asp = 1, xlim = c(0,6), ylim = c(-4,4),
xlab = NA, ylab = NA, axes = FALSE)
draw(t, lwd = 2)
draw(incircle, border = "orange")
draw(excircles$A); draw(excircles$B); draw(excircles$C)
draw(JAJBJC, col = "blue")
draw(A_JA, col = "green")
draw(B_JB, col = "green")
draw(C_JC, col = "green")
par(opar)
## ------------------------------------------------
## Method `Triangle$new`
## ------------------------------------------------
t <- Triangle$new(c(0,0), c(1,0), c(1,1))
t
t$C
t$C <- c(2,2)
t
## ------------------------------------------------
## Method `Triangle$print`
## ------------------------------------------------
Triangle$new(c(0,0), c(1,0), c(1,1))
## ------------------------------------------------
## Method `Triangle$NagelTriangle`
## ------------------------------------------------
t <- Triangle$new(c(0,-2), c(0.5,1), c(3,0.6))
lineAB <- Line$new(t$A, t$B)
lineAC <- Line$new(t$A, t$C)
lineBC <- Line$new(t$B, t$C)
NagelTriangle <- t$NagelTriangle(NagelPoint = TRUE)
NagelPoint <- attr(NagelTriangle, "Nagel point")
excircles <- t$excircles()
opar <- par(mar = c(0,0,0,0))
plot(0, 0, type="n", asp = 1, xlim = c(-1,5), ylim = c(-3,3),
xlab = NA, ylab = NA, axes = FALSE)
draw(t, lwd = 2)
draw(lineAB); draw(lineAC); draw(lineBC)
draw(excircles$A, border = "orange")
draw(excircles$B, border = "orange")
draw(excircles$C, border = "orange")
draw(NagelTriangle, lwd = 2, col = "red")
draw(Line$new(t$A, NagelTriangle$A, FALSE, FALSE), col = "blue")
draw(Line$new(t$B, NagelTriangle$B, FALSE, FALSE), col = "blue")
draw(Line$new(t$C, NagelTriangle$C, FALSE, FALSE), col = "blue")
points(rbind(NagelPoint), pch = 19)
par(opar)
## ------------------------------------------------
## Method `Triangle$symmedialTriangle`
## ------------------------------------------------
t <- Triangle$new(c(0,-2), c(0.5,1), c(3,0.6))
symt <- t$symmedialTriangle()
symmedianA <- Line$new(t$A, symt$A, FALSE, FALSE)
symmedianB <- Line$new(t$B, symt$B, FALSE, FALSE)
symmedianC <- Line$new(t$C, symt$C, FALSE, FALSE)
K <- t$symmedianPoint()
opar <- par(mar = c(0,0,0,0))
plot(NULL, asp = 1, xlim = c(-1,5), ylim = c(-3,3),
xlab = NA, ylab = NA, axes = FALSE)
draw(t, lwd = 2)
draw(symmedianA, lwd = 2, col = "blue")
draw(symmedianB, lwd = 2, col = "blue")
draw(symmedianC, lwd = 2, col = "blue")
points(rbind(K), pch = 19, col = "red")
par(opar)
## ------------------------------------------------
## Method `Triangle$MalfattiCircles`
## ------------------------------------------------
t <- Triangle$new(c(0,0), c(2,0.5), c(1.5,2))
Mcircles <- t$MalfattiCircles(TRUE)
plot(NULL, asp = 1, xlim = c(0,2.5), ylim = c(0,2.5),
xlab = NA, ylab = NA)
grid()
draw(t, col = "blue", lwd = 2)
invisible(lapply(Mcircles, draw, col = "green", border = "red"))
invisible(lapply(attr(Mcircles, "tangencyPoints"), function(P){
points(P[1], P[2], pch = 19)
}))
## ------------------------------------------------
## Method `Triangle$trilinearToPoint`
## ------------------------------------------------
t <- Triangle$new(c(0,0), c(2,1), c(5,7))
incircle <- t$incircle()
t$trilinearToPoint(1, 1, 1)
incircle$center
## ------------------------------------------------
## Method `Triangle$SteinerEllipse`
## ------------------------------------------------
t <- Triangle$new(c(0,0), c(2,0.5), c(1.5,2))
ell <- t$SteinerEllipse()
plot(NULL, asp = 1, xlim = c(0,2.5), ylim = c(-0.7,2.4),
xlab = NA, ylab = NA)
draw(t, col = "blue", lwd = 2)
draw(ell, border = "red", lwd =2)
## ------------------------------------------------
## Method `Triangle$SteinerInellipse`
## ------------------------------------------------
t <- Triangle$new(c(0,0), c(2,0.5), c(1.5,2))
ell <- t$SteinerInellipse()
plot(NULL, asp = 1, xlim = c(0,2.5), ylim = c(-0.1,2.4),
xlab = NA, ylab = NA)
draw(t, col = "blue", lwd = 2)
draw(ell, border = "red", lwd =2)
## ------------------------------------------------
## Method `Triangle$plot`
## ------------------------------------------------
trgl <- Triangle$new(c(0, 0), c(1, 0), c(0.5, sqrt(3)/2))
trgl$plot(col = "yellow", border = "red")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.