[vtkusers] [vtk-developers] GetNumberOfContacts()?

Jean-Dominique Barnichon jeando.barnichon at free.fr
Mon Apr 17 16:20:17 EDT 2006


have you tried to add the line:
	CollisDetec->Update(); 

before the lines
	CollisDetec->GetNumberOfContacts();
HTH
Jean-Do



hi;
  Who can tell me why numContact is always 0.Acturally two actors have been collided;
  vtkMatrix4x4 *matrix0=vtkMatrix4x4::New();
  vtkMatrix4x4 *matrix1=vtkMatrix4x4::New();
  vtkCollisionDetectionFilter *CollisDetec=vtkCollisionDetectionFilter::New();
  collide->SetInput(0,(vtkPolyData *)this->Actortemp->GetMapper()->GetInput());
  collide->SetMatrix(0,matrix0);
  collide->SetInput(1,(vtkPolyData *)this->Actor1->GetMapper()->GetInput());
  collide->SetMatrix(1,matrix1);
  collide->SetBoxTolerance(0.0);
  collide->SetCellTolerance(0.0);
  collide->SetNumberOfCellsPerBucket(2);
  collide->GetCollisionModeMaxValue();
  collide->GeneratePolydataOutputOn();
  //-------------------------------------------------
  int numContact;
  for(i=0;i<90;i++)
  {
   this->renWin->Render();
   this->Actor1->RotateWXYZ(1,0,0,-1);  
   numContacts=CollisDetec->GetNumberOfContacts();
   if(numContacts>0)
    MessageBox("sdf0",NULL,MB_OK);
  } 
  for(i=0;i<90;i++)
  {
   this->renWin->Render();
   this->Actortemp->RotateWXYZ(1,0,1,0);
   Source=this->Actortemp->GetMapper()->GetInput()->GetSource();
   numContact=CollisDetec->GetNumberOfContacts();
   if(numContact>0)
    MessageBox("sdf0",NULL,MB_OK);
  } 
 




More information about the vtkusers mailing list