Below, you see a triangle in which the incircle was inscribed. As we know, the center of this circle is the intersection of the angle bisectors. At this point, one could go further and find the points, where each of the angle bisectors intersect with the circle and create a tangent of the circle which will divide three new triangles from the big one. Each of the new triangles has again an incircle which can be created and cutting (from now on) only one triangle from each new one and repeating this process brings us to the picture:

First question: Is it possible create this figure in Mathematica? Unfortunately, I have no clue and cannot provide some code myself, but I have asked a similar question at TeX.SE and got some pretty nice answers.

What I would like to do in the end is not only to create the figure; I want to shoot random points at the figure and want to find out where the points hit the figure in a circle or not.

I would be delighted to hear some ideas or if possible to collect sample code for my problem.

@belisarius They are perfectly fitted for computers! The problem is you, because either you get bored waiting for the answer or you die of exhaustion when running back and forth to the computer store to buy more memory :-)
–
halirutanFeb 22 '14 at 1:09

@belisarius what about instead of ad-infinitum just a practical amount of recursion? Like until it cannot be readily seen by the naked eye.
–
David CaliriFeb 22 '14 at 1:10

1

@belisarius. I failed it, too, but I don't know where I fit into the ordering of those who have.
–
m_goldbergFeb 22 '14 at 1:28

2

It's much more clear to state the problem as calculating the ratio of area of the triangle and sum of areas of circles, which obviously form three convergent geometric series of circle areas around a incircle. Frankly, this sounds more like an elementary geometry than Mathematica question. Technically, you can formulate an equation that would perform test even for infinite amount of circles, but this sounds... quite awkward.
–
kirmaFeb 22 '14 at 9:01

2 Answers
2

Since this is rather long, some might prefer a teaser of what is coming:

Introduction

First of all, I don't really know why you make your figure inconsistent. I mean, from the first big triangle you separate three smaller triangles. Why don't you just repeat this process and inscribe a circle in each of the new triangles and again separate three new triangles from their corners?

I will show you how to do that and additionally, how you can create your figure. Depending on your experience some of the code might be a bit harder to read. The solution is that you take my code only as reference and re-implement everything in your own style. Nevertheless, I will use two kinds of data structure: triangle[{a,b,c}] is a triangle having the corner points a,b, and c. Please be aware that this is not a function! It will never do something, it just stays as it is and indicates that we work with a triangle. The same is true for circle[cent,r].

When we divide a triangle into its circle and its sub-triangles, we will change structure from

With this approach we keep all our triangles in a tree-like structure and it is really easy to work our way from the biggest triangle deeper and deeper to the smallest parts.

Building the triangle/circle structure to a certain depth

First, we need to do the hard part, which is thinking about how you can compute the inscribed circle of a triangle when you have given the three points of it. This is pure geometry and the necessary calculations can be either looked up or you can make a small sketch and do it by hand. The following function takes a triangle and returns {{cx,cy}, r} where cx, cy is the center of the circle and r its radius:

This function will be used in the next routine where we divide a given triangle into 3 new triangles and its incircle. Again, the calculation of the points where the new triangles are split from the bigger one is pure geometry, depends on the center and radius of the incircle and you probably should do the calculation for this by yourself. The key to the triangle split is given in the Function[{a,b,c},...] part. As result of this function you will get a triangle-circle-children mix as I have showed it in my second code block:

Let's test the stuff we have so far. I will take an example triangle and divide it exactly one time. Be aware that when you use exact integer coordinates, than Mathematica will calculate exact points which will pretty soon blow your machine because of the large roots. I will use machine numbers here:

It seems to do something. Let's create some graphical output to see whether this is useful.

Creating graphical output from the triangle structure

Let's start with the easy part which is to decide how exactly a triangle and a circle should look like. For this I make two functions drawTriangle and drawCircle. Since I want to color the the parts differently when they get smaller, these functions will have depth parameter which tells them how deep in the triangle structure we are. Therefore, the next functions draw exactly one triangle/circle and they have the knowledge how small (or deep) they are. Note that I only provide the points to of the triangles/circles to these functions:

The next part is the fun part because showTree will draw (actually: create graphics primitives) a triangle structure completely by itself by walking through it and drawing all triangles/circles it finds. How is that possible? Very easy (ignore the first definition line, it only calculates the maxDepth at the beginning): When you want to draw a structure like we have

we draw a triangle {a,b,c}, then we draw a circle {cent,r} and then we start over with the exact same procedure for all child triangles, because they themselves will again have triangle coordinates, an inscircle and child-triangles. That`s it. When we see a triangle which has no incircle, we know this is the smallest one (because we haven't sub-divided it) and there we stop.

Your kind of figure

If you want the figure you have presented, the only thing you need to do is stop the complete sub-division of the triangles after the first step and only subdivide the smaller triangles into one smaller triangle. We can implement this by adjusting the divide and buildTree function into

Shooting points at a figure

Your last question was whether it is possible to test certain random points whether or not they hit a circle. If you have read and understand the showTree function, in particular how it walks by itself through the triangle-structure to draw it, you will understand the next easily, because it is exactly the same approach.

Let's say you want to test a random point p, then you start with the biggest (outer) triangle. p has to lie inside this triangle, otherwise p is outside the whole figure. So you test whether p is in the triangle and you test whether or not p is in the incircle of the biggest triangle. If this is not the case, then you have only a two possibilities:

p is in one of the smaller sub-triangles

p is in none of the smaller sub-triangles

In the first case, you know that now you have to test the sub-triangle where p is in with the exact same approach. In the second case, you instantly know that p must lie anywhere in the rest area of the bigger triangle, because it is not in the circle and not in the sub-triangles.

There is one last possibility you have to prepare for: When your triangle looks like triangle[{a,b,c}] then you know you have reached the smallest level of resolution and (if you use a fixed triangle tree) you cannot tell whether it is in the incircle of this triangle because you simply haven't sub-divided it. Then, your outcome is unknown. Let me point out, that it is really easy to implement a dynamically growing triangle structure which sub-divides further when you reach the highest resolution without a definitive result.

Since this article is already far too long, I will not show how to do this here. Nevertheless, if you understood that the following hitTest function walks your structure exactly the same way as your showTree function, the only thing which is left is to implement two routines which help you to test whether or not a point is inside a triangle or circle.

The following hitTest gives you back the triangle or circle the point is in, $Failed if the point is completely outside the structure and $Failed[triangle[..]] if you have reached on of the smallest triangles and you cannot determine whether it is in its incircle:

Shooting points at the diagram and determining the fraction inside
any of the nested circles may be the beginnings of a Monte Carlo
determination of the area fraction of the infinite series of circles.

If so (and it's probably a very big if), consider the triangle with side lengths $a$, $b$, $c$. The inradius $r$ of the incircle is

$r = \sqrt{(a+b-c)(a-b+c)(-a+b+c)/(a+b+c)} / 2$

Set $d_1$ equal to the length of the line segment from vertex 1, through the
incentre, to the far side of the incircle, which it intersects
perpendicularly. Similarly for $d_2$ and $d_3$. The total area of all
three infinite series of circles is

Mathematica is a registered trademark of Wolfram Research, Inc. While the mark is used herein with the limited permission of Wolfram Research, Stack Exchange and this site disclaim all affiliation therewith.