Closed antennae closed 1 day ago
Hello,
It seems like the SpringForceField
is doing what you expect from the MeshSpringForcefield
. The MeshSpringForcefield
, as its name states, is meant to add springs on edges based on the mesh. The mesh is its input data to create the springs. If you don't want to use the mesh to define the springs and want to define them by hand, then you should use the SpringForceField
.
Maybe I didn't understand your need well, if so, please tell me why you can't use the SpringForceField
and need to use the MeshSpringForcefield
but without taking the mesh information into account ?
Hello,
It seems like the
SpringForceField
is doing what you expect from theMeshSpringForcefield
. TheMeshSpringForcefield
, as its name states, is meant to add springs on edges based on the mesh. The mesh is its input data to create the springs. If you don't want to use the mesh to define the springs and want to define them by hand, then you should use theSpringForceField
.Maybe I didn't understand your need well, if so, please tell me why you can't use the
SpringForceField
and need to use theMeshSpringForcefield
but without taking the mesh information into account ?
I think the point is that the behavior changed on MeshSpringForceField between the old and new version without a warning to users.
Hi,
Yes, SpringForceField
is doing what i expected and it works well.
I was actually working with a scene that was created in an older SOFA version, which creates springs using indices with MeshSpringForceField
. And in the newer SOFA version, the behaviour of MeshSpringForceField
changed and the scene doesn't work anymore. I have to do some research to find out why.
So in my opinion, this behaviour change can be confusing for users working with older scenes and a clearer guidance could be very useful.
OK I get it, we can add a warning message in the init of MeshSpringForcefield to warn when the data is set. Thank you !
TEll me if that solves you issue : https://github.com/sofa-framework/sofa/pull/5136
Thanks for the updates! I just tested and it did solve my issue.
Problem
Description
MeshSpringForceField
fails to create springs based on specified indices. Instead, it always derives the springs directly from the topology.This behavior appears to have changed following PR #4649.
Previously:
MeshSpringForceField::init()
created springs based on topology, then calledStiffSpringForceField::init()
.StiffSpringForceField::init()
replaced these topology-based springs with new ones derived from the specified indices.Currently:
MeshSpringForceField::init()
still creates springs based on topology, but now callsSpringForceField::init()
.SpringForceField::init()
keeps the topology-based springs, basically ignoring any specified indices.As a result, it is no longer possible to create springs based on indices using
MeshSpringForceField
. However, SOFA does not provide a warning or error when indices are specified but unused, which can lead to confusion.Steps to reproduce Attempt to add springs using
MeshSpringForceField
by specifying indices and lengths.Expected behavior Springs should be created using the specified indices and lengths.
Example
Context
Below are screenshots comparing the behavior of
MeshSpringForceField
andSpringForceField
when trying to create a spring between points 1 and 3.using
MeshSpringForceField
:using
SpringForceField
:Example Scene:
Example Mesh:
Proposed fix
MeshSpringForceField
.indices1
andindices2
are specified but ignored.