This function replaces loops through a data set of triangles, subdivides them, then updates the triangle ids and rhombus ids.
substitution(df)
| df | A data set of triangles | 
|---|
A data set of subdivided triangles
The data set has to have shape, point1_x, point1_y,
point2_x, point2_y, point3_x, and point3_y. These
columns will be updated. In addition to those, any column titles
triangle or rhombus will be updated to serve as identification
columns.
There is a section of this code that will snap the points to a grid in an attempt to fix numerical stability issues. There is potential for this to cause errors but almost always fixes more problems than it creates.