Posts Tagged ‘interpolate’

Matlab’s trisurf confuses face colors with vertex colors

Sunday, July 28th, 2013

I recently had trouble getting matlab’s trisurf to display interpolated colors inside each face. I was calling:


But the display looked like flat shading.

The problem turned out to be that I had 9 faces and 9 vertices. In this rare instance matlab decides that the vertex colors (which actually are just the Z coordinates in V(:,3)) should be attached (incorrectly) to the faces and are not interpolatable.

I hacked a fix to this by appending an extra ghost vertex: