Skip to content

ImageTransform

Read data from ImageContainer

Templates:

  • ImageB
  • ImageD
  • ImageUC

Target: image

namespace: sofa::component::engine

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 object 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
update Type of update
Transformation
translation Translation 0 0 0
euler Euler angles 0 0 0
scale Voxel size 1 1 1
isPerspective Is perspective? 0
timeOffset Time offset 0
timeScale Time scale 1
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

Examples

ImageTransform.scn

<?xml version="1.0"?>
<!-- example of how to give translation parameter to an image and update it every time step-->
<Node   name="root" gravity="0 -10 0" dt="0.01"  >
    <Node name="plugins">
        <RequiredPlugin name="Sofa.Component.LinearSolver.Iterative"/> <!-- Needed to use components [CGLinearSolver] -->
        <RequiredPlugin name="Sofa.Component.Mapping.NonLinear"/> <!-- Needed to use components [RigidMapping] -->
        <RequiredPlugin name="Sofa.Component.Mass"/> <!-- Needed to use components [UniformMass] -->
        <RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->
        <RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
        <RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->
        <RequiredPlugin name="image"/> <!-- Needed to use components [ImageContainer ImageTransform ImageViewer] -->
    </Node>

    <EulerImplicitSolver  rayleighStiffness="0.1" rayleighMass="0.1" />
    <CGLinearSolver template="GraphScattered" iterations="200" threshold="1e-12" tolerance="1e-5"/>

    <MechanicalObject name="meca" template="Rigid3d" translation="7 7 0" />
    <UniformMass template="Rigid3d" totalMass="10"/>

    <Node name="Visu">
        <OglModel name="Visual" filename="mesh/cube.obj" translation="7 7 0"/>
        <RigidMapping input="@../meca" output="@Visual" />
    </Node> 

    <Node name="image">
        <ImageContainer  name="image" filename="textures/cubemap_bk.bmp" drawBB="false"/>
        <ImageTransform name="transform" translation="@../meca.position" isPerspective="true" scale="0.1 0.1 15" update="1"/>

        <ImageViewer  name="viewer" src="@image" />
    </Node>
</Node>
def createScene(root_node):

   root = root_node.addChild('root', gravity="0 -10 0", dt="0.01")

   plugins = root.addChild('plugins')

   plugins.addObject('RequiredPlugin', name="Sofa.Component.LinearSolver.Iterative")
   plugins.addObject('RequiredPlugin', name="Sofa.Component.Mapping.NonLinear")
   plugins.addObject('RequiredPlugin', name="Sofa.Component.Mass")
   plugins.addObject('RequiredPlugin', name="Sofa.Component.ODESolver.Backward")
   plugins.addObject('RequiredPlugin', name="Sofa.Component.StateContainer")
   plugins.addObject('RequiredPlugin', name="Sofa.GL.Component.Rendering3D")
   plugins.addObject('RequiredPlugin', name="image")

   root.addObject('EulerImplicitSolver', rayleighStiffness="0.1", rayleighMass="0.1")
   root.addObject('CGLinearSolver', template="GraphScattered", iterations="200", threshold="1e-12", tolerance="1e-5")
   root.addObject('MechanicalObject', name="meca", template="Rigid3d", translation="7 7 0")
   root.addObject('UniformMass', template="Rigid3d", totalMass="10")

   visu = root.addChild('Visu')

   visu.addObject('OglModel', name="Visual", filename="mesh/cube.obj", translation="7 7 0")
   visu.addObject('RigidMapping', input="@../meca", output="@Visual")

   image = root.addChild('image')

   image.addObject('ImageContainer', name="image", filename="textures/cubemap_bk.bmp", drawBB="false")
   image.addObject('ImageTransform', name="transform", translation="@../meca.position", isPerspective="true", scale="0.1 0.1 15", update="1")
   image.addObject('ImageViewer', name="viewer", src="@image")