[vtk-developers] pointer to a member method

Goodwin Lawlor goodwin.lawlor at ucd.ie
Fri Jun 4 07:09:31 EDT 2004


Hi All,

I've got a class which uses this method in vtkOBBTree:

int vtkOBBTree::IntersectWithOBBTree ( vtkOBBTree *, vtkMatrix4x4 *,
int(*)(vtkOBBNode *, vtkOBBNode *, vtkMatrix4x4 *, void *), 
void *)

My code looks like:

static int ComputeCollisions(vtkOBBNode *, vtkOBBNode *, vtkMatrix4x4 *,
void *);
  {
  ...
  }

vtkCollisionDetectionFilter::Execute()
  {
  ...
  Obbtree1->IntersectWithOBBTree ( Obbtree2, matrix, ComputeCollisions,
this);
  ...
  }

This works fine. Now I'd like to make ComputeCollisions a class member
method but my compiler (bcc55) has other ideas. I get:

Error E2034 vtkCollisionDetectionFilter.cxx 364: Cannot convert 'int (*
(_closure )(vtkOBBNode *,vtkOBBNode *,vtkMatrix4x4 *,void *))(vtkOBBNode
*,vtkOBBNode *,vtkMatrix4x4 *,void *)' to 'int (*)(vtkOBBNode
*,vtkOBBNode *,vtkMatrix4x4 *,void *)' in function
vtkCollisionDetectionFilter::Execute()

Error E2342 vtkCollisionDetectionFilter.cxx 364: Type mismatch in
parameter 'function' (wanted 'int (*)(vtkOBBNode *,vtkOBBNode
*,vtkMatrix4x4 *,void *)', got 'void') in function
vtkCollisionDetectionFilter::Execute()

So I try:

Obbtree1->IntersectWithOBBTree ( Obbtree2, matrix, (int
(*))ComputeCollisions, this);

And I get:

Error E2235 vtkCollisionDetectionFilter.cxx 364: Member function must be
called or its address taken in function
vtkCollisionDetectionFilter::Execute()

The source code for the class is here:
http://www.bioengineering-research.com/vtk/vtkCollisionDetectionFilter.h
tm


Any help would be much appreciated.
TIA,

Goodwin





More information about the vtk-developers mailing list