Skip to content

MeshClosingEngine

Merge several meshes

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
Inputs
inputPosition input vertices
inputTriangles input triangles
inputQuads input quads
Outputs
position Vertices of closed mesh
triangles Triangles of closed mesh
quads Quads of closed mesh (=input quads with current method)
indices Index lists of the closing parts
closingPosition Vertices of the closing parts
closingTriangles Triangles of the closing parts

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

Examples

Component/Engine/Generate/MeshClosingEngine.scn

<?xml version="1.0"?>
<Node name="root" gravity="0 0 0" dt="1"  >
    <RequiredPlugin name="Sofa.Component.Engine.Generate"/> <!-- Needed to use components [MeshClosingEngine] -->
    <RequiredPlugin name="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshOBJLoader] -->
    <RequiredPlugin name="Sofa.Component.Setting"/> <!-- Needed to use components [BackgroundSetting] -->
    <RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] -->
    <RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->

    <DefaultAnimationLoop/>
    <BackgroundSetting color="1 1 1" />
    <MeshOBJLoader name="mesh" filename="mesh/c_open.obj" triangulate="0"/>
    <MeshClosingEngine name="closer" inputPosition="@mesh.position" inputTriangles="@mesh.triangles" inputQuads="@mesh.quads"/>

    <Node name="plain visu of closing area (red)" >
        <OglModel name="closingVisual"  position="@../closer.closingPosition" triangles="@../closer.closingTriangles" color="1 0.1 0.1 1"/>
    </Node>

    <Node name="visu of closed mesh (green)" >
        <OglModel name="closedMesh"  position="@../closer.position" vertices="@../closer.position" triangles="@../closer.triangles" quads="@../closer.quads" color="0.5 1 0.5 1" translation="0 0 4"/>
    </Node>

    <Node name="visu of original open mesh (wireframe)" >
        <VisualStyle displayFlags="showVisual showWireframe" />
        <OglModel name="visual"  src="@../mesh" color="0.5 0.5 1 1" />
    </Node>
</Node>
def createScene(rootNode):

    root = rootNode.addChild('root', gravity="0 0 0", dt="1")
    root.addObject('RequiredPlugin', name="Sofa.Component.Engine.Generate")
    root.addObject('RequiredPlugin', name="Sofa.Component.IO.Mesh")
    root.addObject('RequiredPlugin', name="Sofa.Component.Setting")
    root.addObject('RequiredPlugin', name="Sofa.Component.Visual")
    root.addObject('RequiredPlugin', name="Sofa.GL.Component.Rendering3D")
    root.addObject('DefaultAnimationLoop')
    root.addObject('BackgroundSetting', color="1 1 1")
    root.addObject('MeshOBJLoader', name="mesh", filename="mesh/c_open.obj", triangulate="0")
    root.addObject('MeshClosingEngine', name="closer", inputPosition="@mesh.position", inputTriangles="@mesh.triangles", inputQuads="@mesh.quads")

    plain visu of closing area (red) = root.addChild('plain visu of closing area (red)')
    plain visu of closing area (red).addObject('OglModel', name="closingVisual", position="@../closer.closingPosition", triangles="@../closer.closingTriangles", color="1 0.1 0.1 1")

    visu of closed mesh (green) = root.addChild('visu of closed mesh (green)')
    visu of closed mesh (green).addObject('OglModel', name="closedMesh", position="@../closer.position", vertices="@../closer.position", triangles="@../closer.triangles", quads="@../closer.quads", color="0.5 1 0.5 1", translation="0 0 4")

    visu of original open mesh (wireframe) = root.addChild('visu of original open mesh (wireframe)')
    visu of original open mesh (wireframe).addObject('VisualStyle', displayFlags="showVisual showWireframe")
    visu of original open mesh (wireframe).addObject('OglModel', name="visual", src="@../mesh", color="0.5 0.5 1 1")