MCPcopy Create free account
hub / github.com/Kitware/VTK / RequestData

Method RequestData

Filters/Modeling/vtkCollisionDetectionFilter.cxx:406–581  ·  view source on GitHub ↗

Description: Perform a collision detection

Source from the content-addressed store, hash-verified

404// Description:
405// Perform a collision detection
406int vtkCollisionDetectionFilter::RequestData(vtkInformation* vtkNotUsed(request),
407 vtkInformationVector** inputVector, vtkInformationVector* outputVector)
408{
409 // get the info objects
410 vtkDebugMacro(<< "Beginning execution...");
411
412 // inputs and outputs
413 vtkPolyData* input[2];
414 vtkPolyData* output[3];
415
416 // copy inputs to outputs
417 vtkInformation *inInfo, *outInfo;
418 for (int i = 0; i < 2; i++)
419 {
420 inInfo = inputVector[i]->GetInformationObject(0);
421 input[i] = vtkPolyData::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT()));
422
423 outInfo = outputVector->GetInformationObject(i);
424 output[i] = vtkPolyData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
425
426 output[i]->CopyStructure(input[i]);
427 output[i]->GetPointData()->PassData(input[i]->GetPointData());
428 output[i]->GetCellData()->PassData(input[i]->GetCellData());
429 output[i]->GetFieldData()->PassData(input[i]->GetFieldData());
430 }
431
432 // set up the contacts polydata output on port index 2
433 outInfo = outputVector->GetInformationObject(2);
434 output[2] = vtkPolyData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
435 vtkPoints* contactsPoints = vtkPoints::New();
436 output[2]->SetPoints(contactsPoints);
437 contactsPoints->Delete();
438
439 if (this->CollisionMode == vtkCollisionDetectionFilter::VTK_ALL_CONTACTS)
440 { // then create a lines cell array
441 vtkCellArray* lines = vtkCellArray::New();
442 output[2]->SetLines(lines);
443 lines->Delete();
444 }
445 else
446 { // else create a verts cell array
447 vtkCellArray* verts = vtkCellArray::New();
448 output[2]->SetVerts(verts);
449 verts->Delete();
450 }
451
452 // Allocate arrays for the contact cells lists
453 vtkSmartPointer<vtkIdTypeArray> contactcells0 = vtkSmartPointer<vtkIdTypeArray>::New();
454 if (contactcells0)
455 {
456 contactcells0->SetName("ContactCells");
457 }
458 output[0]->GetFieldData()->AddArray(contactcells0);
459
460 vtkSmartPointer<vtkIdTypeArray> contactcells1 = vtkSmartPointer<vtkIdTypeArray>::New();
461 if (contactcells1)
462 {
463 contactcells1->SetName("ContactCells");

Callers

nothing calls this directly

Calls 15

GetContactCellsMethod · 0.95
GetNumberOfContactsMethod · 0.95
GetInformationObjectMethod · 0.80
SetLinesMethod · 0.80
SetVertsMethod · 0.80
InvokeEventMethod · 0.80
IntersectWithOBBTreeMethod · 0.80
CheckAbortMethod · 0.80
SetScalarsMethod · 0.80
SetTableRangeMethod · 0.80
GetTableValueMethod · 0.80

Tested by

no test coverage detected