# Computer Graphics – Area Subdivison Algorithm in 3D(Hidden Surface Removal)

Mr. John Warnock proposed an area subdivision algorithm, that’s why also known as the Warnock algorithm. This algorithm extensively uses the concept of area coherence in computing the visible surface in the scene, which is closer to the viewing plane, area coherence avoids the computation of the visibility detection of the common surface, that has already been computed in the earlier step, so no need to recompute it. That’s all the area coherence does.

The area subdivision algorithm is based on the divide and conquers method where the visible(viewing) area is successively divided into smaller and smaller rectangles until the simplified area is detected. Consider given with the window panel, where the polygon will be projected, is as follows:

**When we subdivide the window panel against the polygon we may come through the following cases which are as follows:**** **

**1. Surrounding surface:**** **It’s the case in which the viewing polygon surface completely surrounds the whole window panel.

**2. Overlapping(Intersecting) surface:**** **It’s the case in which the window panel(viewport) and viewing polygon surface both intersect each other.

**3. Inside(contained) surface:**** **In this case, in which the whole polygon surface is inscribed inside the window panel. This case is just opposite to the first(surrounding surface) case.

**4. Outside(disjoint) surface**: In this case, the whole polygon surface is completely outside the window panel.

**Algorithm:**

- Initialize the viewing area or window panel dimension.
- Enlist all the polygon(s) and sort them according to Z
_{min }(depth value) with respect to the window panel(view port). - Categorize all the polygon(s) according to their corresponding cases in which they are falling.
- Now, perform the visible surface(hidden surface removal) detection test:
- If we have a polygon, which has completely surrounded the window panel then set the viewing area color to the corresponding polygon color that is stored in the frame buffer.
- If the enlisted polygon(s) are disjoint or completely outside the window panel then, in this case, the background color of the window plane will be done and the polygon(s) will be ignored.
- If the polygon(s) is contained(inscribed) inside the window panel completely then color the polygon from its corresponding color and color the rest of the surface with the background color.
- If polygon(s) and the window panel surfaces are intersecting(overlapping) each other then the following cases need to be considered:
- Fill the overlapped region with the corresponding polygon color that is set in the frame buffer.
- If we are given more than one polygon, with overlapped surfaces with respect to the widow plane then, in this case, we first find out the depth buffer(Z
_{min}) in order to find the surface of the polygon which is closer to the window panel and will fill the overlapped region with the color of that polygon that has minimum(Z_{min}).

- Repeat all the above steps for all given polygons, then exit.