Fast Collision Detection for Haptic Displays Using

0 downloads 0 Views 81KB Size Report
the user is inside the defined geometry and the calculation of the point on the surface ... Our hybrid algorithm uses a voxel-map and a polygon-mesh based method for ... This process of calculating a reaction force ... As it is recognizable in Figure 1, the collision detection is one of the central parts of ..... unfilled circles SCPs).
Proceedings of the Conference on Simulation and Visualization 2002, SCS—Europe BVBA, Ghent, pages 289-300, Belgium 2002

Fast Collision Detection for Haptic Displays Using Polygonal Models Henry K¨onig and Thomas Strothotte∗ Otto-von-Guericke University Magdeburg

Abstract Haptic displays provide force feedback for a wide range of applications. During the haptic representation of virtual objects, one of the central tasks is to find out whether the user is inside the defined geometry and the calculation of the point on the surface to which the reaction force is directed. Our paper presents a new fast algorithm for collision detection for point-interaction devices. The design was adopted to the special situation during haptic rendering such as the possibility of exploiting coherence, the fact that high quality models are required, and the lesser number of polygons within the scene. Our hybrid algorithm uses a voxel-map and a polygon-mesh based method for collision detection and works almost independently of the complexity of the scene.

1

Introduction

Haptic displays enhance virtual worlds with additional haptic feedback. To calculate this feedback for the user interaction, point-based devices like the PHANToM (SensAble Inc.) only measure the end point or haptic interface point (HIP) of the display and check if this end point is inside the virtual objects. If so, the depth of the penetration is determined as the distance between the HIP and a corresponding surface contact point (SCP) so that the size of the reaction force can be calculated. For frictionless materials, the direction of the reaction force is perpendicular to the surface. This process of calculating a reaction force for a given HIP is known as haptic rendering (see [SBM+ 95]). As it is recognizable in Figure 1, the collision detection is one of the central parts of a haptic rendering algorithm. Once during each execution of the servo-loop, the virtual position of the device has to be compared with the geometric information in the data base. For a sufficiently good stiffness and because of the sensitivity of the human tactile system a high update rate is required (see [TSEC94], about 1 kHz for the PHANToM). Therefore, the collision detection is very time critical. Short delays during the execution can be the cause of instabilities of the haptic rendering which can be sensed as vibrations (see [MOS+ 90]). As opposed to collision detection algorithms used for graphical applications (see [LG98]), algorithms for haptic rendering have to determine the SCP for any further calculations. Since the necessary calculations only depend on HIPs there are different possible SCPs for each HIP. Hence, current solutions exploit simple methods like the nearest surface point (see [MS94]) which has different disadvantages (see Figure 2) or have to use different more ∗ School

of Computer Science, Department of Simulation and Graphics, D-39016 Magdeburg, Germany

Geometric and Material Data Base

Collision Detection

Mechanics of Interaction

Force Mapping

Servo−Loop Forward Kinematics

End Effector

Inverse Kinematics

User

Figure 1: Overview of haptic rending. complex techniques like contraints (see [Sha98]) or the God-object method (see [ZS95]) to solve this problem.

Figure 2: Both Figures represent the haptic collision detection problem on virtual objects (filled circles show HIPs, unfilled circles SCPs). The left Figure shows a break through situation. The last HIP is outside the virtual object, but normally a reaction force should be generated because the user is moved through the object. The right Figure illustrates the arising direction problem. Theoretically, both reactions are possible. In this paper we describe a new method for haptic collision detection. Our approach combines two tasks, fast collision detection and the calculation of the SCP, in one algorithm using the same data structures. To analyze the situation during the haptic rendering, we considered the behavior of the user during the exploration of haptic scenes to find the crucial parts for an acceleration. Our algorithm does not subdivide the whole scene. Instead, it treats the included objects so that it is possible to use dynamic objects. Furthermore, this method is more effective than the standard method and is almost independent of the complexity of the displayed geometry.

2

Collision Detection

The problem of collision detection between geometric objects is fundamental in computer graphics. Applications like computer games, physically-based modeling, or VR environments need a fast and accurate interference detection as well as a calculation of contact points. Currently, the collision detection continues to be a bottleneck for such applications, even though there are a lot of techniques with different advantages and disadvantages. Applications using graphic and haptic interaction have different requirements regarding such algorithms.

2.1 Graphic Interaction Normally, these applications work with large complex geometries composed of hundreds of thousands of polygons. Depending on the utilization, an interference detection between all objects in the environment is needed. But not in each case an accurate calculation of intersection points is necessary, it will be sufficient to determine the penetration of one object into another. There are also differences in the use of the term real-time. For these applications, a refresh rate of 30-40 executions per second is sufficient for a smooth rendering or interaction. Furthermore, discontinuities of the smoothness during the execution only have a disturbing character (see [LMCG96] and [LG98]). Corresponding to the amount of applications there are a lot of different algorithms. Almost all of the more efficient algorithms have a similar structure consisting of two different parts. For a first inaccurate fast intersection test they use an approximation of the geometry like bounding boxes or bounding spheres so that the more complex calculations are simplified. The second, more accurate part uses voxel representations (see [Gib95]), hierarchical spatial data structures like trees of oriented bounding boxes (OBB-trees, see Figure 3, [GLM96]), spheres (see [Hub95]), or binary space partitioning trees.

Figure 3: This is an example for a recursive construction of an OBB-tree.

2.2

Haptic Interaction

The starting point for a haptic point-interaction is different from the one in graphical applications. In haptic rendering the collision detection is used to determine a penetration of HIPs or of line segments connecting two of them into the virtual objects within a scene.

The worlds are smaller and the geometries are less detailed so that this application works with ten thousands of polygons. Furthermore, an accurate calculation of the intersection point is needed for the determination of the SCP (see Figure 4). Because of the high refresh rates the term real-time means about 1.000 executions per second (see [TSEC94]). These are necessary for good haptic immersion. SCP

P1

Distance

Intersection Point P2

Figure 4: The situation shown describes the normal situation during the penetration of an object. The points P1 and P2 represent the HIPs which are connected by a line. Currently, there are also different algorithms for this problem using approaches that are known from graphic interaction like combinations of bounding boxes and OBB-trees (see [LS97], [GLGT00]). These OBB-trees have the disadvantage that the depth of the tree as well as the number of intersection tests depend on the number of polygons. Although one intersection test with an oriented box is really fast and trivial, each step needs a matrix multiplication that transforms the HIP into the local coordinate system. More critical, however, is the fact that this method provides no support for the determination of the needed SCP. Simple applications use the nearest surface point of the current HIP as SCP. Using this method, the results are not stable in each case so that additional algorithms are needed (see [ZS95]). These algorithms analyze the different cases to find a better solution and reduce the speed of the collision detection. Another algorithm uses an alternative and smarter way. This approach collects spatial information about the geometry like polygons, lines, and vertices as well as structural data about the connections between them in a hierarchical data base. Then, after an intersection with a polygon was found, the shortest distance between the current HIP and the connected surfaces is determined. This surface is used to calculate the SCP (see [HBS97]). The results of this algorithm are comparable with the previously explained method. But it is impossible to reduce the necessary distance tests during the first approach. Furthermore, there is no higher spatial organization of the polygons that accelerates intersection tests. The most important advantage of this technique is the independence of the calculation speed of the number of polygons.

3

Collision Detection Algorithm

As discussed in Section 2.1, collision detection algorithms used in graphics applications are usually based on the use of OBB-trees. On the other hand, haptic rendering imposes certain

requirements on the collision detection that have not been considered in these algorithms. However, the use of a mesh-based algorithm such as described in Section 2.2 rather than a OBB-trees can yield a more efficient algorithm. Using a point-based device, the exploration of objects in the scene is slower because the interaction is different from an interaction using the whole hand. Furthermore, the refresh-rate of haptic applications is much higher so that, in general, the distance between two HIPs is smaller. In addition, the possibility to use the coherence between two queries for an acceleration is much higher in haptic rendering than it is in graphic rendering. The models used in haptic applications are different as well. For example, the objects are not as detailed as in graphics applications because too many unneeded details are hard to perceive by touch and increase the costs of the collision detection. Furthermore, the quality of models for haptic rendering has to be much higher in terms of correctness to prevent discontinuities during the haptic rendering. These discontinuities are not visible but sensible. For instance, users can penetrate into objects if the polygon mesh is not closed.

3.1 Basic Idea Inspired by the techniques described in Section 2, our approach combines the different algorithms and tries to eliminate their disadvantages. Our basic idea is based on the used ray-polygon-intersection test. This is the last test in each collision detection that determines the intersected polygon and calculates the accurate intersection point P . Some of the fastest algorithms (see [Bad90] and [Hai94]) use barycentric coordinates α and β: −−→ −−→ −−→ V0 P = α V0 V1 + β V0 V2 (1) of a triangle V0 , V1 , V2 for the calculation (see Figure 5).

V2 P V0

−−→ β V0 V2 −−→ α V0 V1

V1

Figure 5: The illustration above shows the barycentric coordinates. In the beginning, these algorithms calculate the intersection between the ray and the plane that is defined by a triangle. Then, the barycentric coordinates of the intersection point are calculated:   Pi1 − V0i1 V2i1 − V0i1 det Pi2 − V0i2 V2i2 − V0i2   (2) α= V1i1 − V0i1 V2i1 − V0i1 det V1i1 − V0i2 V2i2 − V0i2

and

  V1i1 − V0i1 Pi1 − V0i1 det V1i1 − V0i2 Pi2 − V0i2  . β= V1i1 − V0i1 V2i1 − V0i1 det V1i1 − V0i2 V2i2 − V0i2

(3)

α ≥ 0 and β ≥ 0

(4)

α+β ≤1

(5)

If both conditions are true and holds as well, the calculated point is inside the triangle. Using barycentric coordinates it is also posible to determine the interpolated normal of the point that is used for smoothing the surface. Besides beeing faster than previous methods there are additional advantages. First of all, the results can be used for a navigation on the surface. In addition, if the test failed and the point is outside the triangle, the barycentric coordinates include information about the position of the HIP in relation to the tested tringle. Depending on the possible values, six regions around the triangle can be defined. Using results of the intersection test, the region can be determined that contains the searched triangle. To navigate on the surface the third barycentric coordinate γ is used which is fast to compute: γ = 1 − α − β. (6) From the view of navigation, an easy case is given if one of the three barycentric coordinates is negative. Then, the directly connected triangle should be used for the next test because it is very probable that this is the intersected triangle. If two of the coordinates are negative, a triangle should be tested that shares the corresponding point (see Figure 6).

α0 γ>0

α0 γ0 β>0 γ0 β