Fixed polygon3d rendering bug issue #178

This is a candidate fix for the mplot3d polygon rendering bug of issue #178; it will also allow PR #1299 to proceed.

The changes are all in the mplot3d code, except for one new function in `collections.py` which is only called from mplot3d code.  With this fix the test script added by @WeatherGod to #178 works OK, and all the existing mplot3d examples work as before.

The code changes are not elegant, but are consistent with existing mplot3d code.

I haven't PEP8'd the changes as the original mplot3d files haven't been PEP8'd yet.