Skip to content

MeshBarycentricMapperEngine

Engine mapping a set of points in a topological model and provide barycentric coordinates

Vec3d

Templates:

  • Vec3d

Target: Sofa.Component.Engine.Generate

namespace: sofa::component::engine::generate

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 objet 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
computeLinearInterpolation if true, computes a linear interpolation (debug) 0
linearInterpolationIndices Indices of a linear interpolation
linearInterpolationValues Values of a linear interpolation
Inputs
inputPositions Initial positions of the master points
mappedPointPositions Initial positions of the points to be mapped
Outputs
barycentricPositions Output : Barycentric positions of the mapped points
tableElements Output : Table that provides the index of the element to which each input point belongs
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
topology Name of the master topology BaseMeshTopology

Examples

MeshBarycentricMapperEngine.scn

<?xml version="1.0" ?>
<Node name="root" dt="0.02">
    <RequiredPlugin name="Sofa.Component.Engine.Generate"/> <!-- Needed to use components [MeshBarycentricMapperEngine] -->
    <RequiredPlugin name="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshOBJLoader] -->
    <RequiredPlugin name="Sofa.Component.Topology.Container.Constant"/> <!-- Needed to use components [MeshTopology] -->
    <RequiredPlugin name="Sofa.Component.Topology.Container.Dynamic"/> <!-- Needed to use components [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.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->
    <RegularGridTopology name="GridTopology" nx="10" ny="10" nz="10" min="-10 -10 -10" max="10 10 10" drawEdges="1"/>

    <DefaultAnimationLoop/>
    <Node name="Tetra-Topo">
        <TetrahedronSetTopologyContainer name="Container" checkTopology="1"/>
        <TetrahedronSetTopologyModifier name="Modifier" />
        <Hexa2TetraTopologicalMapping name="default28" input="@../GridTopology" output="@Container" />
        <Node name="Liver">
            <MeshOBJLoader name="meshLoader" filename="mesh/liver.obj" />
            <MeshTopology src="@meshLoader" name="LiverTopo"  />
            <MeshBarycentricMapperEngine inputPositions="@../../GridTopology.position" mappedPointPositions="@./LiverTopo.position" topology="@../Container"/>
            <OglModel name="Visual" src="@meshLoader" color='1.0 0.0 0.0 1' />
        </Node>
    </Node>
</Node>
def createScene(root_node):

   root = root_node.addChild('root', dt="0.02")

   root.addObject('RequiredPlugin', name="Sofa.Component.Engine.Generate")
   root.addObject('RequiredPlugin', name="Sofa.Component.IO.Mesh")
   root.addObject('RequiredPlugin', name="Sofa.Component.Topology.Container.Constant")
   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.GL.Component.Rendering3D")
   root.addObject('RegularGridTopology', name="GridTopology", nx="10", ny="10", nz="10", min="-10 -10 -10", max="10 10 10", drawEdges="1")
   root.addObject('DefaultAnimationLoop', )

   tetra__topo = root.addChild('Tetra-Topo')

   tetra__topo.addObject('TetrahedronSetTopologyContainer', name="Container", checkTopology="1")
   tetra__topo.addObject('TetrahedronSetTopologyModifier', name="Modifier")
   tetra__topo.addObject('Hexa2TetraTopologicalMapping', name="default28", input="@../GridTopology", output="@Container")

   liver = Tetra-Topo.addChild('Liver')

   liver.addObject('MeshOBJLoader', name="meshLoader", filename="mesh/liver.obj")
   liver.addObject('MeshTopology', src="@meshLoader", name="LiverTopo")
   liver.addObject('MeshBarycentricMapperEngine', inputPositions="@../../GridTopology.position", mappedPointPositions="@./LiverTopo.position", topology="@../Container")
   liver.addObject('OglModel', name="Visual", src="@meshLoader", color="1.0 0.0 0.0 1")