Next Article in Journal
Unified Modeling and Multi-Objective Optimization for Disassembly Line Balancing with Distinct Station Configurations
Previous Article in Journal
Some Aspects of Teaching Improper Integrals in an Electronic Environment
Previous Article in Special Issue
Convex Quadratic Programming for Computing Geodesic Distances on Triangle Meshes
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

The Various Radii Circle Packing Problem in a Triangle

Department of Computer Science and Information Management, Soochow University, Taipei 100, Taiwan
*
Author to whom correspondence should be addressed.
Mathematics 2024, 12(17), 2733; https://doi.org/10.3390/math12172733 (registering DOI)
Submission received: 8 July 2024 / Revised: 29 August 2024 / Accepted: 30 August 2024 / Published: 31 August 2024
(This article belongs to the Special Issue Research on Computational Geometry and Computer Graphics)

Abstract

:
Malfatti’s problem is the problem of fitting three circles into a triangle such that they are tangent to each other and each circle is also tangent to a pair of the triangle’s sides. This problem has been extended to include Tn = 1 + 2 + … + n circles inside the triangle with special tangency properties among the circles and triangle sides; this problem is referred to as the extended Malfatti problem or the Tri(Tn) problem. In the extended Malfatti problem, the number of circles in the triangle is a triangle number because the tangency properties between the internal circles and the three sides of the triangle have a special type of structure; that is, the corner circle is tangent to two sides of the triangle and two other circles, the boundary circles are tangent to one side of the triangle and four other circles, and the inner circles are always tangent to six other circles. The circles we find in the extended Malfatti problem have the following property: the smallest and largest radii of the circles differ to a great extent. In the study presented herein, we propose algorithms to solve the problem that the tangency properties between the circles and the sides of the triangle are not fixed, so that the number of circles in the triangle is not necessarily a triangle number. The purpose of this change is to attempt to establish the radii of the circles in the triangle within a small range.

1. Introduction

Before we explain the problem in detail, we will introduce related materials such as the extended Malfatti problem.

1.1. Malfatti’s Problem and the Extended General Malfatti Problem

The circles-in-an-area problem has been investigated for a number of years. Circles may comprise equal circles or circles of different radii. The area can be a triangle [1,2,3,4], square [5], circle [6], or other area [7].
In 1803, Gian Francesco Malfatti [8] proposed the following problem: how to find the maximum total volume of three cylindrical columns out of a triangular prism of marble.
Identically, the problem can be recognized as finding three circles that fit into a specific triangle and ensuring that the total area is at its maximum. Malfatti theorized that the solution was to make three circles tangent to each other and to make each circle tangent to two sides of the triangle. One case is shown in Figure 1 [9].
In fact, Malfatti’s hypothesis is incorrect. In 1930, Lob and Richmond [10] established a method to obtain a larger area of some triangles by using a greedy algorithm that inscribes a single circle of the maximal radius within the triangle; inscribes a second circle within one of the three remaining corners of the triangle—the one with the smallest angle; and inscribes a third circle within the largest of the five remaining areas. The difference in area for an equilateral triangle is roughly over 1% (as shown in Figure 2) [11]; however, as Howard Eves (1946) stated, for an isosceles triangle with a very sharp apex, the optimal solution has nearly twice the area of the Malfatti circles (as shown in Figure 3) [12]. As stated in the 1960s, later proven firmly, the Lob–Richmond procedure always gives the largest area and solves the problem. In the literature, Malfatti’s hypothesis has become understood as Malfatti’s problem [13,14,15].
There are several known solutions to Malfatti’s problem. In their work, Fukagawa and Pedoe [15] state that Chokuen Ajima actually formulated and solved Malfatti′s problem. For a detailed history of the problem and explanations of various solutions and generalizations, interested readers are referred to [16,17,18].
The extended Malfatti problem [19] aims to determine Tn circles that can be inscribed inside a triangle while maintaining tangency among the circles and the triangle’s sides. When considering the problem with Tn = 1 n i circles, it is referred to as the Tri(Tn) n problem (as shown in Figure 4). Notably, when n = 1, the problem seeks to find the inscribed circle of a triangle, and when n = 2, it is precisely Malfatti’s problem.
There are closed forms for finding inscribed circles and Malfatti’s circles. Therefore, when n = 1 or n = 2, it is easy to propose a constant time algorithm to solve these problems. Chiang [19] proposed algorithms to solve the Tri(Tn) problem when n > 2.
There are three types of circles—corner circles, edge circles, and inner circles. Corner circles are tangent to two other circles and two sides of the triangle (Figure 5a). Edge circles are tangent to four other circles and one side of the triangle (Figure 5b). Inner circles are tangent to six other circles. Let SA(C) represent the sum of the surrounding angles for circle C. Then, SA(C) is the sum of 4, 5, and 6 angles, as shown in Figure 5a, Figure 5b, and Figure 5c, respectively. Specifically, if C is a corner circle, then SA(C) = α1 + α2 + α3 + α4, as depicted in Figure 5a. The definition of SA(C) is similar when C is an edge circle or an inner circle.
Chiang proposed an algorithm [19] that requested three vertices of the triangle and a value n as the inputs. From these inputs, we know the triangle (from three vertices), number of circles (from n), and the tangency relation between the circles and the sides of the triangle (from n). However, we do not know the radii of the circles. The initial radii are given for all circles and since then, the algorithm adjusts the radii so that SA(C) is equal to 2π for all circles, C. Chiang uses the following approach to adjust the radii: If SA(C) is greater than 2π, the radius of C should be enlarged. If SA(C) is less than 2π, the radius of C should be reduced. This approach is repeated until SA(C) is equal to 2π for all circles, C [19]. There are different methods to compute SA(C) when C is a corner circle, an edge circle [19], or an inner circle [20].
When considering the Tri(T2) problem, only corner circles are involved in this problem (see Figure 1). Assuming that these three circles have radii r1, r2, and r3, when we multiply these radii by a constant k, the angle computation (in Figure 5a) for α1, α2, α3, and α4 shows the same result. This means that there are infinitely many solutions in this case. One more constraint is required to find one solution only. The constant k can be computed by comparing the length of one side of the triangle with the corresponding side of the triangle bounded by these three circles, as shown in Figure 6. The constant k is referred to as the change ratio for the current solution and the real solution.
The Algorithm 1 proposed by Chiang [19] is as follows:
Algorithm 1. Chiang’s Algorithm
1.
The coordinate of three vertices A, B, and C are inputted; angles A, B, and C, as well as edge length c, are calculated;
2.
A tolerance variable eps = 0.01 is set;
3.
An initial radius list r = [ri,j| where 1 ≤ in, 1 ≤ ji.] is created;
4.
A surrounding angle list is created for all circles Ci,j (whose associated radius is ri,j) and they are named θi,j;
5.
While one of |θi,j − 2| > eps:
5.1
      The radius list is modified; all radii values are computed by the current radii and are assigned to the new radius list concurrently;
5.2
      A surrounding angle list is calculated for all circles Ci,j (using the new radii) and assign to θi,j;
5.3
      From the radius list, the change ratio is calculated and the radius list from the change ratio is modified;
6
The result is displayed.
The result for the Tri(Tn) problem, n = 2, 3, 4, 8, 30, using Chiang’s algorithm [19] is shown in Figure 7.

1.2. Problem Statement

We would like to take the main concept of Chiang’s algorithm and propose a new algorithm to ensure that the radii of these circles have a small range. Based on the results shown in Figure 7, the smallest angle of a triangle corresponds to the biggest circle. Conversely, the largest angle corresponds to the smallest circle, especially for the acute angle. In the circle packing area, some problems fix the radius of the circles inside the specified area or at least in similar-sized circles. Therefore, we propose a new algorithm based on the concept of Chiang’s algorithm to ensure that the circle’s radii have a small range. In Chiang’s algorithm, because the structure of circles inside the triangle is fixed, it is not necessary to establish a tangency graph (explained in further detail below) before finding the solution.
Circle packing inside a triangle can be applied to some applications, such as wireless transmitter location design. The centers of the circles are the position of the transmitter locations and the radii are the distance the transmitter can transmit. If the radii of the circles vary, different types of transmitters with different transmission distances are needed. Therefore, our aim is for the radius range of these circles to be small. The same concept can be applied in radar location design so that nothing can pass this triangle area. Other applications include logo design and circle-cutting design to reduce material wastage. There is an intermediate process needed to create a triangle mesh; therefore, many applications of mesh can also be treated in the same manner as the application in this paper. We will give an example at the end of this paper.
This paper comprises four sections. In Section 1, Malfatti’s problem is illustrated and extended. In Section 2, some terms, derived theories, and proposed algorithms for the new problem are defined. In Section 3, details of algorithm implementation are described. In Section 4, conclusions are drawn.

2. Terms, Theories, and Algorithms

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.
We use Tri(T2) and its tangency graph G(V, E) as an example (see Figure 8a), where V = {c1, c2, c3, e1, e2, e3} and E = {(c1, c2), (c1, c3), (c2, c3), (c1, e2), (c1, e3), (c2, e1), (c2, e3), (c3, e1), (c3, e2)}, as shown in Figure 8b. To see the edge circle or corner circle tangent to the side of the triangle more clearly, we drew a tangency graph, as shown in Figure 8c.
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.
Thus, the main concept of the proposed Algorithm 2 is as follows:
Algorithm 2. Proposed Algorithm
1.
The coordinates of three vertices, A, B, and C are input; the angles A, B, and C, as well as the edge length c, are calculated.
2.
A tolerance variable eps = 0.0001, epsR = 0.3 is set. A value r is set. A value of i = 1 is set.
3.
The one-offset of the triangle is generated. It is named Ti.
3.1
      The vertices on Ti are generated.
3.2
      The edges for vertices on Ti are generated, including the edges connecting two neighbors of vertices A, B, and C.
3.3
      Edges for vertices on Ti to the side of the triangle A B ¯ , B C ¯ , and C A ¯ are generated.
4.
While Ti does not satisfy some conditions:
4.1
      The 3 R-offset of the triangle Ti is generated and it is named Ti+1.
4.2
      The vertices and edges on Ti+1 are generated, as performed in steps 3.1 and 3.2.
4.3
      The edge connect vertices on Ti to vertices on Ti+1 are generated
4.4
      i = i + 1
5.
It is decided whether the last triangle contains only one vertex (circle) or three vertices (circles). The last triangle is named Tlast.
6.
The edge of the graph is established to connect Ti−1 and Tlast.
7.
Chiang’s algorithm is used with tolerance eps to find the solution.
8.
The results are displayed.
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:
  • How to find the R-offset of a triangle (step 3, 4.1).
  • How to construct the tangency graph (vertices and edges) for the same layer.
  • How to construct the tangency (vertices and edges) for two consecutive layers.
  • How to stop the while loop in step 4.
The above four problems will be described in Section 2.1, Section 2.2, Section 2.3 and Section 2.4.

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,  0 t , where nL = 1 ( x 2 x 1 ) 2 + ( y 2 y 1 ) 2 ( y 1 y 2 ,   x 2 x 1 ). The implicit form for the line cover Rayr(P1, P2) is a′x + b′y + c′ = 0, where a′ = (y2y1), b′ = (x1x2), and c′ = x 1 y 1 x 2 y 2 + r × x 2 x 1 2 + y 2 y 1 2 .
Proof of Theorem 1. 
The direction of the ray is P2 − P1 = ( x 2 x 1 ,   y 2 y 1 ) . The two vectors nL = 1 ( x 2 x 1 ) 2 + ( y 2 y 1 ) 2 ( y 1 y 2 ,   x 2 x 1 ) and nR = 1 ( x 2 x 1 ) 2 + ( y 2 y 1 ) 2 ( y 2 y 1 ,   x 1 x 2 ) 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 = x 1 y 1 x 2 y 2 . 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′ = x 1 y 1 x 2 y 2 = c + r x 2 x 1 2 + y 2 y 1 2 . Thus, the implicit form of Rayr(P1, P2) is (y2 − y1)x + (x1 − x2)y − x 1 y 1 x 2 y 2 +   x 2 x 1 2 + y 2 y 1 2 × R = 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  x 1 x 2 y 1 y 2 x 3 x 4 ( y 3 y 4 ) = 0 , L1, L2 are parallel to each other. Otherwise, these two lines intersect each other at (x,y), where x = x 1 y 1 x 2 y 2 x 3 y 3 x 4 y 4 x 1 x 2 ( x 3 x 4 ) x 1 x 2 y 1 y 2 x 3 x 4 ( y 3 y 4 ) ,   y = x 1 y 1 x 2 y 2 x 3 y 3 x 4 y 4 y 1 y 2 ( y 3 y 4 ) x 1 x 2 y 1 y 2 x 3 x 4 ( y 3 y 4 ) .
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) = ( x , y ) if   ≠ 0, where
= x 1 x 2 y 1 y 2 x 2 x 3 ( y 2 y 3 )
x = x 1 y 1 r x 2 y 2 r n 12 x n 12 y 1 x 2 y 2 r x 3 y 3 r n 23 x n 23 y 1 x 1 x 2 ( x 2 x 3 )
y = x 1 y 1 r x 2 y 2 r n 12 x n 12 y 1 x 2 y 2 r x 3 y 3 r n 23 x n 23 y 1 y 1 y 2 ( y 2 y 3 )
n 12 = ( n 12 x n 12 y ) = 1 ( x 2 x 1 ) 2 + ( y 2 y 1 ) 2 ( y 1 y 2 , x 2 x 1 )
n 23 = ( n 23 x n 23 y ) = 1 ( x 3 x 2 ) 2 + ( y 3 y 2 ) 2 ( y 2 y 3 , x 3 x 2 )
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 =  1 x 2 x 1 2 + y 2 y 1 2 y 1 y 2 , x 2 x 1   and n23 =  1 ( x 3 x 2 ) 2 + ( y 3 y 2 ) 2 ( y 2 y 3 ,   x 3 x 2 ) . The proof can be easily derived using Theorem 2 with the following four points—P1′, P2′, P3, and P4. □
Denote   = x 1 x 2 y 1 y 2 x 3 x 4 y 3 y 4 = x 1 x 2 y 1 y 2 x 2 x 3 ( y 2 y 3 )
x = x 1 y 1 r x 2 y 2 r n 12 x n 12 y 1 x 2 y 2 r x 3 y 3 r n 23 x n 23 y 1 x 1 x 2 ( x 2 x 3 )
y = x 1 y 1 r x 2 y 2 r n 12 x n 12 y 1 x 2 y 2 r x 3 y 3 r n 23 x n 23 y 1 y 1 y 2 ( y 2 y 3 )
The intersection P(x, y) = ( x , y ) when   0 .
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 A B ¯ to A B ¯ , from B C ¯ to B C ¯ , and from C A ¯ to C A ¯ (described in Section 2.3)
Using the above approach, starting from △ABC, the 1-offset of △ABC is T1 (△A′B′C′); the vertices and edges for T1 are shown in Figure 13a. Note that the three vertices of triangle T1 have a circle center at these three vertices with radius r tangent to △ABC.
Next, consider triangle T2, which is the 3 R-offset of T1. The method used for generating vertices and edges for T2 is identical to the method used to generate vertices and edges for T1. Thereafter, we generate edges between vertices in T1 and vertices in T2 (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  x ,   y = 1 t x 1 ,   y 1 + t x 2 ,   y 2 ,   w h e r e   t = ( x 3 x 1 ) ( x 2 x 1 ) + ( y 3 y 1 ) ( y 2 y 1 ) x 2 x 1 2 + y 2 y 1 2 , 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) = ( x x 3 ) 2 + ( y y 3 ) 2 = [ 1 t x 1 + t x 2 x 3 ] 2 + [ 1 t y 1 + t y 2 y 3 ] 2 . We aim to find the value t at which f(x) is the minimum; that is, d d t f ( t ) = 0 . The parameter value t can be computed from d d t f ( t ) = 0 .
Consider the correspondence edge A B ¯ on T1 and A B ¯ on T2. Assume the parameter values for the vertices on A B are t0, t1, …, tm, and the parameter values for the foot points of vertices on A B ¯ onto A B ¯   are t0′, t1′, …, tn′. 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 t0 and t7 are the vertices on A B ¯ ; at this point, no vertices on A B ¯ (T2) are connected. When we construct edges for △A′B′C′, we construct one edge from t1 to the last vertex on C A ¯ and from t6 to the first vertex on B C ¯ . Next, it was necessary to construct the edges for ti, I = 1…, 6 and tj′, j = 0, 3. We used the following approach to connect edges between vertices generated on T1 and T2. Note that we tried to connect vertices in A B ¯ to the vertices close to it in A B ¯ . We employed the same process for vertices in B C ¯ to the vertices close to it in B C ¯ , as well as for vertices in C A ¯ to the vertices close to it in C A ¯ .
We define the floor and ceiling for the vertices t i as follows:
t i = max   t j     t j < t i   } ;   t j = min   t j     t j > t i   } ,   where   t n = t m 1   t 1 = t 1 . With the above definition, we connect vertices t i to all vertices from t i 1   t o   t i i = 0, …, n. Therefore, in Figure 15, t 0 connects vertices from t 1 = t1 to t 0 = t2, and t 3 connects vertices from t 2 = t4 to t 3 = t6. Therefore, the vertex with parameter t 3   i n   A B has three edges connected to the vertices on A B ¯ .
The results following the connection of the edges between T1 and T2 are shown in Figure 13b. We continued to generate vertices on T3 = 3 R-offset(T2) and T4 = 3 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.

2.4. How to Stop the While Loop

It is already established that any triangle contains an inscribed circle and three Malfatti circles. The criterion to stop the algorithm depends on the radius of the inscribed circle and the minimum radius of the three Malfatti circles.
This process specifies the tangency properties between circles, representing vertices on G(V,E). Let r1 be the radius of the inscribed circle for Tlast, and let r2 be the minimum radius of the three Malfatti circles for Tlast. If one of these two radii is less than (1 + epsR)r—eqpR —a small value set by us—we stop the process and leave the loop. If r1 is close to r, we use one vertex for Tlast (see Figure 13e; otherwise, we use three vertices for Tlast (see Figure 13f)). The final aspect involved in constructing a tangency graph is connecting the edges for the vertices of Tlast with the previous layer triangle (see Figure 13e,f).

3. Examples

We used “Intel® Core™”i7-10750H CPU, 16G Ram, and Anaconda 23.5.2 (https://www.anaconda.com/products/distribution, accessed on 28 August 2024) with Python 3.11.3 (https://www.python.org) to implement the algorithm. We provide two examples below.
Example 4. 
Given a triangle with vertices at A = (10, 10), B = (100, 20), and C = (30, 50) and initial r = 2, set epsR = 0.3 and eps = 0.0001; the tangency graph these values generate is shown in Figure 13a–e. Following angle computation for every circle, including corner circles, boundary, and inner circles, a figure is produced, as shown in Figure 16. It takes 144.9, 6.140, and 0.288 s to construct a tangency graph, to find the radii for all circles, and to display the results, respectively. All of the circles generated have the radii range (0.829, 4.129), which is (0.415r, 2.065r).
In this case, on the final layer, the radius of the inscribed circle is 2.22, which is less than (1 + epsR)r = 2.6, and the radii of the Malfatti circles are 1.432, 1.099, and 1.766, with the minimum radius being 1.099. The value 2.22 is closer to r = 2 compared to 1.099. Thus, the final generated layer contains one vertex only. The output is shown in Figure 16.
Note that there are four circles in Figure 16 that contain larger inner circles. We found that when a circle has a large number of surrounding circles, there is a high likelihood that its radius is large. Therefore, if we add more circles in close proximity, this raises the question as to whether it is possible to reduce the range of the radii for the problem. Thus, after constructing the tangency graph, we checked the degree of each vertex; if the degree is larger than 15 or between 12 and 15, we construct two vertices/circles or one new vertex/circle with this vertex. Next, we use two different algorithms—one is used before adjustment and the other is used after adjustment. For the latter, we present the following example.
Example 5. 
Given a triangle with vertices at A = (10, 10), B = (100, 20), and C = (30, 30) and initial r = 1.9, set epsR = 0.3 and eps = 0.0001. The tangency graph before the adjustment constructs is shown in Figure 17a, and its associated tangency circles in the triangle are shown in Figure 17b. Note that two vertices contain more than 15 vertices; in this case, we add two more vertices for each of these two vertices, as shown in Figure 17c; their associated tangency circles in the triangle are shown in Figure 17d. Note that the range of the radii shown in Figure 17d is smaller than the range of the radii shown in Figure 17b.
We can see the clear difference between Figure 17b,d. Herein, we would like to compare the range of the radii with numerical numbers. There are 66 circles in Figure 17b; thus, we compared our results with Chiang’s result to solve the Tri(T11) problem because T11 = 65, which is close to 66. The result for Tri(figureT11) using Chiang’s algorithm is shown in Figure 18.
A comparison of the range of the radii using three different algorithms is shown in Table 1. The first algorithm is Chiang’s algorithm to solve the Tri(T11) problem. The second and third algorithms are the proposed algorithm before and after adjustment before using Chiang’s algorithm, respectively. We refer to these as Algorithm 1 and Algorithm 2. Shown are the minimum, lower quartile, median, third quartile, and maximum values of the circle radii from these three algorithms. We also show the range of the radii in the final column. Note that from Tri(T11) to Algorithm 1, the radius for the smallest circle varies from 0.147 to 0.52, and the median varies from 1.397 to 0.945. However, the maximum values vary from 5.28 to 5.684. At this point, we found that the large circle has more neighboring circles, which is the reason as to why we added one adjustment before using Chiang’s algorithm. Below, we compare Chiang’s algorithm with Algorithm 2, where the range of the radii (max–min) drops to 3.8 from 5.133.
Example 6. 
Given a triangle with vertices at A = (0, 0), B = (37.5, 64.952), and C = (75, 0), set r = 2, epsR = 0.4, and eps = 0.0001; the tangency graph these values generate is similar to the previous example, except for the final step, as shown in Figure 13f. The resulting figure following angle computation for every circle, including corner circles, boundary circles, and inner circles, is shown in Figure 19. It takes 127.106, 1.430, and 0.130 s to construct a tangency graph, to find the radii for all circles, and to display the results, respectively. All of the circles generated have the radii range (1.506, 2.194), which is (0.753r, 1.097r).
In this case, on the final layer, the radius of the inscribed circle is 4.330, and the minimum radius of the Malfatti circles is 2.745. Because 4.330 > 2.8 and 2.745 < 2.8, the final generated layer has three vertices, and we connected these three vertices to the vertices in the previous layer triangle. The output is shown in Figure 17.
Note that Figure 17a,c generate the triangle mesh. This meshed triangle can be used in games to enable NPCs (non-player characters) to navigate through a triangle without walking directly from A on one side of the triangle to a point B on the other side. We can find a path from point at T0 to T1, then T1 to T2, up until Tlast. When there is more than one choice, we select any one because we did not ask for the shortest path. Using this approach, we can find a path for a robot from A to Tlast, and a path from B to Tlast. Connecting these two paths, it generates a path from A to B. Using this approach and the tangency graph shown in Figure 17c, the path from A to B is shown in Figure 20.

4. Conclusions and Future Research

Herein, we propose an algorithm to generate a tangency graph to specify the tangency relationship among all circles and triangle boundaries. The purpose of this proposed algorithm is to reduce the range of the radii among all circles. The process of generating a tangency graph takes more CPU time compared to the time spent constructing and displaying circles.
There are some ways to extend the research presented herein. For example, we can extend the problem from a triangular area to a circular triangle (including the Reuleaux triangle) or the area bounded by three Bezier curves. Another direction of future research could be to change the area from a triangle to a convex polygon.

Author Contributions

Conceptualization, C.-S.C.; methodology, C.-S.C.; software, Y.-T.C.; writing—original draft, C.-S.C.; writing—review and editing, Y.-T.C.; funding acquisition, C.-S.C. All authors have read and agreed to the published version of the manuscript.

Funding

This research is supported by grant NSTC-112-221-E-031-003.

Data Availability Statement

The original contributions presented in the study are included in the article, further inquiries can be directed to the corresponding author.

Acknowledgments

We extend our heartfelt gratitude to Guan Wen Wang and Hsi Wen Wang for their invaluable contributions to the programming aspect of this research.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Eckard, S. The Best Known Packings of Equal Circles in an Isosceles Right Triangle. 11 March 2011. Available online: http://hydra.nat.uni-magdeburg.de/packing/crt/crt.html (accessed on 1 May 2011).
  2. Melissen, H. Densest packings of congruent circles in an equilateral triangle. Am. Math. Mon. 1993, 100, 916–925. [Google Scholar] [CrossRef]
  3. Melissen, J.; Schuur, P. Packing 16, 17 or 18 circles in an equilateral triangle. Discret. Math. 1995, 145, 333–342. [Google Scholar] [CrossRef]
  4. Graham, R.L.; Lubachevsky, B.D. Dense packings of equal disks in an equilateral triangle: From 22 to 34 and beyond. Electron. J. Comb. 1995, 2, 1. [Google Scholar]
  5. Eckard, S. The Best Known Packings of Equal Circles in a Square. 20 May 2010. Available online: http://hydra.nat.uni-magdeburg.de/packing/csq/csq.html (accessed on 25 May 2010).
  6. Friedman, E. “Circles in Circles”, Erich’s Packing Center. Available online: https://erich-friedman.github.io/packing/cirincir/ (accessed on 20 May 2024).
  7. Melissen, J.B.M. Packing and Covering with Circles. Ph.D. Thesis, Utrecht University, Utrecht, The Netherlands, 1997. [Google Scholar]
  8. Malfatti, G. Memoria sopra un problema stereotomico. Mem. Mat. Fis. Soc. Ital. Sci. 1803, 10, 235–244. [Google Scholar]
  9. Chiang, C.S.; Hoffmann, C.M.; Rosen, P. A gereralized Malfatti’s Problem. Comput. Geom. 2012, 45, 425–435. [Google Scholar] [CrossRef]
  10. Lob, H.; Richmond, H.W. On the Solutions of Malfatti’s Problem for a Triangle. Proc. Lond. Math. Soc. 1930, 2, 287–304. [Google Scholar] [CrossRef]
  11. Eves, H. Malfatti Problem (problem 4145). Probl.Solut. Am. Math. Mon. 1946, 53, 285–286. [Google Scholar] [CrossRef]
  12. Wells, D. Malfatti’s problem. In The Penguin Dictionary of Curious and Interesting Geometry; Penguin Books: New York, NY, USA, 1991; pp. 145–146. ISBN 978-0-14-011813-1. [Google Scholar]
  13. Stanley, O.C. Malfatti’s problem In Excursions in Geometry; Dover: Mineola, NY, USA, 1990; pp. 145–147. ISBN 978-0-486-26530-8. [Google Scholar]
  14. Goldberg, M. On the Original Malfatti Problem. Math. Mag. 1967, 40, 241–247. [Google Scholar] [CrossRef]
  15. Fukagawa, H.; Pedoe, D. The Malfatti Problem. In Japanese Temple Geometry Problems (San Gaku); The Charles Babbage Research Centre: Winnipeg, MB, Canada, 1989; pp. 28, 103–106. [Google Scholar]
  16. Bottema, O. The Malfatti Problem. Forum Geom. 2000, 1, 43–50. [Google Scholar]
  17. Stefanović, M. Triangle centers associated with the Malfatti circles. Forum Geom. 2003, 3, 83–93. [Google Scholar]
  18. Wolfram Math World. Malfatti Circles. Available online: http://mathworld.wolfram.com/MalfattiCircles.html (accessed on 20 May 2024).
  19. Chiang, C.-S.; Li, H.C.; Hsiung, M.-H.; Chiu, F.-M. Extended General Malfatti’s Problem. In Proceedings of the 19th International Conference on Scientific Computing, Las Vegas, NV, USA, 26–29 July 2021. [Google Scholar]
  20. Collins, C.R.; Stephenson, K. A circle packing algorithm. Comput. Geom. 2003, 25, 233–256. [Google Scholar] [CrossRef]
  21. Weisstein, E.W.; Line-Line Intersection. From MathWorld—A Wolfram Web Resource. Available online: https://mathworld.wolfram.com/Line-LineIntersection.html (accessed on 20 May 2024).
Figure 1. Malfatti’s problem.
Figure 1. Malfatti’s problem.
Mathematics 12 02733 g001
Figure 2. Circles in an equilateral triangle.
Figure 2. Circles in an equilateral triangle.
Mathematics 12 02733 g002
Figure 3. Malfatti’s problem and the max area problem.
Figure 3. Malfatti’s problem and the max area problem.
Mathematics 12 02733 g003
Figure 4. The tangency property of the Tri(Tn) problem.
Figure 4. The tangency property of the Tri(Tn) problem.
Mathematics 12 02733 g004
Figure 5. Calculation of the total surrounding angles for 3 types of circles. (a) Corner Circle; (b) Edge Circle; (c) Inner Circle.
Figure 5. Calculation of the total surrounding angles for 3 types of circles. (a) Corner Circle; (b) Edge Circle; (c) Inner Circle.
Mathematics 12 02733 g005
Figure 6. Tri(T2) problem; change ratio = c/c′.
Figure 6. Tri(T2) problem; change ratio = c/c′.
Mathematics 12 02733 g006
Figure 7. Tri(Tn) problem, where n = 2, 3, 4, 8, and 30.
Figure 7. Tri(Tn) problem, where n = 2, 3, 4, 8, and 30.
Mathematics 12 02733 g007
Figure 8. Tri(T2) problem and its tangency graphs. (a) Tri(T2) problem; (b) Tangency graph; (c) Our tangency graph.
Figure 8. Tri(T2) problem and its tangency graphs. (a) Tri(T2) problem; (b) Tangency graph; (c) Our tangency graph.
Mathematics 12 02733 g008
Figure 9. R-offset of a ray.
Figure 9. R-offset of a ray.
Mathematics 12 02733 g009
Figure 10. Intersection of two R-offset rays from three points.
Figure 10. Intersection of two R-offset rays from three points.
Mathematics 12 02733 g010
Figure 11. The result of the R-offset triangle.
Figure 11. The result of the R-offset triangle.
Mathematics 12 02733 g011
Figure 12. Vertex setup for one side of the triangle. (a) Add three vertices; (b) Find vertices in between one side.
Figure 12. Vertex setup for one side of the triangle. (a) Add three vertices; (b) Find vertices in between one side.
Mathematics 12 02733 g012
Figure 13. Generating the tangency tree for triangles. (a) ΔABC to T1; (b) T1 to T2; (c) T2 to T3; (d) T3 to T4; (e) Tlast contains 1 vertex; (f) Tlast contains 3 vertices.
Figure 13. Generating the tangency tree for triangles. (a) ΔABC to T1; (b) T1 to T2; (c) T2 to T3; (d) T3 to T4; (e) Tlast contains 1 vertex; (f) Tlast contains 3 vertices.
Mathematics 12 02733 g013
Figure 14. Establishment of the foot point f of point g.
Figure 14. Establishment of the foot point f of point g.
Mathematics 12 02733 g014
Figure 15. Relation between vertices.
Figure 15. Relation between vertices.
Mathematics 12 02733 g015
Figure 16. Output display for Example 4.
Figure 16. Output display for Example 4.
Mathematics 12 02733 g016
Figure 17. Before and after the adjustment in Example 5. (a) Tangency graph before adjustment; (b) Result for the tangency graph in (a); (c) Tangency graph after adjustment; (d) Result for the tangency graph in (c).
Figure 17. Before and after the adjustment in Example 5. (a) Tangency graph before adjustment; (b) Result for the tangency graph in (a); (c) Tangency graph after adjustment; (d) Result for the tangency graph in (c).
Mathematics 12 02733 g017
Figure 18. The solution for Tri(T11).
Figure 18. The solution for Tri(T11).
Mathematics 12 02733 g018
Figure 19. Output for Example 6.
Figure 19. Output for Example 6.
Mathematics 12 02733 g019
Figure 20. Non straigt path for robots from A to B.
Figure 20. Non straigt path for robots from A to B.
Mathematics 12 02733 g020
Table 1. Comparison of the radii from the three different algorithms.
Table 1. Comparison of the radii from the three different algorithms.
MinQ1MedianQ3MaxMax–Min
Chiang’s Algorithm Tri(T11)0.1470.971.3971.6765.285.133
Algorithm 1 (r = 1.9)0.520.7150.9451.6745.6845.164
Algorithm 2 (r = 1.9)0.4520.7751.1291.9924.2523.8
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Chiang, C.-S.; Chiang, Y.-T. The Various Radii Circle Packing Problem in a Triangle. Mathematics 2024, 12, 2733. https://doi.org/10.3390/math12172733

AMA Style

Chiang C-S, Chiang Y-T. The Various Radii Circle Packing Problem in a Triangle. Mathematics. 2024; 12(17):2733. https://doi.org/10.3390/math12172733

Chicago/Turabian Style

Chiang, Ching-Shoei, and Yi-Ting Chiang. 2024. "The Various Radii Circle Packing Problem in a Triangle" Mathematics 12, no. 17: 2733. https://doi.org/10.3390/math12172733

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop