- This topic has 2 replies, 2 voices, and was last updated 5 years, 7 months ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.
Home › Forum › SOFA › Using SOFA › [SOLVED] How to declare components in scene files
Tagged: 64_bits, component declaration, SOFA_1806, Windows_7
I am learning how to use Sofa and I have hard time to figure out how to provide all necessary information with component declaration. For example, I learned from tutorial that when I declare “StiffSpringForceField”, I have to set spring = “object1 object2 ks kd …”. From the API documentation I realized that this parameters are used in constructor for StiffSpringForceField. To my understanding, in C++ I have fixed number of 4 parameters for object1, object2, ks and kd, but these parameters may be vectors (in case of multiple springs). Is that correct? Are vectors only for indices of first and second objects, while the ks and kd are the same for all springs? Or we can have different ks and kd for different springs in single StiffSpringForceField? Anyway, in scene xml I provide all four parameters for the first spring, then four parameters for the second spring etc. And I have to use the “spring” keyword that I don’t know where from it comes.
Is there any documentation for writing scene files that provide all necessary information (all options) for each component declaration and specification? Is there any rule how this information can be deduced from API documentation?
Hi @simoncic
The StiffSpringForceField inherits from the SpringForceField where you can see the definition of this “spring” option (in LinearSpring). It corresponds to a vector (each spring can therefore be different from another) of 5 variables:
For instance:
spring="0 9 100 5 3.5
1 10 500 5 3.5
2 11 500 5 3.5
... "
You can find an example in examples/Components/forcefield/StiffSpringForceField.scn
I hope this helps.
Best
Hugo
Thanks!
WARNING
The forum has been moved to GitHub Discussions.
Old topics and replies are kept here as an archive.