In[]:=
AjimaMalfattiPoints::usage="Within a triangle are three tangent circles to each other and on two sides of the triangle. The lines that go from each vertex passing through the tangent point of each pair of circumferences, are concurrent and intersect at the first point of Ajima-Malfatti (​
X
179
​). The lines that go from each excenter through the tangent point of each pair of circles, are concurrent and intersect at the second point of Ajima Malfatti (​
X
180
​). References: Wolfram MathWorld: Ajima-Malfatti Points, Malfatti Circles; ETC; Personal.";​​​​AjimaMalfattiPoints[tri={{x1_,y1_},{x2_,y2_},{x3_,y3_}}]:=​​Module{},DEP=Det[{{x1,y1,1},{x2,y2,1},{x3,y3,1}}];​​​​IfDEP==0,Print[PasteButton["The points do not form a triangle"]],​​aa=
2
(x3-x2)
+
2
(y3-y2)
;bb=
2
(x3-x1)
+
2
(y3-y1)
;cc1=
2
(x2-x1)
+
2
(y2-y1)
;​​​​μ=TriangleCenter[tri,{"Excenter",{x1,y1}}];​​xex1=μ[[1]];​​yex1=μ[[2]];​​η=TriangleCenter[tri,{"Excenter",{x2,y2}}];​​xex2=η[[1]];​​yex2=η[[2]];​​σ=TriangleCenter[tri,{"Excenter",{x3,y3}}];​​xex3=σ[[1]];​​yex3=σ[[2]];​​​​​​α=ArcCos
2
bb
+
2
cc1
-
2
aa
2bbcc1
;β=ArcCos
2
aa
+
2
cc1
-
2
bb
2aacc1
;γ=ArcCos
2
aa
+
2
bb
-
2
cc1
2aabb
;​​​​xx=Sin[α]
4
Sec
α
4

;yy=Sin[β]
4
Sec
β
4

;zz=Sin[γ]
4
Sec
γ
4

;​​
λ
1
=
xx
xx+yy+zz
;
λ
2
=
yy
xx+yy+zz
;
λ
3
=
zz
xx+yy+zz
;​​X179=
λ
1
{x1,y1}+
λ
2
{x2,y2}+
λ
3
{x3,y3};​​xX179=Take[X179,{1}].{1};yX179=Take[X179,{2}].{1};​​tabc=1+2
2
Sec
α
4
Cos
β
4
Cos
γ
4

;tbca=1+2
2
Sec
β
4
Cos
γ
4
Cos
α
4

;tcba=1+2
2
Sec
γ
4
Cos
β
4
Cos
α
4

;​​tacb=1+2
2
Sec
α
4
Cos
γ
4
Cos
β
4

;​​tcab=1+2
2
Sec
γ
4
Cos
α
4
Cos
β
4

;​​tbac=1+2
2
Sec
β
4
Cos
α
4
Cos
γ
4

;​​xx1=aa
1
tbca
+
1
tcba
-
1
tacb
;yy1=bb
1
tcab
+
1
tacb
-
1
tbac
;zz1=cc1
1
tabc
+
1
tbac
-
1
tcba
;​​
λ
4
=
xx1
xx1+yy1+zz1
;
λ
5
=
yy1
xx1+yy1+zz1
;
λ
6
=
zz1
xx1+yy1+zz1
;​​X180=
λ
4
{x1,y1}+
λ
5
{x2,y2}+
λ
6
{x3,y3};​​xX180=Take[X180,{1}].{1};yX180=Take[X180,{2}].{1};​​Speak["Coordinates of the Ajima-Malfatti points:"];​​Print[" "];​​xn2=N[xX179];yn2=N[yX179];​​xp3=N[xX180];yp3=N[yX180];​​w=Grid[{{AjimaMalfatti1,AjimaMalfatti2},{{xn2,yn2},{xp3,yp3}}},FrameAll];​​Print[w];​​Print[" "];​​circ=ResourceFunction["MalfattiCircles"][{{x1,y1},{x2,y2},{x3,y3}}];​​g1=Point[{xX179,yX179}];​​g2=Point[{xX180,yX180}];​​g3=InfiniteLine[{{x1,y1},{xX179,yX179}}];​​g4=InfiniteLine[{{x2,y2},{xX179,yX179}}];g5=InfiniteLine[{{x3,y3},{xX179,yX179}}];​​g6=InfiniteLine[{{xex1,yex1},{xX180,yX180}}];​​g7=InfiniteLine[{{xex2,yex2},{xX180,yX180}}];g8=InfiniteLine[{{xex3,yex3},{xX180,yX180}}];​​g9=Line[{{x1,y1},{x2,y2},{x3,y3},{x1,y1}}];​​g10=Point[{x1,y1}];g11=Point[{x2,y2}];g12=Point[{x3,y3}];​​SwatchLegend[{Red,Brown,Black,Purple},{"Ajima-Malfatti points","Tangent crcumferences to each other and on two sides of the triangle","In the first point of Ajima-Malfatti, the lines go from each vertex through the tangent point of each pair of circumferences","In the second point of Ajima-Malfatti, the lines go from each excenter through the tangent point of each pair of circumferences"}]​​Show[{Graphics[{Brown,circ}],Graphics[{Red,Thick,PointSize[0.018],g1}],Graphics[{Black,Dashed,g3}],Graphics[{Black,Dashed,g4}],Graphics[{Black,Dashed,g5}],Graphics[{Blue,g9}],Graphics[{Black,PointSize[0.018],g10}],Graphics[{Black,PointSize[0.018],g11}],Graphics[{Black,PointSize[0.018],g12}]},AxesTrue,AxesOrigin{0,0},AspectRatioAutomatic,ImageSize500,PlotLabelStyle[Framed["The first point Ajima-Malfatti"],16,Blue,BackgroundYellow]]​​​​Show[{Graphics[{Brown,circ}],Graphics[{Red,Thick,PointSize[0.018],g2}],Graphics[{Purple,Dashed,g6}],Graphics[{Purple,Dashed,g7}],Graphics[{Purple,Dashed,g8}],Graphics[{Blue,g9}],Graphics[{Black,PointSize[0.018],g10}],Graphics[{Black,PointSize[0.018],g11}],Graphics[{Black,PointSize[0.018],g12}]},AxesTrue,AxesOrigin{0,0},AspectRatioAutomatic,ImageSize500,PlotLabelStyle[Framed["The second point of Ajima-Malfatti"],16,Blue,BackgroundYellow]]​​​​​​​​
In the command below, type the new coordinates of the points. Evaluate the notebook.
In[]:=
AjimaMalfattiPoints[tri={{-2,5},{7,12},{9,-4}}]
AjimaMalfatti1
AjimaMalfatti2
{3.7588,5.07222}
{3.67427,5.12657}
Out[]=
Ajima-Malfatti points
Tangent crcumferences to each other and on two sides of the triangle
In the first point of Ajima-Malfatti, the lines go from each vertex through the tangent point of each pair of circumferences
In the second point of Ajima-Malfatti, the lines go from each excenter through the tangent point of each pair of circumferences