Helios++
Helios software for LiDAR simulations
DynSequentiableMovingObject Class Reference

Implementation of a dynamic object which supports sequentiable dynamic motions. More...

#include <DynSequentiableMovingObject.h>

Inheritance diagram for DynSequentiableMovingObject:
Collaboration diagram for DynSequentiableMovingObject:

Public Member Functions

 DynSequentiableMovingObject ()=default
 
 DynSequentiableMovingObject (ScenePart const &sp, bool const shallowPrimitives=false)
 
 DynSequentiableMovingObject (string const id)
 
 DynSequentiableMovingObject (vector< Primitive * > const &primitives)
 
 DynSequentiableMovingObject (string const id, vector< Primitive * > const &primitives)
 
bool doSimStep () override
 Sequentiable dynamic motions behavior implementation. More...
 
void addSequence (shared_ptr< DynSequence< DynMotion >> dmSequence)
 Add the dynamic sequence of dynamic motions to the dynamic motion sequencer. More...
 
void removeSequence (string const &id)
 Remove the dynamic sequence of dynamic motions with given identifier. More...
 
shared_ptr< DynSequence< DynMotion > > getSequence (string const &id)
 Get the dynamic sequence of dynamic motions with given identifier. More...
 
bool hasSequences (string const &id)
 Check if the dynamic sequencer has a dynamic sequence of dynamic motions with given identifier. More...
 
void clearSequences ()
 Remove all dynamic sequences of dynamic motions composing the dynamic sequencer. More...
 
- Public Member Functions inherited from DynMovingObject
 DynMovingObject ()
 
 DynMovingObject (ScenePart const &sp, bool const shallowPrimitives=false)
 
 DynMovingObject (string const id)
 
 DynMovingObject (vector< Primitive * > const &primitives)
 
 DynMovingObject (string const id, vector< Primitive * > const &primitives)
 
virtual void doObserverUpdate ()
 Handle update notifications to the subscribed observer. It is, notify the observer that it has been updated by the dynamic moving object. More...
 
void pushPositionMotion (shared_ptr< DynMotion > const dm)
 Push given dynamic motion to the position motion queue. More...
 
shared_ptr< DynMotionnextPositionMotion ()
 Retrieve the first dynamic motion in the position motion queue. More...
 
void clearPositionMotionQueue ()
 Remove all dynamic motions from the position motion queue.
 
bool positionMotionQueueHasNext () const
 Check if position motion queue has a next dynamic motion or not. More...
 
void pushNormalMotion (shared_ptr< DynMotion > const dm)
 Push given dynamic motion to the normal motion queue. More...
 
shared_ptr< DynMotionnextNormalMotion ()
 Retrieve the first dynamic motion in the normal motion queue. More...
 
void clearNormalMotionQueue ()
 Remove all dynamic motions from the normal motion queue.
 
bool normalMotionQueueHasNext () const
 Check if normal motion queue has a next dynamic motion or not. More...
 
void registerObserverGrove (shared_ptr< KDGrove > kdGroveObserver) override
 Register given grove as a observer for the dynamic moving object. More...
 
void unregisterObserverGrove () override
 Unregister current grove observer. More...
 
void setGroveSubjectId (std::size_t const id) override
 
std::size_t getGroveSubjectId () override
 
ObjectType getType () const override
 
void setObserverStepInterval (int const stepInterval)
 Set the step interval between consecutive observer update notifications. More...
 
int getObserverStepInterval () const
 Get the step interval between consecutive observer update notifications. More...
 
- Public Member Functions inherited from DynObject
 DynObject ()
 Dynamic object default constructor.
 
 DynObject (ScenePart const &sp, bool const shallowPrimitives=false)
 Build the dynamic object from given scene part. More...
 
 DynObject (string const id)
 Dynamic object constructor with id as argument. More...
 
 DynObject (vector< Primitive * > const &primitives)
 Dynamic object constructor with primitives as argument. More...
 
 DynObject (string const id, vector< Primitive * > const &primitives)
 Dynamic object constructor with id and primitives as arguments. More...
 
virtual bool doStep ()
 Handle the computation of current simulation step according to configured step loop. This means that the DynObject::doSimStep method (which implements the logic of the DynObject) will be called by the DynObject::stepLoop when enough simulation steps have elapsed. More...
 
void operator() ()
 Alias for DynObject::doStep method so it can be used as a functor. More...
 
size_t countVertices () const
 Count how many vertices there are defining the dynamic object. More...
 
arma::mat positionMatrixFromPrimitives () const
 Obtain the position matrix for primitives defining the dynamic object. More...
 
arma::mat positionMatrixFromPrimitives (size_t const m) const
 Like DynObject::positionMatrixFromPrimitives but receiving the total number of vertices beforehand. More...
 
arma::mat normalMatrixFromPrimitives () const
 Obtain the normal matrix for primitives defining the dynamic object. More...
 
arma::mat normalMatrixFromPrimitives (size_t const m) const
 Like DynObject::normalMatrixFromPrimitives but receiving the total number of vertices beforehand. More...
 
void updatePrimitivesPositionFromMatrix (arma::mat const &X)
 Update the position of each primitive with given matrix. More...
 
void updatePrimitivesPositionFromMatrix (size_t const m, arma::mat const &X)
 Like updatePrimitivesPositionFromMatrix(arma::mat const &) but receiving the total number of vertices beforehand. More...
 
void updatePrimitivesNormalFromMatrix (arma::mat const &X)
 Update the normal of each primitive with given matrix. More...
 
void updatePrimitivesNormalFromMatrix (size_t const m, arma::mat const &X)
 Like updatePrimitivesNormalFromMatrix(arma::mat const &) but receiving the total number of vertices beforehand. More...
 
ObjectType getType () const override
 
int getStepInterval () const
 Obtain the current step interval for the dynamic object. More...
 
void setStepInterval (int const stepInterval)
 Set the step interval for the dynamic object. More...
 
- Public Member Functions inherited from ScenePart
 ScenePart ()
 Default constructor for a scene part. More...
 
 ScenePart (ScenePart const &sp, bool const shallowPrimitives=false)
 
ScenePartoperator= (const ScenePart &rhs)
 Copy assigment operator.
 
void addObj (WavefrontObj *obj)
 Add the primitives of a WavefrontObj to the ScenePart. More...
 
std::vector< Vertex * > getAllVertices () const
 Obtain all vertices in the scene part. More...
 
void smoothVertexNormals ()
 Smooth normals for each vertex computing the mean for each triangle using it.
 
bool splitSubparts ()
 Split each subpart into a different scene part, with the first one corresponding to this scene part. More...
 
void computeCentroid (bool const computeBound=false)
 Compute the default centroid for the scene part as the midrange point and its boundaries too. More...
 
std::vector< Primitive * > const & getPrimitives () const
 Obtain the primitives of the scene part. More...
 
void setPrimitives (std::vector< Primitive * > const &primitives)
 Set the primitives of the scene part. More...
 
arma::colvec getCentroid () const
 Obtain the centroid of the scene part. More...
 
void setCentroid (arma::colvec centroid)
 Set the centroid of the scene part. More...
 
std::string const & getId () const
 Obtain the ID of the scene part. More...
 
void setId (const std::string &id)
 Set the ID of the scene part. More...
 
virtual PrimitiveType getPrimitiveType () const
 
- Public Member Functions inherited from KDGroveSubject
void registerObserverGrove (std::shared_ptr< BasicDynGrove< GroveKDTreeRaycaster, DynMovingObject >> observer) override
 Workaround to redirect calls from BasicDynGroveObjectSubject::registerObserverGrove to KDGroveSubject::registerObserverGrove(std::shared_ptr<KDGroveSubject>) method. More...
 
virtual void registerObserverGrove (std::shared_ptr< KDGrove > observer)=0
 Register given KDGrove as a observer with respect to the subject. More...
 

Protected Member Functions

void fillMotionQueues ()
 Fill motion queues with dynamic motions coming from dynamic sequencer.
 
- Protected Member Functions inherited from DynMovingObject
bool applyDynMotionQueue (std::function< arma::mat()> matrixFromPrimitives, std::function< void(arma::mat const &X)> matrixToPrimitives, std::function< bool()> queueHasNext, std::function< shared_ptr< DynMotion >()> queueNext)
 Method to assist dynamic motions computation. More...
 
shared_ptr< DynMotion_next (deque< shared_ptr< DynMotion >> &deck)
 Assist next operation over given queue. More...
 
- Protected Member Functions inherited from DynObject
arma::mat matrixFromPrimitives (std::function< arma::colvec(Vertex const *)> get) const
 Build a matrix from the set of primitives defining the dynamic object. More...
 
arma::mat matrixFromPrimitives (size_t const m, std::function< arma::colvec(Vertex const *)> get) const
 Like DynObject::matrixFromPrimitives but receiving the total number of vertices beforehand. More...
 
void matrixToPrimitives (std::function< void(Vertex *, arma::colvec const &)> set, arma::mat const &X)
 Update primitives defining the dynamic object from given matrix. More...
 
void matrixToPrimitives (size_t const m, std::function< void(Vertex *, arma::colvec const &)> set, arma::mat const &X)
 Like DynObject::matrixToPrimitives but receiving the total number of vertices beforehand. More...
 

Protected Attributes

DynSequencer< DynMotiondmSequencer
 Dynamic motion sequencer.
 
- Protected Attributes inherited from DynMovingObject
deque< shared_ptr< DynMotion > > positionMotionQueue
 Queue of motions to be applied to the position of each primitive. More...
 
deque< shared_ptr< DynMotion > > normalMotionQueue
 Queue of motions to be applied to the normal vector of each primitive. More...
 
DynMotionEngine dme
 The dynamic motion engine to apply dynamic motions. More...
 
std::shared_ptr< KDGrovekdGroveObserver
 The observer grove to which the dynamic moving object is registered. More...
 
size_t groveSubjectId
 The identifier of the dynamic moving object as subject of a KDGrove. More...
 
VoidStepLoop observerStepLoop
 Handle how many consecutive updates must elapse so the observer is notified. More...
 
- Protected Attributes inherited from DynObject
NonVoidStepLoop< bool > stepLoop
 The object to handle the execution of the dynamic object logic between specified simulation steps. More...
 

Private Member Functions

template<typename Archive >
void serialize (Archive &ar, const unsigned int version)
 Serialize a dynamic sequentiable moving object o a stream of bytes. More...
 

Friends

class boost::serialization::access
 

Additional Inherited Members

- Public Types inherited from ScenePart
enum  ObjectType { STATIC_OBJECT , DYN_OBJECT , DYN_MOVING_OBJECT }
 Specify the type of scene part / object. By default, the ScenePart is a static object.
 
enum  PrimitiveType { NONE , TRIANGLE , VOXEL }
 Specify the type of primitive used to build the scene part By default, the ScenePart is not build from primitives (None) More...
 
- Public Attributes inherited from ScenePart
PrimitiveType primitiveType
 The type of primitive used to build the scene part. More...
 
std::vector< Primitive * > mPrimitives
 Vector of pointers to primitives used by this scene part.
 
arma::colvec centroid
 The centroid of the scene part.
 
std::shared_ptr< AABBbound = nullptr
 The axis aligned bounding box defining scene part boundaries.
 
std::string mId = ""
 Identifier for the scene part.
 
std::vector< size_t > subpartLimit
 Vector specifying the limit of a subpart as the index of first element of next subpart. More...
 
std::string onRayIntersectionMode = ""
 Specify the handling mode for ray intersections.
 
double onRayIntersectionArgument = 0.0
 Specify the extra value to be used for ray intersection handling computation, when needed (depends on mode).
 
bool randomShift = false
 Specify if apply random shift to the scene part (true) or not (false, by default)
 
std::shared_ptr< LadLutladlut = nullptr
 Look-up table for leaf angle distribution.
 
glm::dvec3 mOrigin = glm::dvec3(0, 0, 0)
 Specify the origin for the scene part.
 
Rotation mRotation = Rotation(glm::dvec3(1, 0, 0), 0)
 Specify the rotation for the scene part.
 
double mScale = 1
 Specify the scale for the scene part.
 
int forceOnGround = 0
 Force the scene part to be on ground if \(\neq 0\), do nothing if \(= 0\). More...
 
OGRSpatialReference * mCrs = nullptr
 
OGREnvelope * mEnv = nullptr
 

Detailed Description

Implementation of a dynamic object which supports sequentiable dynamic motions.

Author
Alberto M. Esmoris Pena
Version
1.0

Sequentiable dynamic motions use sequences to modify motion queues so at each step queues are filled with corresponding dynamic motions from dynamic sequencers.

See also
DynMovingObject
DynSequencer

Constructor & Destructor Documentation

◆ DynSequentiableMovingObject() [1/5]

DynSequentiableMovingObject::DynSequentiableMovingObject ( )
default

◆ DynSequentiableMovingObject() [2/5]

DynSequentiableMovingObject::DynSequentiableMovingObject ( ScenePart const &  sp,
bool const  shallowPrimitives = false 
)
inline

◆ DynSequentiableMovingObject() [3/5]

DynSequentiableMovingObject::DynSequentiableMovingObject ( string const  id)
inline

◆ DynSequentiableMovingObject() [4/5]

DynSequentiableMovingObject::DynSequentiableMovingObject ( vector< Primitive * > const &  primitives)
inline

◆ DynSequentiableMovingObject() [5/5]

DynSequentiableMovingObject::DynSequentiableMovingObject ( string const  id,
vector< Primitive * > const &  primitives 
)
inline

Member Function Documentation

◆ addSequence()

void DynSequentiableMovingObject::addSequence ( shared_ptr< DynSequence< DynMotion >>  dmSequence)
inline

Add the dynamic sequence of dynamic motions to the dynamic motion sequencer.

Parameters
dmSequenceDynamic motion sequence to be added
See also
DynSequencer::add

◆ clearSequences()

void DynSequentiableMovingObject::clearSequences ( )
inline

Remove all dynamic sequences of dynamic motions composing the dynamic sequencer.

See also
DynSequencer::clear

◆ doSimStep()

bool DynSequentiableMovingObject::doSimStep ( )
overridevirtual

Sequentiable dynamic motions behavior implementation.

It is basically as the DynMovingObject::doSimStep but filling motion queues with dynamic motions coming from dynamic sequencer

Returns
True if the dynamic object was modified, false otherwise
See also
DynMovingObject::doSimStep
DynSequencer
DynSequence

Reimplemented from DynMovingObject.

◆ getSequence()

shared_ptr<DynSequence<DynMotion> > DynSequentiableMovingObject::getSequence ( string const &  id)
inline

Get the dynamic sequence of dynamic motions with given identifier.

Parameters
idIdentifier of dynamic sequence of dynamic motions to be retrieved
Returns
Requested dynamic sequence of dynamic motions if any, nullptr otherwise
See also
DynSequencer::get

◆ hasSequences()

bool DynSequentiableMovingObject::hasSequences ( string const &  id)
inline

Check if the dynamic sequencer has a dynamic sequence of dynamic motions with given identifier.

Parameters
idIdentifier of the dynamic sequence of dynamic motions to be checked
Returns
True if there is a dynamic sequence of dynamic motions with given identifier, false otherwise
See also
DynSequencer::has

◆ removeSequence()

void DynSequentiableMovingObject::removeSequence ( string const &  id)
inline

Remove the dynamic sequence of dynamic motions with given identifier.

Parameters
idIdentifier of dynamic sequence of dynamic motions to be removed
See also
DynSequencer::remove

◆ serialize()

template<typename Archive >
void DynSequentiableMovingObject::serialize ( Archive &  ar,
const unsigned int  version 
)
inlineprivate

Serialize a dynamic sequentiable moving object o a stream of bytes.

Template Parameters
ArchiveType of rendering
Parameters
arSpecific rendering for the stream of bytes
versionVersion number for the dynamic sequentiable moving object

The documentation for this class was generated from the following files: