22 October 2020 at 0 h 53 min #17438BenjaminParticipant
- University of Auckland
Can anyone help me with the meaning of variable CollisionElement and CollisionModel? From what I am understanding, the CollisionElement refers to the unit like point, edge, triangle and CollisionModel refers to bounding volume? The explanation either in the documentation or code comments is vague. Can anyone give me more details about these two variables?
The problem I have currently is that I don’t know how to extract the indices position. For example, if an edge intersects with a triangle, how to know the position of points and vertices on the edge and triangle? I found in BruteForceDetection it uses CollisionElementIterator to switch the element. But the CollisionELementIterator only indicates the address not exact value.
Do you have any suggestion to help me understand when go through the code? Really appreciate for your help.
Ben30 October 2020 at 15 h 24 min #17498HugoKeymaster
- SOFA Consortium
Good question, it’s nice to see you digging in the code.
CollisionElement in SOFA is implementing : CollisionElementIterator. From the API documentation, you can read that : you can think of a CollisionElementIterator as a glorified pointer to a collision element. It is only there to create a reference to it, not to actual contain its data. Classes derived from TCollisionElementIterator does not store any data, but just provide methods allowing to access the additionnal data stored inside the derived CollisionModel. For instance, the Cube class adds the minVect() / maxVect() methods to retrieve the corners of the cube, however this data is not stored inside Cube, instead it is stored inside the CubeData class within CubeModel.
CollisionModel is the model describing the kind of primitives which will be used for the collision: line (edge), triangle, quad, tet, capsule, cylinder etc.
To see how collision information is stored, you can have a look to the ContactListener for instance. You will notice how maps are created, storing information relate to object1 and object2 involved in the collision.
Hugo20 November 2020 at 3 h 21 min #17771BenjaminParticipant
- University of Auckland
Sorry for late reply and thanks for the explanation.
I have sort of figuring out the usage of CollisionElemenIterator. But there is another problem appears. My collision algorithm requires to compare the node positions in previous frame and current frame. Does SOFA store all nodes’ old positions? From what I have seen in Intersection either BaseProximityIntersection or other intersection methods, none of then applied the node position from previous. All of them are using current position to detect the collision. Could you give me some advice on this one?
- You must be logged in to reply to this topic.