Skip to content

MeshBarycentricMapperEngine

This class maps a set of points in a topological model and provide barycentric coordinates

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

Links:

Name Description
context Graph Node containing this object (or BaseContext::getDefault() if no graph is used)
slaves Sub-objects used internally by this object
master nullptr for regular objects, or master object for which this object is one sub-objects
topology Name of the master topology

Examples

Component/Engine/Generate/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(rootNode):

    root = rootNode.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")