I then calculated the occurence of each normal vector. Then to map the pixel value from one of the five regions to the image being displayed I used this equation; Nx( x + px ) + Ny( y + py ) + Nz( z + pz ) = 0; where N is the normal vector, p corresponds to the point on the plane perpendicular to N, and x,y,z are coordinates of the image.
If the equation equals zero then those points( x,y,z ) are on one of the five regions.
I also may have wrote to many functions. Less function calls also would have sped things up a bit. However, these extra functions were needed, and probably a few more could have been added to help keep a grasp of what was going on. Even with the extra overheads I still had trouble grasping this particuliar assignment.