Home › Forum › SOFA › Using SOFA › [SOLVED] How to get access to the indices in a Map?
Tagged: 64_bits, Linux_ubuntu, python, SOFA_1712
- This topic has 2 replies, 2 voices, and was last updated 6 years, 1 month ago by mbarrow.
Viewing 3 posts - 1 through 3 (of 3 total)
-
AuthorPosts
-
30 October 2018 at 07:03 #12300mbarrowBlocked
I want to map a RegularGridTopology to a TriangleSetTopology.
Although I see an example in examples/Componets/topology/Tetra2TriangleTopologicalMapping.scn I don’t see how I can access the map.For example In python I would like to use a map indice to color all vertices corresponding to an arbitrary tetrahedron.
How could I do that using the maps in Tetra2TriangleTopologicalMapping.scn?
... <Node name="Triangles Mesh"> <TriangleSetTopologyContainer name="Container" /> <TriangleSetTopologyModifier name="Modifier" /> <TriangleSetTopologyAlgorithms template="Vec3d" name="TopoAlgo" /> <TriangleSetGeometryAlgorithms template="Vec3d" name="GeomAlgo" /> <Tetra2TriangleTopologicalMapping name="Mapping" input="@../Container" output="@Container" /> <!-- what should the "color(self,node) and onEndAnimationStep(self)" methods look like? --> <PythonScriptController filename="color.py" classname="Cool_color" variables="Mapping" /> <TriangularBendingSprings template="Vec3d" name="FEM-Bend" stiffness="300" damping="1" /> <TriangleModel name="Models" /> <Node name="Visu"> <OglModel template="ExtVec3f" name="Visual" 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" /> <IdentityMapping template="Vec3d,ExtVec3f" name="default17" input="@../../Volume" output="@Visual" /> </Node> </Node> ...
Thanks
22 November 2018 at 17:40 #12517HugoKeymasterHi @mjbarrow,
you can do as follows:
<!-- RegularGrid examples --> <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 rayleighStiffness="0.1" rayleighMass="0.1" /> <CGLinearSolver iterations="100" tolerance="1e-7" threshold="1e-7"/> <MechanicalObject /> <UniformMass totalMass="100.0" /> <RegularGrid name="grid" nx="4" ny="3" nz="3" xmin="-10.25" xmax="-3.25" ymin="0.25" ymax="5.25" zmin="-2" zmax="3" /> <BoxConstraint box="-8.5 0 -2.5 -5 3 2" /> <RegularGridSpringForceField name="Springs" stiffness="400" damping="4" /> <Node name="Visu"> <TriangleSetTopologyContainer name="Container" /> <TriangleSetTopologyModifier name="Modifier" /> <TriangleSetTopologyAlgorithms template="Vec3d" name="TopoAlgo" /> <TriangleSetGeometryAlgorithms template="Vec3d" name="GeomAlgo" /> <Quad2TriangleTopologicalMapping name="Mapping" input="@../grid" output="@Container" /> </Node> </Node> </Node>
Let me know if it helps
Hugo
23 November 2018 at 09:44 #12526mbarrowBlockedHi Hugo,
thanks this worked perfectly!
-
AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.