triangulation operating code with c++