Critical Area Curve
3.3 Sampling Framework
3.3.1 Weighted Sampling
The sampling strategy is based on random sampling, and the construction of the density table is built in the previous step. We will repeatedly do the random
sam-pling in the sample region until the value F calculated from the density table for each grid. The computation of the sampling value in each grid is shown as follows.
The ratio that CountingNum is divided by the T otalCountingNum summed up by each grid is regarded as a weight, and it is multiplied by the total sample size.
If the value is not an integer, we will round off. That is,
F = CountingN um
T otalCountingN um×T otalSampleSize F : Sampling frequency of each grid
T otalCountingNum : sum up all CountingNum T otalSampleSize : the number of wanted sampling
Taking the Figure 3.3 as an example, the computing procedure is that CountingNum = 4, T otalCountingNum = 2 + 4 + 2 + 3 + 5 + 1 + 2 + 1 + 2 = 22, assumed the T otalSampleSize = 50, then F = (4/22) ∗ 50 = 9. It means that we will do ran-dom sampling 9 times in the grid 2. When executing ranran-dom sampling, we use a rectangle shape to extract the critical area in each action. We call it as a sample region. As shown in Figure 3.7, the setting of sample region has two constraints:
– Sample region size is smaller than the grid region size – Sample region size is larger than the largest defect size
The reason in setting the rule 1 is that our purpose is for surveying sampling effects in this grid region. Therefore, the sample region size has to be smaller than this grid region size. In addition, for the rule 2, the sample region is used to estimate the critical area. The sample region size will affect the result. We find that when the sample region size is smaller than the largest defect size, it will cause the result inaccuracy. The explanation of this condition is related to the extraction method of critical area. The detail of this method will be discussed in the next section. When we use this extraction method, it will limit the sample region size in some range.
Hence, the sample region size must be larger than the largest defect size, and it can ensure the accuracy of estimation. For the setting of total sample size, we adopt the
number of polygons appear in this layer multilied by a ratio as total sample size.
This ratio is the number of CountingNum 6= 0 in n × n grids divided by n × n.
The selection of sample region size and total sample size has a great influence on the result. Both of them involve with the representation – accuracy and complexity of computation. Though using larger total sample size or larger region size improves the precision of result, it will actually increase the complexity of computation and the cost of resource. This is a trade-off problem.
3.3.2 Shape Expansion
After deciding sample region size and total sample size, we will introduce an ex-traction method of critical area. The method is called shape expansion, or shape intersection. Figure 3.5 shows a shape expansion algorithm that how to attain the critical area for short failures.
In this section, we only execute step 1 of this method in our flow. Step 2 to Step 4 will be discussed in the Section 3.4. At first, we must know that how many polygons appears in the sample region. Then, we can estimate the critical area depending on these polygons appearing in the sample region. We use oaShapeQuery API to query the shapes within the sample region. When we query a polygon, we will expand this geometry shape by radius R which originates from a defect size. There are different defect sizes to do the expansion, shown in Figure 3.6.
Κ Κ
Κ
Figure 3.5: Shape expansion algorithm.
Figure 3.6: The examples for short failure by shape expansion : two different defect size.
3.3.3 Polygon Clipping
In this section, we will handle the set of polygons within the sample region. These polygons are picked up if they are involving in the sample region except the special case. All of these selected polygons are the complete shapes. However, for the accuracy of computation, we only need the shape of the polygon within the sample region. Outside parts of the sample region must be cut, as shown in Figure 3.7. The special case is that the polygons are overlapping with the boundary of the sample region, but not intersecting with the sample region. When the special case happens, we will not query this polygon.
According to the analysis of polygons, we find that polygons could be the convex or concave polygons. Consequently, we use the Weiler-Atherton algorithm to cut valid polygons in the sample region. The Weiler-Atherton algorithm [15] is the most general clipping algorithm. The advantages of this algorithm are that it can handle polygons with any shape (convex or concave) and the process is very effective. The process is continued until the “in point” is reached. The procedure of this algorithm is shown in Figure 3.8.
In our algorithm, we used double linked-lists to record the two sets of polygons.
Valid sample region
Figure 3.7: The valid sample region : The shape of polygons inside sample region is valid.
AlgorithmΚWeiler-Atherton
InputΚI/*points of the polgon*/,II/*points of the cutting window*/
OutputΚQ/*points after clipping*/
1 - sorting I by clockwise direction 2 - sorting II by clockwise direction
3 - find the points of intersection by I and II, and mark “1” or “-1”
5 - if find “1” point, put this point into S temporarily
6 - save this point into Q and erase mark “1” of this point from III 7 - along III take point after mark “1”
if mark of point is not “-1”
save this point into Q, continue step 7 else
go to step 8
8 - along IV take point after mark “-1”
if mark of point is not “1”
Figure 3.8: The polygon clipping algorithm – Weiler-Atherton.
1
Figure 3.9: The example by Weiler-Athertion algorithm.
One link records the sample region(as Figure 3.9- III), another records the shape which is cut(as Figure 3.9- IV ). The flag “1” represents the cutting polygon(as Figure 3.9- I ) enters the sample region(as Figure 3.9- II ) by this point which be called “in point”(as Figure 3.9- a ). The flag “-1” represents the cutting polygon(as Figure 3.9- I ) exit the sample region(as Figure 3.9- II ) from this point called “out point”(as Figure 3.9- b ). The flag “1” or “-1” is decided by the function of cross product. If the results of cross products are greater than zero, the flag of this point will be set to “1”. On the contrary, if the result is smaller than zero, the flag of this point will set to “-1”.