tailieunhanh - computer graphics c version phần 3

Area-điền vào các thuật toán và đồ họa các quá trình khác thường cần phải xác định các khu vực bên trong của đối tượng. Cho đến nay, chúng tôi đã thảo luận khu vực điền chỉ về hình dạng đa giác tiêu chuẩn. Trong hình học tiểu học, một hình đa giác thường được xác định | Simpo PDF Merge and Split Unregistered Version - http Free edge records that have been malloc ed . Inside-Outside Tests Area-filling algorithms and other graphics processes often need to identify interior regions of objects. So far we have discussed area filling only in terms of standard polygon shapes. In elementary geometry a polygon is usually defined as having no self-intersections. Examples of standard polygons include triangles rectangles octagons and decagons. The component edges of these objects are joined only at the vertices and otherwise the edges have no common points in the plane. Identifying the interior regions of standard polygons is generally a straightforward process. But in most graphics applications we can specify any sequence for the vertices of a fill area including sequences that produce intersecting edges as in Fig. 3-40. For such shapes it is not always clear which regions of the xy plane we should call interior and which regions we should designate as exterior to the object. Graphics packages normally use either the odd-even rule or the nonzero winding number rule to identify interior regions of an object. We apply the odd-even rule also called the odd parity rule or the evenodd rule by conceptually drawing a line from any position p to a distant point outside the coordinate extents of the object and counting the number of edge crossings along the line. If the number of polygon edges crossed by this line is odd then p is an interior point. Otherwise p is an exterior point. To obtain an accurate edge count we must be sure that the line path we choose does not intersect any polygon vertices. Figure 3-40 a shows the interior and exterior regions obtained from the odd-even rule for a self-intersecting set of edges. The scan-line polygon fill algorithm discussed in the previous section is an example of area filling using the odd-even rule. Another method for defining interior regions is the nonzero winding number rule which .

TỪ KHÓA LIÊN QUAN