Skip to content

MeshBoundaryROI

Outputs indices of boundary vertices of a triangle/quad mesh

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 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
triangles input triangles
quads input quads
inputROI optional subset of the input mesh
Outputs
indices Index lists of the closing vertices

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/Select/MeshBoundaryROI.scn

<?xml version="1.0"?>
<Node   name="root" gravity="0 0 0" dt="1"  >
    <RequiredPlugin name="Sofa.Component.Constraint.Projective"/> <!-- Needed to use components [FixedProjectiveConstraint] -->
    <RequiredPlugin name="Sofa.Component.Engine.Generate"/> <!-- Needed to use components [MergeMeshes] -->
    <RequiredPlugin name="Sofa.Component.Engine.Select"/> <!-- Needed to use components [MeshBoundaryROI] -->
    <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.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
    <RequiredPlugin name="Sofa.Component.Topology.Container.Grid"/> <!-- Needed to use components [RegularGridTopology] -->
    <RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] -->
    <RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->
    <BackgroundSetting color="1 1 1" />
    <VisualStyle displayFlags="showVisual showBehaviorModels" />
    <DefaultAnimationLoop/>

    <MeshOBJLoader name="mesh1" filename="mesh/c_open.obj" triangulate="0"/>
    <!-- computeTriangleList or computeQuadList must be set to false. Otherwise both are consider, and boundary detection cannot rely on a unique element -->
    <RegularGridTopology name="mesh2" nx="5" ny="5" nz="1" xmin="-10" xmax="10" ymin="-10" ymax="10" zmin="-5" zmax="-5" computeTriangleList="false"/>
    <MergeMeshes name="mesh" nbMeshes="2" position1="@mesh1.position" position2="@mesh2.position" triangles1="@mesh1.triangles" triangles2="@mesh2.triangles" quads1="@mesh1.quads" quads2="@mesh2.quads"/>

    <OglModel name="visual"  src="@mesh" color="0.5 0.5 1 1" />

    <MechanicalObject template="Vec3" position="@mesh.position" />
    <MeshBoundaryROI name="roi" triangles="@mesh.triangles" quads="@mesh.quads"/>
    <FixedProjectiveConstraint template="Vec3" indices="@roi.indices" />

</Node>
def createScene(rootNode):

    root = rootNode.addChild('root', gravity="0 0 0", dt="1")
    root.addObject('RequiredPlugin', name="Sofa.Component.Constraint.Projective")
    root.addObject('RequiredPlugin', name="Sofa.Component.Engine.Generate")
    root.addObject('RequiredPlugin', name="Sofa.Component.Engine.Select")
    root.addObject('RequiredPlugin', name="Sofa.Component.IO.Mesh")
    root.addObject('RequiredPlugin', name="Sofa.Component.Setting")
    root.addObject('RequiredPlugin', name="Sofa.Component.StateContainer")
    root.addObject('RequiredPlugin', name="Sofa.Component.Topology.Container.Grid")
    root.addObject('RequiredPlugin', name="Sofa.Component.Visual")
    root.addObject('RequiredPlugin', name="Sofa.GL.Component.Rendering3D")
    root.addObject('BackgroundSetting', color="1 1 1")
    root.addObject('VisualStyle', displayFlags="showVisual showBehaviorModels")
    root.addObject('DefaultAnimationLoop')
    root.addObject('MeshOBJLoader', name="mesh1", filename="mesh/c_open.obj", triangulate="0")
    root.addObject('RegularGridTopology', name="mesh2", nx="5", ny="5", nz="1", xmin="-10", xmax="10", ymin="-10", ymax="10", zmin="-5", zmax="-5", computeTriangleList="false")
    root.addObject('MergeMeshes', name="mesh", nbMeshes="2", position1="@mesh1.position", position2="@mesh2.position", triangles1="@mesh1.triangles", triangles2="@mesh2.triangles", quads1="@mesh1.quads", quads2="@mesh2.quads")
    root.addObject('OglModel', name="visual", src="@mesh", color="0.5 0.5 1 1")
    root.addObject('MechanicalObject', template="Vec3", position="@mesh.position")
    root.addObject('MeshBoundaryROI', name="roi", triangles="@mesh.triangles", quads="@mesh.quads")
    root.addObject('FixedProjectiveConstraint', template="Vec3", indices="@roi.indices")