Our aim is to find circles inside a triangle, where there are specified tangency constraints between these circles and the three sides of the triangle. We use a tangency graph to show the tangency constraints. Consider a graph G (V, E), where V corresponds to the vertices that represent the circles or the sides of the triangles and E represents the edges connecting the vertices. When an edge connects two vertices, this means that these two geometric objects are tangent to each other. That is, the circle is externally tangent to the circle if these two geometric objects are circles or if the circle is tangent to the side of the triangle. When a circle is tangent to two, one, or zero sides of a triangle, we refer to it as a corner circle, edge circle, or inner circle, respectively.
The main concept of the new proposed algorithm is to generate a tangency graph, to find solution radii for all circles that satisfy the constraints specified by the tangency graph, and then to display them. The purpose of this algorithm is to find circles with a small range of radii. At the start of the process, it is necessary to set a real number r, with the aim of generating circles inside the triangle that have a radius near r. Our proposed algorithm comprises four parts, including data inputting, the generation of a tangency graph, the use of Chiang’s algorithm, and result generation.
Steps one and two are the inputs of the algorithm; steps three, four, five, and six generate the tangency graph of this problem; and step seven involves the use of Chiang’s algorithm to find the solution for the tangency graph. The final step involves displaying the results.
We will describe the above algorithm in more detail, including the solution to the following four problems:
2.1. Offset a Triangle
Consider three different terms—line, ray, and line segment. There is no endpoint for a line, one endpoint for a ray, and two endpoints for a line segment. Consider the parametric forms of a line, ray, and line segment passing through two points, P1 and P2; these parametric forms are the same (1 − t) P1 + tP2 with different parameter ranges. There is a line, ray, and line segment when t∈R, t ≥ 0, and 0 ≤ t ≤ 1, respectively. Note that the ray has P1 as its endpoint, denoted as Ray(P1, P2); with the orientation of Ray(P1, P2), we can define the left side and the right side of Ray(P1, P2). Let L = Ray(P1, P2); we denote the point P1′ as the point moving P1 to the left side of the Ray(P1, P2) R distance, and we denote P1′ = Move(P1, L, R). Ray(P1′, P2′), also denoted as Rayr(P1, P2), is referred to as the R-offset of Ray(P1,P2).
Before providing a detailed description of the proposed algorithm, we present the following theorem:
Theorem 1. R-offset of a ray. Given Rayr (P1, P2), where P1 = (x1, y1) and P2 = (x2, y2), the parametric form of Rayr(P1, P2) is (1 − t)P1 + tP2 + r × nL, , where nL = (, ). The implicit form for the line cover Rayr(P1, P2) is a′x + b′y + c′ = 0, where a′ = (y2 − y1), b′ = (x1 − x2), and c′ = .
Proof of Theorem 1. The direction of the ray is P2 − P1 = . The two vectors nL = and nR = are perpendicular to P2-P1. These two vectors point to the left (nL) and the right (nR). We can move points on Ray(P1, P2) along the nL direction R distance; therefore, the parametric form for Rayr (P1, P2) is (1 − t) P1 + tP2 + R × nL. Consider two points, P1′ and P2′, which are points P1 and P2, moving to left side of Ray(P1, P2); that is, Pi′ = (xi′,yi′) = Pi + R × nL, I = 1, 2. The implicit form for Ray(P1, P2) is ax + by + c = 0, where a = y2 − y1, b = x1 − x2, and c = . Let the R-offset of Ray(P1, P2) be denoted as Rayr(P1, P2) = a′x + b′y + c′ = 0, where a′ = y2′ − y1′ = a, b′ = x1′ − x2′ = b, and c′ = = . Thus, the implicit form of Rayr(P1, P2) is (y2 − y1)x + (x1 − x2)y − + = 0. □
Example 1. Given two points, P1 = (1, 1) and P2 = (5, 2), let L = Ray1 (P1, P2). The points P1′ = Move(P1, L, 1) = (0.757, 1.970), and P2′ = Move(P2, L, 1) = (4.757, 2.970). In Figure 9, L is shown in blue with implicit form x + 4y + 3 = 0. Furthermore, Ray1(P1,P2) = Ray(P1′, P2′) is shown in orange with implicit form x + 4y + 7.123 = 0. So, Ray1(P1, P2) is the 1-offset of the ray from P1 to P2, and Ray(P1′, P2′) is the ray from P1′ to P2′; they are the same ray because P1′ and P2′ are the points that move P1, P2 to the left side of the ray from P1 to P2 for a distance equal to one. We refer to Ray(P1′, P2′) as the R-offset of Ray(P1, P2).
The following theorem is taken directly from [
21].
Theorem 2. Intersection of two lines from four points [11]. Given four points, P1 (x1, y1), P2 (x2, y2), P3 (x3, y3), and P4 (x4, y4), there are two lines, L1 and L2, where L1 passes through P1, P2, and L2 passes through P3, P4. Then, if , L1, L2 are parallel to each other. Otherwise, these two lines intersect each other at (x,y), where Theorem 3. Intersection of two R-offset rays from three points. Given Ray(P1, P2) and Ray(P2, P3), where Pi = (xi,yi) and I = 1, 2, 3, the intersection of Rayr(P1, P2) and Rayr(P2, P3) is (x, y) = () if ≠ 0, where Proof of Theorem 3. Let L1 = Ray(P1, P2), L2 = Ray(P2, P3), L3 = Rayr(P1, P2), and L4 = Rayr(P2, P3). Let P1′ = Move(P1, L1, r), P2′ = Move(P2, L1, r), P3′ = Move(P2, L2, r), and P4′ = Move(P3, L2, r); then, P1′ = P1 + r × n12, P2′ = P2 + r × n12, P3′ = P2 + r × n23, and P4′ = P3 + r × n23, where n12 = and n23 = (,. The proof can be easily derived using Theorem 2 with the following four points—P1′, P2′, P3′, and P4′. □
The intersection P(x, y) = () when .
Example 2. Given three points, P1 = (1, 1), P2 = (10, 2), and P3 = (3, 5), P1′ = (0.889, 1.993), P2′ = (9.889, 2.993), P3′ = (9.606, 1.080), and P4′ = (2.606, 4.080). The intersection point P for Ray1(P1, P2) and Ray1(P2, P3) is at (6.119, 2.575), as shown in Figure 10. We denote P = Ray1(P1, P2) ∩ Ray1(P2, P3).
From △ABC, we can find three points—B′ = Rayr(A,B) ∩ Rayr(B,C), C′ = Rayr(B,C) ∩ Rayr(C,A), and A′ = Rayr(C,A) ∩ Rayr(A,B). △A′B′C′ is referred to as the R-offset triangle for △ABC.
Example 3. Given A = (1, 1), B = (10, 2), and C = (3, 5), the 1-offset triangle for ΔABC is a triangle with vertices A′ = (2.716, 2.196), B′ = (6.119,2.575), and C′ = (3.472, 3.709); see Figure 11. 2.2. How to Construct Vertices and Edges on the Same Layer
The primary purpose of the proposed algorithm is to generate the tangency graph G (V, E) to ensure that circles in the triangle have a small range of radii. Thus, it was necessary to generate the vertices, as well as the edges that connect the vertices. We generated the vertices layer by layer and generated the edges for the same layer, as well as the edges that connect two consecutive layers. Given a triangle △ABC and circles with radius r, where r is much smaller than the shortest length of three sides of the triangle, and given that △A′B′C′ is the R-offset of △ABC, then the circles centered at the sides of △A′B′C′ with radius r are tangent to △ABC. At this stage, our aim is to find the vertices on edge A’B’ (steps one to three in the following description) and △A′B′C′ (steps four and five). Furthermore, the edges of these two consecutive layers, △ABC and △A′B′C′, must be generated (step six).
Find
n circles with radius
r’, where
r’ is close to
r, so that these circles can be lined up tangent to two circles on the vertices
A’ and
B’ with radius
r, as shown in
Figure 12. That is, find integer
n and
r′ so that |
r − r′| is at a minimum and 2(
r +
n ∗ r′) is equal to the length of
A′B′.
All centers of the circles shown in
Figure 12b are the vertices belonging to
V.
Connect two consecutive vertices in
Figure 12b belonging to
E.
It is also necessary to carry out these four steps for B’C’ and C’A’ to generate more vertices and edges for the graph G(V,E).
Connect two neighbors of the vertices of △A′B′C′.
Connect edges from
to
, from
to
and from
to
(described in
Section 2.3)
Using the above approach, starting from △ABC, the 1-offset of △ABC is T
1 (△A′B′C′); the vertices and edges for T
1 are shown in
Figure 13a. Note that the three vertices of triangle T
1 have a circle center at these three vertices with radius r tangent to △ABC.
Next, consider triangle T
2, which is the
R-offset of T
1. The method used for generating vertices and edges for T
2 is identical to the method used to generate vertices and edges for T
1. Thereafter, we generate edges between vertices in T
1 and vertices in T
2 (which will be described in the following section), with the tangency graph shown in
Figure 13b.
2.3. How to Construct Edges on Two Consecutive Layers
The next step in the process involves generating edges between the vertices on T1 and the vertices on T2. Before we explain our strategy to connect the vertices on these two triangles, we present the following theorem.
Theorem 4. Find the foot point of a point onto a line. Given a point g (x3, y3) and a line L (g∉L) passing through two points, (x1, y1) and (x2, y2), the nearest point, also called the foot point, of g onto L is at , as shown in Figure 14.
Proof of Theorem 4. With a point (x,y) on L, we can generate the square of the distance function from (x,y) to point g, as follows: f(t) = = . We aim to find the value t at which f(x) is the minimum; that is, . The parameter value t can be computed from □
Consider the correspondence edge
on T
1 and
on T
2. Assume the parameter values for the vertices on
are t
0, t
1, …, t
m, and the parameter values for the foot points of vertices on
onto
are t
0′, t
1′, …, t
n′. We explain the details with
m = 7 and
n = 3, as shown in
Figure 15. To simplify our description, we use the parameter values as the vertex name hereafter. The vertices t
0 and t
7 are the vertices on
; at this point, no vertices on
(T
2) are connected. When we construct edges for △A′B′C′, we construct one edge from t
1 to the last vertex on
and from t
6 to the first vertex on
. Next, it was necessary to construct the edges for t
i, I = 1…, 6 and t
j′, j = 0, 3. We used the following approach to connect edges between vertices generated on T
1 and T
2. Note that we tried to connect vertices in
to the vertices close to it in
. We employed the same process for vertices in
to the vertices close to it in
, as well as for vertices in
to the vertices close to it in
.
We define the floor and ceiling for the vertices as follows:
where. With the above definition, we connect vertices
to all vertices from
= 0, …,
n. Therefore, in
Figure 15,
connects vertices from
= t
1 to
= t
2, and
connects vertices from
= t
4 to
= t
6. Therefore, the vertex with parameter
has three edges connected to the vertices on
.
The results following the connection of the edges between
T1 and T
2 are shown in
Figure 13b. We continued to generate vertices on
T3 = R-offset(T2) and
T4 = R-offset(T3) and generated vertices and edges for the tangency graph
G(V,E). We increased the number of vertices on
V and the number of edges connecting vertices on the same layer and previous layer; see
Figure 13c,d. At this point, it is appropriate to determine how to stop the process.