The semantics of the AdvanceBToRightChain(), MoveAIfLowAndBIfHigh(), SearchForBTangency(), UpdateSidesCA(), IsNotBTangency(), UpdateSidesBA(), UpdateSideB(), IsLocalMinimalTriangle() and UpdateMinimumAreaEnclosingTriangle() subalgorithms/functions was given in Sect. 2 and is not restated here.
In order to validate every enclosing triangle Algorithm 9 checks if the sides \(A\), \(B\) and \(C\) determined by Algorithm 1 intersect and if their midpoints touch the polygon.
Definition 1
The line \(L\) determined by \(gammaPoint\) and \(polygon\)[\(index\)] intersects the polygon below
\(polygon\)[\(index\)] if the following conditions hold:
-
1.
The ray [\(polygon\)[\(index\)] \(gammaPoint'\)) intersects the polygon, where \(gammaPoint'\) is a point on \(L\) such that \(polygon\)[\(index\)] is the middle point of the line segment [\(gammaPoint\)
\(gammaPoint'\)]. Let us denote the intersection point of the ray with the polygon, if it exists, as \(intersectionPoint\);
-
2.
\(h\)(\(intersectionPoint) <\ h\)(\(polygon\)[\(index\)]).
Erroneous triangles will be obtained if the line (\(polygon\)[\(index\)] \(gammaPoint'\)) instead of the ray [\(polygon\)[\(index\)] \(gammaPoint'\)) is considered when computing the intersection with the polygon; see Klee and Laskowski (1985) for more details why the ray and not the line is considered.
Definition 2
The line \(L\) determined by \(gammaPoint\) and \(polygon\)[\(index\)] intersects the polygon above
\(polygon\)[\(index\)] if the following conditions hold:
-
1.
The ray [\(polygon\)[\(index\)] \(gammaPoint\)) intersects the polygon. Let us denote this point, if it exists, as \(intersectionPoint\);
-
2.
\(h\)(\(intersectionPoint\)) > \(h\)(\(polygon\)[\(index\)]).
According to condition 1 in Definitions 1 and 2, the intersection of the ray with the polygon has to be computed. However, this would lead to an increase in the overall complexity of the main algorithm. Thus an alternative constant complexity solution which considers only the angle (the slope could be considered as well) of the ray determined by \(gammaPoint\) and \(polygon\)[\(index\)] is employed. In this case the point \(gammaPoint'\) is no longer required because the angle of the ray [\(polygon\)[\(index\)] \(gammaPoint'\)) is equal to the angle of the ray [\(gammaPoint\)
\(polygon\)[\(index\)]).
Both IntersectsAbove and IntersectsBelow functions call the function Intersects which checks if the line intersects the polygon ABOVE/BELOW the point \(polygon\)[\(index\)], or is CRITICAL. The only difference between IntersectsAbove and IntersectsBelow is the way in which they compute the angle of the line determined by \(gammaPoint\) and \(polygon\)[\(index\)] as can be seen in Algorithms 12 and 13. The angle is computed differently because the rays considered in condition 1 (Definitions 1 and 2) differ.
Having received the angle of the line determined by \(gammaPoint\) and the point \(polygon\)[\(index\)] the function \(Intersects\) checks using angle comparison (slope comparison could be employed as well) if the line intersects the polygon ABOVE/BELOW the point \(polygon\)[\(index\)] or is CRITICAL; see Algorithm 14 for more details.
The point \(\gamma \)(\(p\)) (Gamma) is the point on the line [\(a\), \(a - 1\)] such that \(h\)(\(\gamma \)(\(p)) = 2\)
\(\times \)
\(h\)(\(p\)). In order to find \(\gamma \)(\(p\)) we consider the intersection between lines L1, L2 and L3, where:
-
L1: The line [\(a\), \(a - 1\)];
-
L2, L3: The lines parallel to and at a distance of (2 \(\times \)
\(h\)(\(p\))) from [\(c\), \(c - 1\)];
If L1 is parallel to L2 and L3, then L1 and L2 or L1 and L3 are either identical or they do not intersect. In the former case \(\gamma \)(\(p\)) is equal to \(polygon\)[\(a - 1\)]. In the latter case \(\gamma \)(\(p\)) does not exist.
Conversely, if L1 is not parallel to L2 and L3, then two intersection points exist, P1\( =\)
L1 \(\cap \)
L2 and P2 \(=\)
L1 \(\cap \)
L3. As stated in Klee and Laskowski (1985) only the points which are on the same side of the line [\(c\), \(c - 1\)] as the polygon will be considered. Therefore, \(\gamma \)(\(p\)) will be equal to the intersection point which is on the same side of the line [\(c\), \(c - 1\)] as the point \(polygon\)[\(c + 1\)].
Finding \(vertexC\) on side \(B\) is similar to computing gamma of a point.