Convert plo3d.c to C++