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 (). 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 (). 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}}];IfDEP==0,Print[PasteButton["The points do not form a triangle"]],aa=+;bb=+;cc1=+;μ=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+-;β=ArcCos+-;γ=ArcCos+-;xx=Sin[α];yy=Sin[β];zz=Sin[γ];=;=;=;X179={x1,y1}+{x2,y2}+{x3,y3};xX179=Take[X179,{1}].{1};yX179=Take[X179,{2}].{1};tabc=1+2;tbca=1+2;tcba=1+2;tacb=1+2;tcab=1+2;tbac=1+2;xx1=aa+-;yy1=bb+-;zz1=cc1+-;=;=;=;X180={x1,y1}+{x2,y2}+{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}}},FrameAll];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}]},AxesTrue,AxesOrigin{0,0},AspectRatioAutomatic,ImageSize500,PlotLabelStyle[Framed["The first point Ajima-Malfatti"],16,Blue,BackgroundYellow]]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}]},AxesTrue,AxesOrigin{0,0},AspectRatioAutomatic,ImageSize500,PlotLabelStyle[Framed["The second point of Ajima-Malfatti"],16,Blue,BackgroundYellow]]
X
179
X
180
2
(x3-x2)
2
(y3-y2)
2
(x3-x1)
2
(y3-y1)
2
(x2-x1)
2
(y2-y1)
2
bb
2
cc1
2
aa
2bbcc1
2
aa
2
cc1
2
bb
2aacc1
2
aa
2
bb
2
cc1
2aabb
4
Sec
α
4
4
Sec
β
4
4
Sec
γ
4
λ
1
xx
xx+yy+zz
λ
2
yy
xx+yy+zz
λ
3
zz
xx+yy+zz
λ
1
λ
2
λ
3
2
SecCosCos
α
4
β
4
γ
4
2
SecCosCos
β
4
γ
4
α
4
2
SecCosCos
γ
4
β
4
α
4
2
SecCosCos
α
4
γ
4
β
4
2
SecCosCos
γ
4
α
4
β
4
2
SecCosCos
β
4
α
4
γ
4
1
tbca
1
tcba
1
tacb
1
tcab
1
tacb
1
tbac
1
tabc
1
tbac
1
tcba
λ
4
xx1
xx1+yy1+zz1
λ
5
yy1
xx1+yy1+zz1
λ
6
zz1
xx1+yy1+zz1
λ
4
λ
5
λ
6
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[]=