Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Generate the general inellipse of a 2D triangle with specified contact points
| ResourceFunction["Inellipse"][{p1,p2,p3},s,t] returns a 2D Ellipsoid representing the general inellipse of the triangle defined by vertices p1,p2, and p3 given the location s of contact point on segment {p1,p2} and t on {p1,p3}. | |
| ResourceFunction["Inellipse"][{p1,p2,p3},s,t,prop] gives the value of the specified property. | 
| "Ellipsoid" | Ellipsoid representing the inellipse | 
| "Parametric" | parametric equation for the inellipse as a pure function | 
| "Implicit" | implicit Cartesian equation for the inellipse as a pure function | 
| "All" | returns addtional entries to ResourceFunction["EllipseProperties"] | 
| "ContactPoints" | three contact points on the reference triangle | 
| "ConjugateHalfDiameterVectors" | two vectors construct the "Parametric" form | 
| "BrianchonPoint" | the concurrence of three lines joining triangle vertices and contacts | 
 , where s,t and r are the affine location of the three contact points on each side. See "Properties and Relations" for choice of convention following the definition of argument in this function.
, where s,t and r are the affine location of the three contact points on each side. See "Properties and Relations" for choice of convention following the definition of argument in this function.Create the Steiner inellipse (tangent to midpoints) for a given triangle:
| In[1]:= | ![triVtx = {{-1, 0}, {2, 0}, {1.7, 1.8}};
iep = ResourceFunction["Inellipse"][triVtx, 0.5, 0.5]](https://www.wolframcloud.com/obj/resourcesystem/images/01c/01cfaf84-153d-492f-acc3-e2534a16eb3b/70c445d235e56ed6.png) | 
| Out[2]= |  | 
Show it:
| In[3]:= | ![Graphics[{
  {Opacity[0.4], EdgeForm[{Thick, Blue}], Triangle[triVtx]},
  {LightBlue, iep},
  {Black, PointSize[0.02], Point[Mean[#]] & /@ Subsets[triVtx, {2}]}
  }]](https://www.wolframcloud.com/obj/resourcesystem/images/01c/01cfaf84-153d-492f-acc3-e2534a16eb3b/7765e7b5c491102a.png) | 
| Out[3]= |  | 
Find the Cartesian equation for a given triangle:
| In[4]:= | ![triVtx = {{-1, 0}, {2, 0}, {1.7, 1.8}};
iep = ResourceFunction["Inellipse"][triVtx, 0.5, 0.5, "Implicit"]](https://www.wolframcloud.com/obj/resourcesystem/images/01c/01cfaf84-153d-492f-acc3-e2534a16eb3b/5937f9c405121075.png) | 
| Out[5]= |  | 
Find parametric form for an inellipse:
| In[6]:= |  | 
| In[7]:= | ![iep = ResourceFunction["Inellipse"][triVtx, 0.5, 0.4];
iepFunc = ResourceFunction["Inellipse"][triVtx, 0.5, 0.4, "Parametric"]](https://www.wolframcloud.com/obj/resourcesystem/images/01c/01cfaf84-153d-492f-acc3-e2534a16eb3b/3c64e05207f40785.png) | 
| Out[8]= |  | 
Lay the points from parametric function over the circumference of in-ellipsoid:
| In[9]:= | ![pts = Point@Map[iepFunc, Subdivide[-Pi, Pi, 24]];
Graphics[{
  {Opacity[0.4], EdgeForm[{Thick, Blue}], Triangle[triVtx]},
  {LightBlue, iep},
  {Black, PointSize[0.015], pts}
  }]](https://www.wolframcloud.com/obj/resourcesystem/images/01c/01cfaf84-153d-492f-acc3-e2534a16eb3b/675fd4dd5db56022.png) | 
| Out[10]= |  | 
Find all documented properties of an inellipse:
| In[11]:= | ![triVtx = {{-1, 0}, {2, 0}, {1.7, 1.8}};
iepp = ResourceFunction["Inellipse"][triVtx, 0.3, 0.4, "All"];
Dataset[{iepp}]](https://www.wolframcloud.com/obj/resourcesystem/images/01c/01cfaf84-153d-492f-acc3-e2534a16eb3b/478351bf89e6b08d.png) | 
| Out[12]= |  | 
Use Ceva's theorem to find the third contact point r:
| In[13]:= | ![triVtx = {{-1, 0}, {2, 0}, {1.7, 1.8}};
iep = ResourceFunction["Inellipse"][triVtx, 0.3, 0.4];](https://www.wolframcloud.com/obj/resourcesystem/images/01c/01cfaf84-153d-492f-acc3-e2534a16eb3b/4047adee9be483da.png) | 
| In[14]:= | ![contact3 = NSolveValues[.3/(1 - .3)*r/(1 - r)*(1 - .4)/.4 == 1, r][[1]];](https://www.wolframcloud.com/obj/resourcesystem/images/01c/01cfaf84-153d-492f-acc3-e2534a16eb3b/4a15540754a69644.png) | 
| In[15]:= | ![contacts = MapThread[#1 /. #2 &, {
    ListConvolve[{{\[Lambda]}, {1 - \[Lambda]}}, Append[triVtx, triVtx[[1]]]],
    {\[Lambda] -> .3, \[Lambda] -> contact3, \[Lambda] -> 1 - .4}}];](https://www.wolframcloud.com/obj/resourcesystem/images/01c/01cfaf84-153d-492f-acc3-e2534a16eb3b/157f73c4584d581c.png) | 
| In[16]:= | ![Graphics[{
  {Opacity[0.4], EdgeForm[{Thick, Blue}], Triangle[triVtx]},
  {LightBlue, iep},
  {Black, PointSize[0.02], Point[contacts]}
  }]](https://www.wolframcloud.com/obj/resourcesystem/images/01c/01cfaf84-153d-492f-acc3-e2534a16eb3b/0a66a2370f4433af.png) | 
| Out[16]= |  | 
Inellipse function returns unevaluated for degenerated triangle:
| In[17]:= | ![ResourceFunction["Inellipse"][{{1, 0}, {2, 0}, {3, 0}}, 0.2, 0.3]](https://www.wolframcloud.com/obj/resourcesystem/images/01c/01cfaf84-153d-492f-acc3-e2534a16eb3b/64c3cc0f150d6514.png) | 
| Out[17]= |  | 
Inellipse function returns unevaluated for degenerated ellipse:
| In[18]:= | ![ResourceFunction["Inellipse"][{{1, 0}, {2, 0}, {3, 3}}, 0, 0.3]](https://www.wolframcloud.com/obj/resourcesystem/images/01c/01cfaf84-153d-492f-acc3-e2534a16eb3b/1f5fda77a76581fb.png) | 
| Out[18]= |  | 
| In[19]:= | ![ResourceFunction["Inellipse"][{{1, 0}, {2, 0}, {3, 3}}, 1, 1]](https://www.wolframcloud.com/obj/resourcesystem/images/01c/01cfaf84-153d-492f-acc3-e2534a16eb3b/4ae51b653f936ecd.png) | 
| Out[19]= |  | 
Inellipse function returns unevaluated for symbolic expression:
| In[20]:= | ![ResourceFunction[
 "Inellipse"][{{1, 0}, {\[FormalV], 0}, {3, 3}}, 0, 0.3]](https://www.wolframcloud.com/obj/resourcesystem/images/01c/01cfaf84-153d-492f-acc3-e2534a16eb3b/357200979c0a3f38.png) | 
| Out[20]= |  | 
| In[21]:= | ![ResourceFunction[
 "Inellipse"][{{1, 0}, {2, 0}, {3, 3}}, .3, \[FormalV]]](https://www.wolframcloud.com/obj/resourcesystem/images/01c/01cfaf84-153d-492f-acc3-e2534a16eb3b/0890a15a46eac40b.png) | 
| Out[21]= |  | 
Inellipse function returns unevaluated for unsupported properties:
| In[22]:= | ![ResourceFunction[
 "Inellipse"][{{1, 0}, {2, 0}, {3, 3}}, .3, .5, "InvalidProperty"]](https://www.wolframcloud.com/obj/resourcesystem/images/01c/01cfaf84-153d-492f-acc3-e2534a16eb3b/324c58159398805e.png) | 
| Out[22]= |  | 
Mutually touching inellipses of a triangle:
| In[23]:= |  | 
| In[24]:= | ![iep = ResourceFunction["Inellipse"][triVtx, 0.4, #, "Implicit"] & /@ Range[0.2, 0.8, 0.1];](https://www.wolframcloud.com/obj/resourcesystem/images/01c/01cfaf84-153d-492f-acc3-e2534a16eb3b/7a832d3e28efb6fc.png) | 
| In[25]:= | ![ContourPlot[iep, {\[FormalX], -1, 2}, {\[FormalY], -0.1, 2.5},
 Prolog -> {Triangle[triVtx]},
 AspectRatio -> 1/1.5, Frame -> False]](https://www.wolframcloud.com/obj/resourcesystem/images/01c/01cfaf84-153d-492f-acc3-e2534a16eb3b/1c178fe5aba5635d.png) | 
| Out[25]= |  | 
Mandart inellipse and excircles. The Brianchon point K of Mandart inellipse is the Nagel point:
| In[26]:= | ![triVtx = {{-1, 0}, {2, 0}, {0.2, 2.1}};
vtxPair = Partition[Append[triVtx, triVtx[[1]]], 2, 1];
sideLen = EuclideanDistance[#1, #2] & @@@ vtxPair;
s = (sideLen[[1]] - sideLen[[3]] + sideLen[[2]])/(2*sideLen[[1]]);
t = (-sideLen[[1]] + sideLen[[3]] + sideLen[[2]])/(2*sideLen[[3]]);](https://www.wolframcloud.com/obj/resourcesystem/images/01c/01cfaf84-153d-492f-acc3-e2534a16eb3b/62e090b3a6b66107.png) | 
Compare the coordinate of K and that of Nagel point:
| In[27]:= | ![ResourceFunction["Inellipse"][triVtx, s, t, "All"]["BrianchonPoint"]](https://www.wolframcloud.com/obj/resourcesystem/images/01c/01cfaf84-153d-492f-acc3-e2534a16eb3b/649d8cb6ea54c3ec.png) | 
| Out[27]= |  | 
| In[28]:= | ![na = ResourceFunction["NagelPoint"][triVtx];
na[[1]]](https://www.wolframcloud.com/obj/resourcesystem/images/01c/01cfaf84-153d-492f-acc3-e2534a16eb3b/25ba79743def825c.png) | 
| Out[29]= |  | 
Visualize their positions with Mandart inellipse, the reference triangle and three excircles:
| In[30]:= | ![iep = ResourceFunction["Inellipse"][triVtx, s, t];
Graphics[
  {{Gray, InfiniteLine /@ vtxPair},
   {EdgeForm[{Thick, Orange}], Opacity[0.1], Triangle[triVtx]},
   {EdgeForm[{Thick, Blue}], Cyan, iep},
   TriangleConstruct[triVtx, {"Excircle", #}] & /@ triVtx,
   {Thin, Blue, HalfLine[{triVtx[[#]], na[[1]]}] & /@ {1, 2, 3}},
   {PointSize[Scaled[0.06]], Hue[0.58, 1, 1], na, Text[Style["Na", White, FontSize -> Scaled[0.03]], Part[na, 1]]}
   }, PlotRange -> {{-1.5, 2.5}, {-1.5, 2.5}}] // Framed](https://www.wolframcloud.com/obj/resourcesystem/images/01c/01cfaf84-153d-492f-acc3-e2534a16eb3b/686104f883bf01de.png) | 
| Out[31]= |  | 
Wolfram Language 13.0 (December 2021) or above
This work is licensed under a Creative Commons Attribution 4.0 International License