rewritten triangulation