Home › Forum › Community Help › Programming with SOFA › Collision response with bending behaviour
Tagged: 64_bits, MacOS, Plugin_other, SOFA_1912
 This topic has 5 replies, 3 voices, and was last updated 5 days, 5 hours ago by luong.

AuthorPosts

28 October 2020 at 22 h 04 min #17469
Hello,
I’m developing a plugin in SOFA at the moment where I want to be able to simulate bending behaviour of materials/objects under light induction. For that purpose I have started to implemented a collision pipeline by implementing own Collisionmodels (based on Point, Cube and TriangleCollisionModels), Intersection, Detection and ContactMapper classes. However I’m stuck at how to implement the collision response/ bending behaviour with the ContactMapper. There are the collision response methods “addPoint” and “addPointB”, that can be implemented, but I am not sure what they do. What would be the best approach to code the collision response for bending behaviour?
An idea would be to adapt the distances between the contact points of the lightactuated object on collision side, which would result in a bending behaviour of the object. Is that possible or should I rather use ForceFields in that case?
I also need information about the bending angle at runtime. Should/Could I calculate the bending angle in the ContactMapper or is another class more suitable for that kind of calculation?
Thank you very much!
Kind regards!2 November 2020 at 17 h 27 min #17522Hello @anluong,
I’m sorry, your question leaves me somewhat confused ^^
As far as I understand, this lightbased actuator works because in some way light induces stress in the material that manifests itself as bending. However, I cannot follow the jump towards the implementation of a Collision Pipeline. Why would the collisions be necessary to model the bending? Or is the collision related to an external object that you want to push?
Could the bending be otherwise modeled by forces that contract/extend the material on one side of the actuator (a flat one, I’m assuming), which leads to bending? In that case you might want to try implementing a ForceFieldComponent or a Constraint.
Best
Stefan
2 November 2020 at 17 h 57 min #17523Hello Stefan,
thank you for your quick reply!
I was assuming that I would need a separate collision pipeline, since I want to detect and calculate the collision points between my “light source” and “lightactuated material” in order to apply forces mostly on these collision points.
The bending should be modeled by forces that contract/extend the material on one side of the actuator, but I thought calculating the collision points would be necessary since the bending should happen in the collision area.Kind regards
Lulu2 November 2020 at 18 h 13 min #17526Hey Lulu,
so, I’m not an expert in the handling of collisions in SOFA, but as far as I can tell, the main idea is to calculate the locations of contact interactions (which is similar to what you want) and then solve for the forces and deformations due to these interactions (not what you want).
I can try to find out if it’s easy to use the functionality available in the Collision Pipeline to calculate the intersection point of a mesh with a ray. In the meantime, you can checkout the component ConstantForceField existing in SOFA. There is an example scene available with the code:
sofa/src/examples/Components/forcefield/ConstantForceField.scn
You can play around with it and see if you can figure out how to use one or more of these components to apply a force like you want, i.e. assuming a known intersection point of the ray of light with the actuator.
Stefan
3 November 2020 at 12 h 35 min #17535Hello @anluong,
Maybe the easiest way to do what you want is to leave the collision detection pipeline as it is. You could use a dummy LineModel to represent your ray and whatever collision model already existing in SOFA to model the material supposed to bend.
However, regarding the response, I understand that you want to change what would be a standard contact behaviour by applying a bending force on your material, that could be done by changing dynamically its rest position. If you look at Friction contact, you have an activateMappers virtual function that you can override by your version to implement your response. For example I guess you would remove the creation of the unilateral constraints. Regarding the addPointB method, I think it has the role to create a mapping to map the contact position to the actual degrees of freedom of the material.Good luck!
Olivier18 November 2020 at 20 h 57 min #17724Hello @olivier,
thank your for your advice. I’m currently trying to implement this approach and I was wondering how I could change the rest position. Assuming my bending object would be a cuboid, do I change the coordinates of the vertices or do I have to change the coordinates of each point (of my mesh for example). Or is there another better approach?
Kind regards
Lulu 
AuthorPosts
 You must be logged in to reply to this topic.