Computational geometry C++ template