Contouring data using conrec

I have a program that contours data using the venerable conrec routine of Paul Bourke. The problem with conrec is that it draws the line segments of the contour lines out of order. That’s okay if you just want contour lines, but if you want to fill the area enclosed by the contour line, you need closed polygons so the line segments need to be in order. For obj C, Graham Cox has a nice routine for doing this and has released it as GCContourPlotter class for Xcode, and the algorithm is described here:

Before I contemplate translating this to Xojo, I thought I would ask if anyone here has already done this, or if people have other Xojo implementations of contouring data on a regular grid that outputs the contour lines as closed polygons. Any recommendations appreciated!