Laparoscopic surgery tools can be seen as cylinders of constant section sand of varying length, since user may pull or push them more or less widely into the patient's abdomen. In the remainder of the paper, we call P0 the fixed point where the axis of a tool starts ( P0 is the center of the small opening the tool passes through), and P the extremity of the tool. Static collision detection between a tool and the polygonal mesh representing the organ can easily be performed by associating an orthographic camera to the tool.
The camera is positioned at point
P0 and the viewing direction
is set to
(P0,P), thanks to the function
gluLookAt(). Near and far parameters are
respectively set to 0 and to
.
The tool
section is taken into account by setting the
left, right, top and bottom parameters of the camera according to the
shape of the real tool extremity. The corresponding code is:
glMatrixMode (GL_PROJECTION); glLoadIdentity (); // compute distance between // far and near clipping planes l = norm(P-Po); // push the orthographic camera on // projection matrix stack glOrtho(-s,s, -s,s, 0, l); glMatrixMode (GL_MODELVIEW); glLoadIdentity (); // move the camera to set eye at Po // and looking at P gluLookAt(Po[0], Po[1], Po[2], P[0], P[1], P[2], up[0], up[2], up[1]); // redraw the scene with some glNames // pushed redraw();For our application, we simply want to detect which faces of the liver are in contact with the tool. Thus we use the select picking mode, with one different primitive name per liver face: each glBegin(GL_TRIANGLES) is preceded by glLoadName(t) where t is the triangle number. At the end of the rendering, the first row of the select array contains the number of hit triangles, then for each triangle items consisting in the z min and max and the face number. The exact coordinates of the intersection points could be obtained using the feedback mode.