ValuesFromPositions
Assign values to primitives (vertex/edge/triangle/tetrahedron) based on a linear interpolation of values along a direction.
Templates:
- Rigid3d
- Vec3d
Target: Sofa.Component.Engine.Select
namespace: sofa::component::engine::select
parents:
- DataEngine
Data
Name | Description | Default value |
---|---|---|
name | object name | unnamed |
printLog | if true, emits extra messages at runtime. | 0 |
tags | list of the subsets the object belongs to | |
bbox | this object bounding box | |
componentState | The state of the component among (Dirty, Valid, Undefined, Loading, Invalid). | Undefined |
listening | if true, handle the events, otherwise ignore the events | 0 |
fieldType | field type of output elements | |
Inputs | ||
inputValues | Input values | |
direction | Direction along which the values are interpolated | 0 1 0 |
position | Rest position coordinates of the degrees of freedom | |
edges | Edge Topology | |
triangles | Triangle Topology | |
tetrahedra | Tetrahedron Topology | |
Outputs | ||
values | Values of the points contained in the ROI | |
edgeValues | Values of the edges contained in the ROI | |
triangleValues | Values of the triangles contained in the ROI | |
tetrahedronValues | Values of the tetrahedra contained in the ROI | |
pointVectors | Vectors of the points contained in the ROI | |
edgeVectors | Vectors of the edges contained in the ROI | |
triangleVectors | Vectors of the triangles contained in the ROI | |
tetrahedronVectors | Vectors of the tetrahedra contained in the ROI | |
Visualization | ||
drawVectors | draw vectors line | 0 |
drawVectorLength | vector length visualisation. | 10 |
Links
Name | Description | Destination type name |
---|---|---|
context | Graph Node containing this object (or BaseContext::getDefault() if no graph is used) | BaseContext |
slaves | Sub-objects used internally by this object | BaseObject |
master | nullptr for regular objects, or master object for which this object is one sub-objects | BaseObject |
Examples
ValuesFromPositions_vectorField.scn
<?xml version="1.0" ?>
<Node name="Root" gravity="0 0 0" dt="0.02">
<RequiredPlugin name="Sofa.Component.Collision.Detection.Algorithm"/> <!-- Needed to use components [BVHNarrowPhase BruteForceBroadPhase CollisionPipeline] -->
<RequiredPlugin name="Sofa.Component.Collision.Detection.Intersection"/> <!-- Needed to use components [MinProximityIntersection] -->
<RequiredPlugin name="Sofa.Component.Collision.Geometry"/> <!-- Needed to use components [TriangleCollisionModel] -->
<RequiredPlugin name="Sofa.Component.Collision.Response.Contact"/> <!-- Needed to use components [CollisionResponse] -->
<RequiredPlugin name="Sofa.Component.Constraint.Projective"/> <!-- Needed to use components [FixedProjectiveConstraint] -->
<RequiredPlugin name="Sofa.Component.Engine.Select"/> <!-- Needed to use components [BoxROI ValuesFromPositions] -->
<RequiredPlugin name="Sofa.Component.LinearSolver.Iterative"/> <!-- Needed to use components [CGLinearSolver] -->
<RequiredPlugin name="Sofa.Component.Mass"/> <!-- Needed to use components [UniformMass] -->
<RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->
<RequiredPlugin name="Sofa.Component.SolidMechanics.FEM.Elastic"/> <!-- Needed to use components [TetrahedronFEMForceField] -->
<RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
<RequiredPlugin name="Sofa.Component.Topology.Container.Dynamic"/> <!-- Needed to use components [TetrahedronSetGeometryAlgorithms TetrahedronSetTopologyContainer TetrahedronSetTopologyModifier] -->
<RequiredPlugin name="Sofa.Component.Topology.Container.Grid"/> <!-- Needed to use components [RegularGridTopology] -->
<RequiredPlugin name="Sofa.Component.Topology.Mapping"/> <!-- Needed to use components [Hexa2TetraTopologicalMapping] -->
<RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] -->
<DefaultAnimationLoop/>
<VisualStyle displayFlags="showVisual showBehaviorModels showForceFields showCollision showMapping" />
<CollisionPipeline name="DefaultCollisionPipeline" verbose="0" draw="0" depth="6" />
<BruteForceBroadPhase/>
<BVHNarrowPhase/>
<MinProximityIntersection name="Proximity" alarmDistance="0.3" contactDistance="0.2" />
<CollisionResponse name="Response" response="PenalityContactForceField" />
<Node name="Cube" gravity="0 -9.81 0">
<EulerImplicitSolver name="cg_odesolver" printLog="0" rayleighStiffness="0.1" rayleighMass="0.1" />
<CGLinearSolver template="GraphScattered" name="linear solver" iterations="25" tolerance="1e-09" threshold="1e-09" />
<RegularGridTopology name="grid" n="6 6 6" min="-10 -10 -10" max="10 10 10" p0="-10 -10 -10" />
<MechanicalObject template="Vec3" name="mecaObj" src="@grid"/>
<UniformMass name="default25" vertexMass="0.25" />
<TetrahedronFEMForceField template="Vec3" name="FEM" method="large" poissonRatio="0.4" youngModulus="1000" computeGlobalMatrix="0" />
<BoxROI template="Vec3" name="box_roi" box="-11 -11 -11 11 -9 11" indices="0" drawSize="0" />
<FixedProjectiveConstraint template="Vec3" name="default27" indices="@box_roi.indices" drawSize="0" />
<Node name="Tetra" gravity="0 -9.81 0">
<TetrahedronSetTopologyContainer name="Container" />
<TetrahedronSetTopologyModifier name="Modifier" />
<TetrahedronSetGeometryAlgorithms template="Vec3" name="GeomAlgo" />
<TriangleCollisionModel template="Vec3" name="default30" />
<Hexa2TetraTopologicalMapping name="default28" input="@../grid" output="@Container" />
<Node name="interpol" gravity="0 -9.81 0">
<ValuesFromPositions template="Vec3" direction="1 1 0" position="@../../mecaObj.position" fieldType="Vector" drawVectors="1" drawVectorLength="5" />
</Node>
</Node>
</Node>
</Node>
def createScene(root_node):
root = root_node.addChild('Root', gravity="0 0 0", dt="0.02")
root.addObject('RequiredPlugin', name="Sofa.Component.Collision.Detection.Algorithm")
root.addObject('RequiredPlugin', name="Sofa.Component.Collision.Detection.Intersection")
root.addObject('RequiredPlugin', name="Sofa.Component.Collision.Geometry")
root.addObject('RequiredPlugin', name="Sofa.Component.Collision.Response.Contact")
root.addObject('RequiredPlugin', name="Sofa.Component.Constraint.Projective")
root.addObject('RequiredPlugin', name="Sofa.Component.Engine.Select")
root.addObject('RequiredPlugin', name="Sofa.Component.LinearSolver.Iterative")
root.addObject('RequiredPlugin', name="Sofa.Component.Mass")
root.addObject('RequiredPlugin', name="Sofa.Component.ODESolver.Backward")
root.addObject('RequiredPlugin', name="Sofa.Component.SolidMechanics.FEM.Elastic")
root.addObject('RequiredPlugin', name="Sofa.Component.StateContainer")
root.addObject('RequiredPlugin', name="Sofa.Component.Topology.Container.Dynamic")
root.addObject('RequiredPlugin', name="Sofa.Component.Topology.Container.Grid")
root.addObject('RequiredPlugin', name="Sofa.Component.Topology.Mapping")
root.addObject('RequiredPlugin', name="Sofa.Component.Visual")
root.addObject('DefaultAnimationLoop', )
root.addObject('VisualStyle', displayFlags="showVisual showBehaviorModels showForceFields showCollision showMapping")
root.addObject('CollisionPipeline', name="DefaultCollisionPipeline", verbose="0", draw="0", depth="6")
root.addObject('BruteForceBroadPhase', )
root.addObject('BVHNarrowPhase', )
root.addObject('MinProximityIntersection', name="Proximity", alarmDistance="0.3", contactDistance="0.2")
root.addObject('CollisionResponse', name="Response", response="PenalityContactForceField")
cube = Root.addChild('Cube', gravity="0 -9.81 0")
cube.addObject('EulerImplicitSolver', name="cg_odesolver", printLog="0", rayleighStiffness="0.1", rayleighMass="0.1")
cube.addObject('CGLinearSolver', template="GraphScattered", name="linear solver", iterations="25", tolerance="1e-09", threshold="1e-09")
cube.addObject('RegularGridTopology', name="grid", n="6 6 6", min="-10 -10 -10", max="10 10 10", p0="-10 -10 -10")
cube.addObject('MechanicalObject', template="Vec3", name="mecaObj", src="@grid")
cube.addObject('UniformMass', name="default25", vertexMass="0.25")
cube.addObject('TetrahedronFEMForceField', template="Vec3", name="FEM", method="large", poissonRatio="0.4", youngModulus="1000", computeGlobalMatrix="0")
cube.addObject('BoxROI', template="Vec3", name="box_roi", box="-11 -11 -11 11 -9 11", indices="0", drawSize="0")
cube.addObject('FixedProjectiveConstraint', template="Vec3", name="default27", indices="@box_roi.indices", drawSize="0")
tetra = Cube.addChild('Tetra', gravity="0 -9.81 0")
tetra.addObject('TetrahedronSetTopologyContainer', name="Container")
tetra.addObject('TetrahedronSetTopologyModifier', name="Modifier")
tetra.addObject('TetrahedronSetGeometryAlgorithms', template="Vec3", name="GeomAlgo")
tetra.addObject('TriangleCollisionModel', template="Vec3", name="default30")
tetra.addObject('Hexa2TetraTopologicalMapping', name="default28", input="@../grid", output="@Container")
interpol = Tetra.addChild('interpol', gravity="0 -9.81 0")
interpol.addObject('ValuesFromPositions', template="Vec3", direction="1 1 0", position="@../../mecaObj.position", fieldType="Vector", drawVectors="1", drawVectorLength="5")