collision between two tubes

Hi everyone,
I try to use vtkCollisionDetectionFilter to detect collision between two tubes that created with vtkTubeFilter, but vtkCollisionDetectionFilter can not detect it.
when i write and read one tube as STL file, it works properly.
how can i solve this problem without writing as STL file.

Hi Jaafar,

Are you looking to detect cells who collide or if the tubes collide at all?

You can try vtkOverlappingCellsDetector. It counts the number of times cells overlap each other in the input data set / composite data set in an output cell array. You’d have to create a vtkPartitionedDataSet composed of 2 partitions: one per tube.

It is a fairly recent filter, so I don’t know what version of it is in 9.0. There were a few bug fixes and enhancements for sure in this filter since 9.0 was released.

Thanks yohann,
In my code one tube rotates around a vector and it should be stopped when first contact occured (Number Of Contacts() > 0).
In fact Number Of Contacts is checked after each step of rotation.
Is there any way to convert tube data type so vtkCollisionDetectionFilter can work properly.

The filter I talked about would be too slow. It is intended to check colliding cells inside a data set, not between data sets. So we’d better stay with the collision detection filter.

When you say it doesn’t work when you don’t write as STL file, what are you writing it as?

In first condition i give the vtktubefilter output to the collisiondetection, in this case it doesn’t work.
in second condition i write and read vtk tube output as a STL file and give the STL file output to the collisiondetection, in this case it works properly.

Thanks yohann. I found the solution. Type of vtkTubeFilter cells is TriangleStrip while collision required Triangle cell. vtkTriangleFilter should be used after vtktubefilter and before collisiondetection .

1 Like