Skip to content

RandomPointDistributionInSurface

This class truns on spiral any topological model

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
randomSeed Set a specified seed for random generation (0 for "true pseudo-randomness" 0
isVisible is Visible ? 1
minDistanceBetweenPoints Min Distance between 2 points (-1 for true randomness) 0.1
numberOfInPoints Number of points inside 10
numberOfTests Number of tests to find if the point is inside or not (odd number) 5
outPoints Points outside the surface
Inputs
vertices Vertices
triangles Triangles indices
Outputs
inPoints Points inside the surface
Visualization
drawOutputPoints Output points visible ? 0

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/RandomPointDistributionInSurface.scn

<?xml version="1.0"?>
<Node name="root" dt="0.02">
    <RequiredPlugin name="Sofa.Component.Engine.Generate"/> <!-- Needed to use components [RandomPointDistributionInSurface] -->
    <RequiredPlugin name="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshOBJLoader] -->
    <RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
    <RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] -->
    <RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->
    <VisualStyle displayFlags="showBehaviorModels" />
    <DefaultAnimationLoop/>

    <Node name="Random">
        <MeshOBJLoader name="meshLoader" filename="mesh/liver.obj" />
        <MechanicalObject src="@meshLoader"/>
        <RandomPointDistributionInSurface template="Vec3" drawOutputPoints="true"
            vertices="@meshLoader.position" triangles="@meshLoader.triangles" numberOfInPoints="100" numberOfTests="3" minDistanceBetweenPoints="0.1" 
        />
    </Node>
    <Node name="Visu">
        <VisualStyle displayFlags="showWireframe" />
        <MeshOBJLoader name='myLoader' filename='mesh/liver.obj'/>  
        <OglModel src='@myLoader'/>
    </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.StateContainer")
    root.addObject('RequiredPlugin', name="Sofa.Component.Visual")
    root.addObject('RequiredPlugin', name="Sofa.GL.Component.Rendering3D")
    root.addObject('VisualStyle', displayFlags="showBehaviorModels")
    root.addObject('DefaultAnimationLoop')

    Random = root.addChild('Random')
    Random.addObject('MeshOBJLoader', name="meshLoader", filename="mesh/liver.obj")
    Random.addObject('MechanicalObject', src="@meshLoader")
    Random.addObject('RandomPointDistributionInSurface', template="Vec3", drawOutputPoints="true", vertices="@meshLoader.position", triangles="@meshLoader.triangles", numberOfInPoints="100", numberOfTests="3", minDistanceBetweenPoints="0.1")

    Visu = root.addChild('Visu')
    Visu.addObject('VisualStyle', displayFlags="showWireframe")
    Visu.addObject('MeshOBJLoader', name="myLoader", filename="mesh/liver.obj")
    Visu.addObject('OglModel', src="@myLoader")