Algorithm for Optimal Triangulations in Scattered Data Representation and Implementation