ImFusion SDK 4.3
ComposedMotionModel Class Reference

#include <ImFusion/US/MotionTrajectoryModel.h>

Motion model that composes multiple motion models into a single unified model. More...

+ Inheritance diagram for ComposedMotionModel:

Detailed Description

Motion model that composes multiple motion models into a single unified model.

This class allows multiple motions to be added and combined into one. Models are added using templated functions that create new motion model instances of the specified type. These sub-models can be configured using overridden motion model functions, which are forwarded to the currently active model.

Note
Although the class technically supports adding multiple motion models of the same type, this usage is not recommended in practice.

Public Member Functions

 ComposedMotionModel (int size)
 
std::string name () const override
 Returns the name of the current motion model.
 
std::vector< mat4 > defineMotion () const override
 Returns the composed motion from all added models.
 
void configure (const Properties *p) override
 Configures and initializes motion sub-models from the provided properties.
 
void configuration (Properties *p) const override
 Exports the current configuration of all sub-models into the given Properties object.
 
template<class T>
T * add ()
 Create a motion model of the specified class and set it as active.
 
template<class T>
T * setActive ()
 Sets the first added model of the specified type as active.
 
const MotionTrajectoryModelget () const
 Returns a const pointer to the active motion model.
 
MotionTrajectoryModelget ()
 Returns a pointer to the active motion model.
 
template<class T>
T * get ()
 Returns a pointer to the first added model of the specified type or nullptr if no model is found.
 
- Public Member Functions inherited from MotionTrajectoryModel
 MotionTrajectoryModel (int size)
 
void setRelativeShiftMatrix (const mat4 &relShiftBefore)
 Sets the relative shift matrix applied before the motion.
 
void configure (const Properties *p) override
 Sets one or multiple properties.
 
void configuration (Properties *p) const override
 Retrieve the properties of this object.
 
- Public Member Functions inherited from Configurable
virtual void configureDefaults ()
 Retrieve the properties of this object, replaces values with their defaults and sets it again.
 
void registerParameter (ParameterBase *param)
 Register the given Parameter or SubProperty, so that it will be configured during configure()/configuration().
 
void unregisterParameter (const ParameterBase *param)
 Remove the given Parameter or SubProperty from the list of registered parameters.
 
 Configurable (const Configurable &rhs)
 
 Configurable (Configurable &&rhs) noexcept
 
Configurableoperator= (const Configurable &)
 
Configurableoperator= (Configurable &&) noexcept
 

Protected Attributes

std::vector< std::unique_ptr< MotionTrajectoryModel > > m_models
 
int m_activeModel
 
- Protected Attributes inherited from MotionTrajectoryModel
const int m_size
 Size of the model, regularly the number of frames.
 
std::vector< double > m_pars
 Full motion parameter vector - not necessarily the exposed ones.
 
mat4 m_relShift
 Generic helper matrix to incorporate optional shifts. Considered by rigidMotion().
 
- Protected Attributes inherited from Configurable
std::vector< Paramm_params
 List of all registered Parameter and SubProperty instances.
 

Interface methods forwarded to the currently active model

int numberOfParameters () const override
 Returns the number of parameters in the active model.
 
std::vector< double > parameters () const override
 Returns the parameters of the active model.
 
void setParameters (const std::vector< double > &pars) override
 Sets the parameters of the active model.
 
mat4 fitMatrices (const std::vector< mat4 > &mat) override
 Fits input motion data to the active model.
 

Additional Inherited Members

- Public Types inherited from MotionTrajectoryModel
typedef std::function< MotionTrajectoryModel *(int)> createModelFunc
 Function signature for creating a motion model with a given size.
 
- Static Public Member Functions inherited from MotionTrajectoryModel
static std::vector< std::pair< std::string, createModelFunc > > & supportedModels ()
 Returns a list of supported motion models.
 
- Public Attributes inherited from Configurable
Signal signalParametersChanged
 Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted.
 
- Protected Member Functions inherited from MotionTrajectoryModel
std::vector< mat4 > rigidMotion (const mat4 &m0, const mat4 &m1, int startFrame=0, int endFrame=-1) const
 Helper method to interpolate a rigid motion between m0 and m1.
 

Constructor & Destructor Documentation

◆ ComposedMotionModel()

ComposedMotionModel ( int size)
explicit
Parameters
sizeThe number of frames in the motion sequence.

Member Function Documentation

◆ name()

std::string name ( ) const
inlineoverridevirtual

Returns the name of the current motion model.

Implements MotionTrajectoryModel.

◆ numberOfParameters()

int numberOfParameters ( ) const
overridevirtual

Returns the number of parameters in the active model.

Reimplemented from MotionTrajectoryModel.

◆ parameters()

std::vector< double > parameters ( ) const
overridevirtual

Returns the parameters of the active model.

Reimplemented from MotionTrajectoryModel.

◆ setParameters()

void setParameters ( const std::vector< double > & pars)
overridevirtual

Sets the parameters of the active model.

Reimplemented from MotionTrajectoryModel.

◆ fitMatrices()

mat4 fitMatrices ( const std::vector< mat4 > & mat)
overridevirtual

Fits input motion data to the active model.

Implements MotionTrajectoryModel.

◆ defineMotion()

std::vector< mat4 > defineMotion ( ) const
overridevirtual

Returns the composed motion from all added models.

Implements MotionTrajectoryModel.

◆ configure()

void configure ( const Properties * p)
overridevirtual

Configures and initializes motion sub-models from the provided properties.

This method searches for the sub-properties the given properties object to initialize and configure one or more sub-models. Each sub-property within p is checked against the list of registered model names (as returned by supportedModels()). If a match is found, a corresponding motion model is instantiated, configured using its sub-properties, and added to the composed model.

Additionally, if a property named "activeModel" is present, its value is used to set the index of the active sub-model.

Reimplemented from Configurable.

◆ configuration()

void configuration ( Properties * p) const
overridevirtual

Exports the current configuration of all sub-models into the given Properties object.

It also sets the "activeModel" property to reflect the currently active model.

Reimplemented from Configurable.

◆ add()

template<class T>
T * add ( )
inline

Create a motion model of the specified class and set it as active.

Template Parameters
TThe type of the motion model to create.
Returns
A pointer to the added model.

◆ setActive()

template<class T>
T * setActive ( )
inline

Sets the first added model of the specified type as active.

Template Parameters
TThe type of the motion model to activate.
Returns
A pointer to the activated model, or nullptr if not found.
Note
If multiple models of the same type were added, only the first one is set active.

◆ get()

template<class T>
T * get ( )
inline

Returns a pointer to the first added model of the specified type or nullptr if no model is found.

Template Parameters
TThe type of motion model to retrieve.

The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close