Convert line3d.c to C++