Someday as an exercise in frustration and a frankly ridiculous misuse of stacks and magic structure, read plate::createSegment(...) in plate.cpp. This does the same work minus non-required (for my purposes) map-scale wrap-around  in less than a third of the code.