【正文】
nbounding box algorithms, the simplicity of AABB is good, but its tightness is poor, after the object rotating, AABB should be do the same rotation and update. Either geometrical body or intersecting detection of Sphere is very simple, but its tightness is very poor. The tightness of OBB is best, and it can multiply shorten the number of bounding boxes involved in intersecting detection and basic geometrical elements, after geometrical object rotating, it only need to do the same rotation for the substrate of OBB. The total performance of OBB is better than AABB and Sphere. For the collision detection of rigid bodies, OBB is the better choice, but, after the rigid body deforming, the update of OBB tree is a difficult problem which is not solved so far. Both simplicity and tightness of FDH are very good, because the normal vectors of all surfaces of bounding box e from the fixed direction vector set. After object rotating, calculation of FDH is not plex, and also, after object deforming, it can regenerate bounding boxes for the deformed object rapidly.3. Fixed Directions Hulls (FDH)According to above mentioned, OBB and FDH are good, although, both OBB and FDH can apply tothe collision detection of rigid body, FDH is better than OBB. In FDH, the normal vectors of all surfaces of bounding box e from the fixed direction vector set D, and the direction vectors in fixed direction set D are collinear and vector pairs of opposite direction. There are k vectors in fixed direction set D, so there are k/2 vector pairs which are collinear and opposite direction. FDH not only has good tightness, but also has the advantage that bounding box is simple, hence, this paper adopts FDH to realize collision detection. The k value in fixed direction D is larger, the tightness of bounding box is better, and the needed number of bounding boxes when detecting is smaller, but, with the growing of k value, the needed time of constructing bounding box is adding. In view of tightness and plexity of constructing bounding box, this paper chooses FDH14 (k=14) to ensure the time needed by constructing bounding box and detecting is shortest.To judge if the objects A and B intersect in space, the core of collision detection algorithm is traversingtheir respective FDH tree to identify if some section of A collides with some section of B in current position. The basic idea of FDH is that the bounding box of simple geometry characteristic is used toreplace the plex geometry object to implement detection, if the bounding boxes at two nodes do notintersect, the subsets of basic geometrical elements of the objects enveloped by them will not intersect, so that the further detection of subset elements is not needed. Simulating collision detection of bounding boxes is easy: as long as a direction is found, projection intervals of two FDH in this direction do not overlap, they can be judged they do not intersect。 if their projection intervals in all direction pairs in D overlap, they can be judged they intersect, namely there collision between them. Fixed direction vector set D is posed of seven vector pairs. When implementing intervals overlapping detection, if detection result is overlapped in a direction, in order to find a not overlapped interval as soon as possible, another direction which has great difference with this direction is chosen to acplish detection, if the needed direction is found, the querying will be over.4. Collision Detection StepsIn terms of the workpiece, tool and so on in NC machining simulation system is represented by tripatch model, the collision detection is really judging tri patch of one object if intersect with the tri patch of another object. Virtual machining environment includes: machine tool guideway, headstock, end bracket, chuck and tool holder and so on many objects, directly implementing intersection operation for the tripatches of workpiece and tool, headstock and tool needs many times, which is hard to satisfy the realtime of virtual machining.When processing the plex scene including many objects, this paper adopts detecting step by step to realize collision detection. First step is crudity detection, in this step, many objects which do not obviously intersect are rapidly excluded。 the second step is further detection, this step detect the latent intersection sections by further detecting the crossed object pairs。 last is subtlety detection, this step can precisely detect if have collision between basic volumes or polygon patches. As following: Crudity detectionIf virtual environment includes more objects, in order to improve detection efficiency, some optimization methods should be adopted to exclude the objects which do not collide with each other, and find the crossed object pairs or latent intersection intervals. This paper uses AABB method to realize crudity detection, this method respectively projects AABB of all objects at x, y, z the three coordinate axes,and arranges sequence for boundary value of projection interval of each object at each coordinate axis. Ifthe projection intervals of bounding boxes of two objects at all coordinate axes are overlapped, the bounding boxes of the two objects will be crossed. As shown in Fig. 2.In this algorithm, the projections of AABB of all objects at three coordinate axes form linked list, and the linked list is updated in real time, at last, the object pair which overlap at three axes can be gotten by summarizing, and the object pair can be input object for next subtlety detection. By projecting AABB at one coordinate axis (for example x axis), a set of intervals can be gotten, after arranging intervals sequence, the object which does not intersect with any other objects can be excluded. As shown the object C in Fig. 3. If the overlapped object pairs are only a few, the detection can be implemented in sequence to detect thosemobjects if have collision at other coordinate axes (y axis, z axis). This method not only can sav