Home › Forum › SOFA › Using SOFA › [SOLVED] Vertices from .obj are moved
Tagged: 64_bits, Linux_ubuntu, MechanicalObject, Mesh, SOFA_1608, vertex, writestate
- This topic has 6 replies, 2 voices, and was last updated 7 years, 5 months ago by Hugo.
-
AuthorPosts
-
22 June 2017 at 16:17 #9344Cristóbal RoderoBlocked
Hi everyone,
I’m doing a simulation where I get the topology from mesh/cube.obj. I’m fixing all the vertices with FixedConstraint and writing out the final state with WriteState. My surprise was to find out that, even in the initial position the vertices are moved from where they should be at.
For example, the last vertex should be (as is in the .obj) in (1,1,1) but in the file I generate is written (1.02,1.02,1.02).Is this common?
Regards,
Cristóbal23 June 2017 at 17:40 #9347HugoKeymasterHi Cristóbal,
No, it isn’t common.
Could you send us the scene you wrote (mainly the loader, mechanicalobject, topo and writestate) ? I will test it locally.Cheers,
Hugo
25 June 2017 at 12:50 #9360Cristóbal RoderoBlockedYes, tell me if you need more:
<SparseGridTopology name="sparseGridTopology3" fileTopology="mesh/cube.obj" n="2 2 2" /> <MechanicalObject template="Vec3d" name="mObject1" position="0 0 0" velocity="0 0 0" force="0 0 0" externalForce="0 0 0" restScale="1" showObject="0" showObjectScale="1" showIndices="0" showIndicesScale="0.002" /> <FixedConstraint template="Vec3d" name="fixedConstraint3" indices="0 1 4 5" /> <WriteState name="writeState1" listening="1" filename="FinalPos_SOFA" />
Thanks for the quick reply!
Cheers,
Cristóbal
25 June 2017 at 21:38 #9361HugoKeymasterHey Cristóbal,
This isn’t normal indeed and I get the same issue. I reported this behaviour in an issue on GitHub, you can further discuss it on GitHub.
I think it is somehow related to the computation of the bounding box of the object (in SparseGrid) influencing the min and max data.
Anyway, if you just want to create a grid, you can bypass the problem by using a RegularGrid instead of a sparse one:
RegularGridTopology name="sparseGridTopology3" min="-1 -1 -1" max="1 1 1" n="2 2 2" />
Thank you again for the notice
Hugo
29 June 2017 at 09:22 #9372Cristóbal RoderoBlockedThanks Hugo,
but now I have problems with the grid resolutions. If I change to n = “3 3 3” for example, with the SparseGrid I get a cube formed by 2x2x2 sub-cubes; but with the RegularGrid I get an error and the simulation doesn’t work.
The idea of the simulation I’m trying to do is to fix the vertices when y = 0 (simulating the floor) but with different “structures” (I mean, different subdivisions) of the cube.
Sorry for the inconveniences.
Thanks,
Cristóbal29 June 2017 at 09:48 #9373Cristóbal RoderoBlockedProblem solved!
It seems that when I change the grid resolution in the Sofa Modeler, it keeps the edges, quads and hexaedra from the previous resolution so, if I set them to 0, it automatically set the adequate amount of edges, quads and hexaedra.
Lot of thanks!
Cristóbal
29 June 2017 at 09:55 #9374HugoKeymasterHi Cristóbal,
Good to hear!
Setting n = “3 3 3” means that you will have 3x3x3 vertices in x, y and z. In other words, 2x2x2 sub-cubes. So this is normal.But the RegularGrid should be working this way:
<Node name="root" dt="0.02"> <VisualStyle displayFlags="showBehaviorModels showForceFields showVisual" /> <CollisionPipeline verbose="0" /> <BruteForceDetection name="N2" /> <CollisionResponse response="default" /> <DiscreteIntersection/> <Node name="LiverFFD-lowres"> <EulerImplicit /> <CGLinearSolver iterations="25" tolerance="1e-5" threshold="1e-5"/> <MechanicalObject /> <UniformMass totalmass="100.0" /> <RegularGrid nx="5" ny="3" nz="3" xmin="-1" xmax="2" ymin="-1" ymax="2" zmin="-1" zmax="2" /> <BoxConstraint box="-1 -1 -1 2 2 -1" /> <RegularGridSpringForceField name="Springs" stiffness="400" damping="4" /> <Node name="Collision Surface"> <SphereLoader filename="mesh/liver.sph" /> <MechanicalObject position="@[-1].position" translation="-5 0 0" /> <Sphere name="Surf" listRadius="@[-2].listRadius" /> <BarycentricMapping input="@.." output="@." /> </Node> </Node> </Node>
Moreover, avoid the Modeler 😉 it’s considered as deprecated.
HTHHugo
-
AuthorPosts
- You must be logged in to reply to this topic.