Plot3D

Some improvements to the 3D plotting code:
- adaptive sampling in 3D
- better triangle subdivision algorithm (I've named it triforce)
- fix some 'tenting' effects (e.g. a grid square (1,2,3,4) is triangulated as (1,2,3), (1,3,4) when (1,2,4), (2,3,4) looks better
- fix some subdivision bugs which were causing gaps in the surfaces
- general code cleanup