Class to check for collisions between two scenes.
Thetype exposes the following members.
Specifies the transformation that will be watched.
Checks if the current moving scene collides with the static scene. This method is automatically called when the transform node given to Activate() is updated (or touched). Returns true if the two scenes collide, false otherwise.
Use multiple threads to compute intersections.
Overrides(Inherited from . SoNetBase.)
Returns the minimum length of a triangle edge.
Gets the Type of the current instance.(Inherited from Object.)
Returns true if multithreaded computation is enabled.
Method called by CheckCollision() for each pair of intersecting triangles found. The method returns false by default and may be overridden.
Specifies the minimum length of a triangle edge.
Calls SetMovingScene(object, System.Int32(0)).
Specifies the scene that will be moved or transformed.
Calls SetStaticScene(scene, System.Int32(0)).
Specifies the scene the moving scene is interacting with.
Returns a string that represents the current object.(Inherited from Object.)
The SoCallbackAction and its addTriangleCallback method. An intersection occurs when a triangle of the first scene intersects a triangle of the second scene. For each pair of intersecting triangles some response methods are called. These response methods can be overridden, for instance,class manages collisions, i.e., it checks the intersection of one scene with a second scene. Both scenes are tessellated into a list of triangles by using an
to highlight the intersecting shape
to highlight the intersecting pair of triangles
to compute points common to the two scenes
to count the number of intersecting pairs of triangles
The SoTransform). The user scene graph must be organized such that the transformation will affect the moving scene during traversal. The static scene is specified by the method and the moving scene by the method .references a static scene and a moving scene (with two SoPaths) and a transformation (with an
The SoCallbackAction) and by building a database as a tree. This database spatially organizes the list of triangles in order to optimize the number of triangle intersection tests. Note that the does not monitor the scene graph. Any modifications to the Open Inventor nodes in the static scene or the moving scene are not reflected in the internal tree database unless or are called again by the application.references a scene by storing its triangle list (see
Howeverwatches for any modification to the given transformation. Each time the transformation changes, an intersection test is done between the two scenes by automatically calling . This method searches for pairs of intersecting triangles in an optimal way. For each pair of intersecting triangles found, the Boolean method is called. By default this method returns false, but in most cases, it will be overridden. If it returns false, the process of searching intersecting triangles is stopped and returns true. If searchNextIntersection returns true, the process continues to search other pairs of intersecting triangles. If searchNextIntersection always returns true, all pairs of intersecting triangles will be found. If the two scenes do not collide, searchNextIntersection is never called and checkCollision returns false. When searchNextIntersection is overridden, some methods can be called to get information about the current pair of intersecting triangles: , , , , and .
In the static or moving scene, each internal node of the tree contains a bounding box while the leaf nodes contain triangles of the tessellation. The maximum number of triangles per leaf (max_triangles_per_leaf) is given as the second argument of the method setMovingScene and setStaticScene. Note how max_triangles_per_leaf affects the computation:
the smaller max_triangles_per_leaf, the deeper the tree.
the smaller max_triangles_per_leaf, the more memory the tree needs
the smaller max_triangles_per_leaf, the quicker thefunction becomes
the smaller max_triangles_per_leaf, the slower the/ functions become
A compromise must be chosen between the initial time to build the tree (setMovingScene/setStaticScene) and the time to check the collisions.
Depending on the total number of triangles and the value of max_triangles_per_leaf, the execution of setMovingScene/setStaticScene can take several seconds. The methods/ and / have been defined and can be overridden to implement, for instance, a progress bar. However, note that the methods / are not called in linear time.
Collision checking will be faster using multiple threads. See the enableMultiThread() method.