Collision Detection Capabilities in 3D Slicer

Thank you very much for the reply and for the example provided. My case is similar, in that I have a sphere and a cube in the Slicer scene, but they are stationary VTK objects. They can; however, be translated by the user and moved around the scene.

I have tried following the example in how the transforms were set, but I still have Slicer 4.13 crashing on me upon the GetNumberOfContacts() function call.

This is what my code looks like so far:

image

The transforms transform0 and transform1 are initialized using vtkTransform() and are initially set to the centers of the VTK objects using vtkTransform.Translate(). As the user moves the objects around, I update the transforms for each object using vtkTransform.Translate() to have the transforms fixed to the center of the objects.

I tried printing the output of the collision filter using the GetOutput() call for one of my VTK objects, and this is the debug trace I get:

vtkPolyData (000001E17CFD33F0)
Debug: Off
Modified Time: 418414
Reference Count: 2
Registered Events: (none)
Information: 000001E1569BECA0
Data Released: False
Global Release Data: Off
UpdateTime: 0
Field Data:
Debug: Off
Modified Time: 418411
Reference Count: 1
Registered Events: (none)
Number Of Arrays: 0
Number Of Components: 0
Number Of Tuples: 0
Number Of Points: 0
Number Of Cells: 0
Cell Data:
Debug: Off
Modified Time: 418414
Reference Count: 1
Registered Events:
Registered Observers:
vtkObserver (000001E15699F7D0)
Event: 33
EventName: ModifiedEvent
Command: 000001E1569BEAC0
Priority: 0
Tag: 1
Number Of Arrays: 0
Number Of Components: 0
Number Of Tuples: 0
Copy Tuple Flags: ( 1 1 1 1 1 0 1 1 1 1 1 )
Interpolate Flags: ( 1 1 1 1 1 0 0 1 1 1 1 )
Pass Through Flags: ( 1 1 1 1 1 1 1 1 1 1 1 )
Scalars: (none)
Vectors: (none)
Normals: (none)
TCoords: (none)
Tensors: (none)
GlobalIds: (none)
PedigreeIds: (none)
EdgeFlag: (none)
Tangents: (none)
RationalWeights: (none)
HigherOrderDegrees: (none)
Point Data:
Debug: Off
Modified Time: 418413
Reference Count: 1
Registered Events:
Registered Observers:
vtkObserver (000001E15699F710)
Event: 33
EventName: ModifiedEvent
Command: 000001E1569BEAC0
Priority: 0
Tag: 1
Number Of Arrays: 0
Number Of Components: 0
Number Of Tuples: 0
Copy Tuple Flags: ( 1 1 1 1 1 0 1 1 1 1 1 )
Interpolate Flags: ( 1 1 1 1 1 0 0 1 1 1 1 )
Pass Through Flags: ( 1 1 1 1 1 1 1 1 1 1 1 )
Scalars: (none)
Vectors: (none)
Normals: (none)
TCoords: (none)
Tensors: (none)
GlobalIds: (none)
PedigreeIds: (none)
EdgeFlag: (none)
Tangents: (none)
RationalWeights: (none)
HigherOrderDegrees: (none)
Bounds:
Xmin,Xmax: (1, -1)
Ymin,Ymax: (1, -1)
Zmin,Zmax: (1, -1)
Compute Time: 0
Editable: false
Number Of Points: 0
Point Coordinates: 0000000000000000
PointLocator: 0000000000000000
CellLocator: 0000000000000000
Number Of Vertices: 0
Number Of Lines: 0
Number Of Polygons: 0
Number Of Triangle Strips: 0
Number Of Pieces: 1
Piece: -1
Ghost Level: 0

Interestingly, it seems that all the values are ‘‘null’’, i.e. no geometrical properties of the VTK object seem to be captured or processed, with most values found to be 0.

I would appreciate any debugging help or insight into this matter. Thank you.