[GRASS-dev] computational geometry in C++ library

Glynn Clements glynn at gclements.plus.com
Fri May 5 13:17:08 EDT 2006


Francesco Paolo Lovergine wrote:

> > It would be fantastic to have a version of this library
> > in GRASS 6.1.
> > I could think of a dozen generally useful GRASS modules
> > based on this: 3D convex hull, converting 3D polygons to voxels,
> > point in 3D polygon queries ...
> > I don't know much C++, but surely there
> > must be a way to use the methods in this library with
> > standard C function calls? Some sort of simple wrapper perhaps?
> 
> Calling C funcs from C++ is straight-forward. 
> The reverse is not possible, the whole result would be a C++ prog.

It's not quite that bad. You can write C-callable wrapper functions in
C++, e.g.:

	extern "C" {
	
	void wrapper(void *p)
	{
		((Object *) p)->method();
	}
	
	}

Note that the GLU library is written in C++, but can be used from C
programs.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list