Algorithm 584: CUBTRI: Automatic Cubature over a Triangle

(1) Compute an approximate integral A and error estimate 7 for the original triangle T. (2) If the current values of A and ~ satisfy ~ < max{e, IA~I}, or if further computation will exceed specified limits, exit. (3) Given a list of triangles whose union is T, together with an approximate integral and error estimate for each triangle, identify the triangle Tk with largest error estimate. (4) Remove Tk from the data list and subtract its contributions from the current values of A and 7. (5) Divide T~ into four congruent triangles, append them to the data list, and compute an approximate integral and error estimate for each. Add these contributions to A and 7.