Home › Forum › SOFA › Using SOFA › [SOLVED] TetrahedralCorotationalFEMForcefeild used with SurfaceRegistration
Tagged: 64_bits, SOFA_16.12, win10
- This topic has 13 replies, 2 voices, and was last updated 7 years ago by
Lujain.
-
AuthorPosts
-
29 June 2017 at 10:15 #9377
Lujain
BlockedHi everyone,
I am using SurfaceRegistration in my mesh data,adding TriangleFEMForcefield. All seem to work fine. I can export the rest_position(after registration and deformation). I also want to know the status of internal points. The problem is that I used only surface mesh.
Can I use TetrahedralCorotationalFEMForcefeild together with SurfaceRegistration in one scene?
If i can, how to import volumetric mesh?I am waiting for the idea. Thanks in advance.
29 June 2017 at 11:13 #9378Hugo
KeymasterHi Lujain,
What do you mean with SurfaceRegistration ? Is this a scene ? a component ?
I am not aware of it.With a surface mesh, you cannot use the TetrahedralCorotationalFEMForcefield since tetrahedra are needed. Importing volumetric meshes is possible using VTKExporter for instance (or others like GmshLoader).
Hugo
13 July 2017 at 09:36 #9785Lujain
BlockedHi Hugo,
Sorry for very late reply.
I did registration with two data sets of two surface. But I can only get the displacement.
I means that in this case how I can apply force field without tetra meshes?Best!
13 July 2017 at 17:54 #9788Hugo
KeymasterHi Lujain,
Sorry but I really don’t get what you intend to do. Could you explain it more in details (why applying a force on your surface object)
For registration between datasets have a look at the examples in registration plugin.
Did you already build your own simulation ?If you want to create forces, all you need to use is a forcefield (look at the ConstantForcefield which is very basic to have an idea).
HTH
Hugo
21 July 2017 at 08:12 #9819Lujain
BlockedHi Hugo,
Sorry for late reply again!
For the first question, I extracted two surfaces from the volumetric mesh(before and after deformation) and did initial registration between them. Now I want to apply the effect of the registration into the volumetric mesh when it is deformed. But I have no idea how to achieve this. This is why I want to apply force filed on surface. I already build my own simulation and hope that i explained clearly.
Best,
Lujain21 July 2017 at 15:12 #9821Hugo
KeymasterDear Lujain,
If I got you right, you want to register a 3D object. But to do it, you are registering its surface against the surface of the target. Is that correct ?
If so, then I would advise to have a scene looking as follows (just an example based on Registration/examples/ICPRegistration_ShapeMatching_Engine.scn):
<?xml version="1.0"?> <Node name="Scene" gravity="0 0 0" dt="1" > <RequiredPlugin name="Registration" pluginName="Registration" /> <VisualStyle displayFlags="showForceFields showVisual" /> <EulerImplicitSolver rayleighStiffness="0.5" rayleighMass="0.5" /> <CGLinearSolver template="GraphScattered" iterations="25" threshold="1e-008" /> <Node name="target"> <OglModel name="Bone" fileMesh="data/femur_f.obj" color="0.5 .4 1 1" /> </Node> <Node name="PassiveVolumetricMesh"> <MeshVTKLoader name="meshLoader" filename="yourVTKfile.vtk"/> <Mesh src="@loader" /> <MechanicalObject src="@loader" dx="2.5" /> <include href="Objects/TetrahedronSetTopology.xml" src="@loader" /> <UniformMass totalmass="5" /> <TetrahedronFEMForceField name="FEM" youngModulus="1000" poissonRatio="0.4" computeGlobalMatrix="false" method="large" /> <Node name="RegisteredTriangleSurface"> <include href="Objects/TriangleSetTopology.xml" src="@" tags=" " /> <Tetra2TriangleTopologicalMapping input="@../Container" output="@Container" /> <MechanicalObject name="PointSet" /> <UniformMass mass="10"/> <ClusteringEngine template="Vec3d" name="clustering" radius='0.4' number='100' position="@meshLoader.position"/> <ShapeMatching template="Vec3d" name="shapeMatching" iterations='1' position="@PointSet.position" cluster="@clustering.cluster"/> <PositionBasedDynamicsConstraint template="Vec3d" stiffness = '1' position="@shapeMatching.targetPosition"/> <NormalsFromPoints name="NormalsFromPoints" template="Vec3d" position="@PointSet.position" triangles="@meshLoader.triangles" quads="@meshLoader.quads"/> <ClosestPointRegistrationForceField template="Vec3d" sourceTriangles="@../meshLoader.triangles" sourceNormals="@NormalsFromPoints.normals" position="@../../target/Bone.position" triangles="@../../target/Bone.triangles" normals="@../../target/Bone.normal" cacheSize="4" stiffness="1" damping="0" /> <Node name="Visu"> <OglModel name="Visual" fileMesh="data/femur_m.obj" normals="0" color="1 .4 0.5 1" /> <BarycentricMapping input="@.." output="@Visual" /> </Node> </Node> </Node> </Node>
HTH
Hugo
24 July 2017 at 08:42 #9834Lujain
BlockedHi Hugo,
You are right. THis is what i want. But when I use the example you gave, it reminds me to set tetrahedirc topology in TetrahedronFEMForceField. But it seems the mesh has already been the volumetric one.
So I think it may be casued by the line <Mesh src=”@loader” />. After I changed the loader into meshLoader, it reminds me the following errors:
`[ERROR] [Mat] invertMatrix finds too small determinant, matrix = [0 0 0,0 0 0,0 0 0]
[ERROR] [Mat] invertMatrix finds too small determinant, matrix = [0 0 0,0 0 0,0 0 0]
[ERROR] [Mat] invertMatrix finds too small determinant, matrix = [0 0 0,0 0 0,0 0 0]
[ERROR] [Mat] invertMatrix finds too small determinant, matrix = [0 0 0,0 0 0,0 0 0]
[ERROR] [Mat] invertMatrix finds too small determinant, matrix = [0 0 0,0 0 0,0 0 0]I have no idea about how to deal with these kind errors, and you? Thanks very much!
Best,
Lujain24 July 2017 at 09:07 #9835Hugo
KeymasterHey Lujain
Have you tried to replace:
<include href="Objects/TetrahedronSetTopology.xml" src="@loader" />
by :
<TetrahedronSetTopologyContainer name="Container" src="@loader"/> <TetrahedronSetTopologyModifier name="Modifier" /> <TetrahedronSetGeometryAlgorithms name="GeomAlgo" template="Vec3d" />
Cheers
Hugo
24 July 2017 at 09:11 #9836Lujain
BlockedHi Hugo,
Yes i also tried but it didn’t work.
The error seems strange?24 July 2017 at 10:04 #9837Lujain
BlockedHi Hugo,
Here are the data and the scene file that I used.
Can u help me to have a test? The error makes me so confused.Thanks in advance.
Best,
Lujain7 August 2017 at 15:45 #9904Hugo
KeymasterYour transfer is no longer available Lujain, could you resend it, please?
8 August 2017 at 05:27 #9910Lujain
BlockedHi,
Here are the scene and data.
Thanks!11 August 2017 at 17:57 #9915Hugo
KeymasterHey Lujain
You have a MechanicalObject that shouldn’t exist:
<Node name="Scene" gravity="0 0 0" dt="0.05" > <RequiredPlugin name="Registration" pluginName="Registration" /> <VisualStyle displayFlags="showForceFields showVisual" /> <EulerImplicitSolver rayleighStiffness="0.5" rayleighMass="0.5" /> <CGLinearSolver template="GraphScattered" iterations="25" threshold="1e-008" /> <Node name="target"> <OglModel name="Liver" fileMesh="output_liver_1_deformation.obj" material="Default Diffuse 1 0 0 1 1 Ambient 1 0 0 0.2 1 Specular 0 0 0 1 1 Emissive 0 0 0 1 1 Shininess 0 45" /> </Node> <Node name="PassiveVolumetricMesh"> <MeshVTKLoader name="meshLoader" filename="output_liver_1.vtu"/> <Mesh src="@meshLoader" /> <MechanicalObject src="@meshLoader" dx="2.5" /> <TetrahedronSetTopologyContainer name="topo" src="@meshLoader"/> <TetrahedronSetTopologyModifier name="Modifier" /> <TetrahedronSetGeometryAlgorithms name="GeomAlgo" template="Vec3d" /> <UniformMass totalmass="5" /> <TetrahedronFEMForceField name="FEM" youngModulus="1000" poissonRatio="0.4" computeGlobalMatrix="false" method="large" /> <Node name="RegisteredTriangleSurface"> <TriangleSetTopologyContainer name="Container"/> <TriangleSetTopologyModifier name="Modifier" /> <TriangleSetTopologyAlgorithms name="TopoAlgo" template="Vec3d" /> <TriangleSetGeometryAlgorithms name="GeomAlgo" template="Vec3d" /> <Tetra2TriangleTopologicalMapping input="@../topo" output="@Container" /> <UniformMass mass="10"/> <ClusteringEngine template="Vec3d" name="clustering" radius='0.01' number='100' position="@meshLoader.position"/> <PositionBasedDynamicsConstraint template="Vec3d" stiffness ='0.1' position="@shapeMatching.targetPosition"/> --> <ClosestPointRegistrationForceField template="Vec3d" sourceTriangles="@../meshLoader.triangles" sourceNormals="@NormalsFromPoints.normals" position="@../../target/Liver.position" triangles="@../../target/Liver.triangles" normals="@../../target/Liver.normal" cacheSize="4" stiffness="200" damping="0" theCloserTheStiffer="1" /> <Node name="Visu"> <OglModel template="ExtVec3f" name="VisualModel" fileMesh="output_liver_1.obj" material="Default Diffuse 1 1 0 0 1 Ambient 1 0 0 0.2 1 Specular 0 1 0 0 1 Emissive 0 1 0 0 1 Shininess 0 45" primitiveType="DEFAULT" blendEquation="GL_FUNC_ADD" sfactor="GL_SRC_ALPHA" dfactor="GL_ONE_MINUS_SRC_ALPHA"/> <BarycentricMapping input="@.." output="@VisualModel" /> </Node> </Node> </Node> </Node>
On top of this, you can increase the stiffness in ClosestPointRegistrationForceField during the simulation. Here is what I get:
Please, do not forget to cite the plugin & SOFA in your work.
Best regards,Hugo
13 August 2017 at 09:01 #9916Lujain
BlockedHi Hugo,
Ok I will. And thank you very much!
Best,
Lujain -
AuthorPosts
- You must be logged in to reply to this topic.