Implementation for mesh decimation.