# Computer Graphics – Area Subdivision 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:

Fig.1

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.

Fig.2

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

Fig.3

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.

Fig.4

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

Fig.5

### Algorithm:

1. Initialize the viewing area or window panel dimension.
2. Enlist all the polygon(s) and sort them according to Zmin (depth value) with respect to the window panel(view port).
3. Categorize all the polygon(s) according to their corresponding cases in which they are falling.
4. 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 window plane then, in this case, we first find out the depth buffer(Zmin) 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(Zmin).
5. Repeat all the above steps for all given polygons, then exit.
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Previous
Next