Helios++
Helios software for LiDAR simulations
DynScene Class Reference

Dynamic scene base implementation. More...

#include <DynScene.h>

Inheritance diagram for DynScene:
Collaboration diagram for DynScene:

Public Member Functions

 DynScene (int const stepInterval=1)
 Dynamic scene default constructor.
 
 DynScene (DynScene &ds)
 Copy constructor for dynamic scene. More...
 
 DynScene (Scene &s, int const stepInterval=1)
 Build a dynamic scene using given scene as basis. More...
 
 DynScene (StaticScene &ss, int const stepInterval=1)
 Build a dynamic scene using given static scene as basis. More...
 
bool doSimStep () override
 Do corresponding computations for the dynamic scene at current simulation step, if any. More...
 
bool doStep ()
 Dynamic behavior computation itself. More...
 
virtual void makeStepLoop (int const stepInterval)
 Build the step loop with given step interval for the dynamic scene. More...
 
void appendDynObject (shared_ptr< DynObject > dynobj)
 Append given dynamic object to the scene. More...
 
shared_ptr< DynObjectgetDynObject (size_t const index)
 Obtain dynamic object at given index. More...
 
void setDynObject (size_t const index, shared_ptr< DynObject > dynobj)
 Set dynamic object at given index. More...
 
void removeDynObject (size_t const index)
 Remove dynamic object at given index. More...
 
void clearDynObjects ()
 Remove all dynamic objects from the dynamic scene.
 
size_t numDynObjects ()
 Obtain the number of dynamic objects in the scene. More...
 
bool isDynObjectUpdated (size_t const index) const
 Check whether the dynamic object at given index has been updated on last step (true) or not (false) More...
 
int getStepInterval () const
 Obtain the current step interval for the dynamic scene. More...
 
void setStepInterval (int const stepInterval)
 Set the step interval for the dynamic scene. More...
 
void writeObject (std::string path) override
 Serialize the dynamic scene and write it to given output file. More...
 
- Public Member Functions inherited from StaticScene
 StaticScene ()=default
 Static scene default constructor.
 
 StaticScene (StaticScene &ss)
 Copy constructor for static scene. More...
 
 StaticScene (Scene &s)
 Build a static scene using given scene as basis. More...
 
void appendStaticObject (shared_ptr< ScenePart > obj)
 Append given static object to the scene. More...
 
shared_ptr< ScenePartgetStaticObject (size_t const index)
 Obtain static object at given index. More...
 
void setStaticObject (size_t const index, shared_ptr< ScenePart > obj)
 Set static object at given index. More...
 
void removeStaticObject (size_t const index)
 Remove static object at given index. More...
 
void clearStaticObjects ()
 Remove all static objects from the static scene.
 
size_t numStaticObjects ()
 Obtain the number of static objects in the scene. More...
 
void writeObject (std::string path) override
 Serialize the static scene and write it to given output file. More...
 
- Public Member Functions inherited from Scene
 Scene ()
 Scene default constructor.
 
 Scene (Scene &s)
 
bool finalizeLoading (bool const safe=false)
 Handle scene loading finish process. More...
 
void registerParts ()
 Register all scene parts composing the scene in the parts vector with no repetitions. More...
 
std::shared_ptr< AABBgetAABB ()
 Obtain the axis aligned bounding box defining scene boundaries. More...
 
glm::dvec3 getGroundPointAt (glm::dvec3 point)
 Obtain the ground point at specified XY coordinates. More...
 
std::shared_ptr< RaySceneIntersectiongetIntersection (glm::dvec3 const &rayOrigin, glm::dvec3 const &rayDir, bool const groundOnly) const
 Obtain the intersection between the ray and the scene, if any. More...
 
std::shared_ptr< RaySceneIntersectiongetIntersection (vector< double > const &tMinMax, glm::dvec3 const &rayOrigin, glm::dvec3 const &rayDir, bool const groundOnly) const
 Like Scene::getIntersection(dvec3 const, dvec3 const, bool const) but receiving precomputed minimum and maximum intersection times with respect to the axis aligned bounding box that bounds the scene. More...
 
std::map< double, Primitive * > getIntersections (glm::dvec3 &rayOrigin, glm::dvec3 &rayDir, bool const groundOnly)
 Obtain all intersections between the ray and the scene, if any. More...
 
glm::dvec3 getShift ()
 Obtain the minimum boundaries of the original axis aligned bounding box containing the scene, before it was centered so (0, 0, 0) became its new minimum boundaries. More...
 
glm::dvec3 const & getShiftRef () const
 Like Scene::getShift but returning a const reference instead of a copy. More...
 
std::vector< Vertex * > getAllVertices ()
 Obtain all vertices (without repetitions) composing the scene. More...
 
void doForceOnGround ()
 For each scene part which is flagged as forceOnGround, it will be vertically translated to closest ground scene part. More...
 
glm::dvec3 findForceOnGroundQ (int const searchDepth, glm::dvec3 const minzv, vector< Vertex * > &vertices, vector< double > const &o, vector< double > const &v)
 Assist doForceOnGround function to find an adequate \(q\) for step 4. More...
 
void buildKDGrove (bool const safe=false)
 Build the KDGrove for the scene, overwriting previous one if any. More...
 
void buildKDGroveWithLog (bool const safe=false)
 Call buildKDGrove exporting building information through logging system. More...
 
virtual std::shared_ptr< KDGroveRaycaster > const & getRaycaster () const
 
virtual std::shared_ptr< KDGroveFactorygetKDGroveFactory () const
 Obtain the KDGrove factory used by the scene. More...
 
virtual void setKDGroveFactory (std::shared_ptr< KDGroveFactory > const kdgf)
 Set the KDGrove factory to be used by the scene. More...
 
virtual std::shared_ptr< KDGrovegetKDGrove () const
 Obtain the KDGrove used by the scene. More...
 
virtual void setKDGrove (std::shared_ptr< KDGrove > const kdgrove)
 Set the KDGrove to be used by the scene. More...
 
virtual std::shared_ptr< AABBgetBBox () const
 Obtain the scene's bounding box. More...
 
virtual void setBBox (std::shared_ptr< AABB > const bbox)
 Set the scene's bounding box. More...
 
virtual std::shared_ptr< AABBgetBBoxCRS () const
 Obtain the scene's coordinate reference system bounding box. More...
 
virtual void setBBoxCRS (std::shared_ptr< AABB > const bbox)
 Set the scene's coordinate reference system bounding box. More...
 
virtual bool hasMovingObjects () const
 Checke whether the scene contains at least one moving object (true) or not (false) More...
 
- Public Member Functions inherited from Asset
std::string getLocationString ()
 Obtain asset location string. More...
 
virtual bool isEgg () const
 Check whether the asset is an EggAsset or not. More...
 

Static Public Member Functions

static DynScenereadObject (std::string path)
 Read serialized dynamic scene from given file. More...
 
- Static Public Member Functions inherited from StaticScene
static StaticScenereadObject (std::string path)
 Read serialized static scene from given file. More...
 
- Static Public Member Functions inherited from Scene
static ScenereadObject (std::string path)
 Read serialized scene from given file. More...
 

Protected Attributes

vector< shared_ptr< DynObject > > dynObjs
 Dynamic objects composing the scene.
 
vector< bool > updated
 Vector of flags controlling whether a dynamic object has been updated after last step (true) or not. More...
 
NonVoidStepLoop< bool > stepLoop
 The step loop for the dynamic scene. More...
 
- Protected Attributes inherited from StaticScene
vector< shared_ptr< ScenePart > > staticObjs
 Static objects composing the scene.
 
- Protected Attributes inherited from Scene
std::shared_ptr< KDGroveFactorykdgf
 The KDGrove factory used to build the scene KDGrove. More...
 
std::shared_ptr< KDGrovekdgrove
 KDGrove containing a KDTree for each scene part to speed-up ray-primitive intersection check computations.
 
std::shared_ptr< AABBbbox
 Axis aligned bounding box defining scene boundaries.
 
std::shared_ptr< AABBbbox_crs
 Original axis aligned bounding box defining scene boundaries before centering it.
 
std::shared_ptr< KDGroveRaycasterraycaster
 The raycaster based on KDGrove. More...
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 Serialize a DynScene to a stream of bytes. More...
 
template<class Archive >
void save (Archive &ar, const unsigned int version) const
 Save a serialized DynScene to a stream of bytes. More...
 
template<class Archive >
void load (Archive &ar, const unsigned int version)
 Load a serialized DynScene from a stream of bytes. More...
 

Friends

class boost::serialization::access
 

Additional Inherited Members

- Public Attributes inherited from Scene
std::vector< Primitive * > primitives
 Vector of primitives composing the scene.
 
std::vector< std::shared_ptr< ScenePart > > parts
 Parts composing the scene with no repeats. More...
 
- Public Attributes inherited from Asset
std::string id = ""
 Asset identifier.
 
std::string name = "Unnamed Asset"
 Asset name.
 
std::string sourceFilePath = ""
 Path to asset file.
 

Detailed Description

Dynamic scene base implementation.

Author
Alberto M. Esmoris Pena
Version
1.0

A dynamic scene extends the functionalities of a static scene considering dynamic objects. Thus, the dynamic scene implements a doSimStep method as Platform or Scanner do. In consequence, using a dynamic scene means the scene will change as the simulation advances. This differs from basic scenes which are totally static.

See also
StaticScene
Scene

Constructor & Destructor Documentation

◆ DynScene() [1/3]

DynScene::DynScene ( DynScene ds)

Copy constructor for dynamic scene.

Parameters
dsDynamic scene to be copied

◆ DynScene() [2/3]

DynScene::DynScene ( Scene s,
int const  stepInterval = 1 
)
inline

Build a dynamic scene using given scene as basis.

Parameters
sBasis scene for dynamic scene

◆ DynScene() [3/3]

DynScene::DynScene ( StaticScene ss,
int const  stepInterval = 1 
)
inline

Build a dynamic scene using given static scene as basis.

Parameters
ssBasis static scene for dynamic scene

Member Function Documentation

◆ appendDynObject()

void DynScene::appendDynObject ( shared_ptr< DynObject dynobj)
inline

Append given dynamic object to the scene.

Parameters
dynobjDynamic object to be appended to the scene
See also
DynObject

◆ doSimStep()

bool DynScene::doSimStep ( )
overridevirtual

Do corresponding computations for the dynamic scene at current simulation step, if any.

Computations only occur for simulation steps which satisfy:

\[ s_{t} \equiv 0 \mod \Delta \]

Where \(\Delta\) is the step interval and \(s_{t}\) is the current step at instant \(t\).

Notice handling of this loop is done through StepLoop class

Returns
True if any dynamic object was udpated, false otherwise
See also
DynScene::stepInterval
DynScene::currentStep
DynScene::doStep
Scene::doSimStep
StepLoop

Reimplemented from Scene.

◆ doStep()

bool DynScene::doStep ( )

Dynamic behavior computation itself.

This function is invoked by doSimStep when necessary.

Returns
True if any dynamic object was udpated, false otherwise
See also
DynScene::doSimStep

◆ getDynObject()

shared_ptr<DynObject> DynScene::getDynObject ( size_t const  index)
inline

Obtain dynamic object at given index.

Parameters
indexIndex of dynamic object to be obtained
Returns
Dynamic object at given index

◆ getStepInterval()

int DynScene::getStepInterval ( ) const
inline

Obtain the current step interval for the dynamic scene.

Returns
Current step interval for the dynamic scene
See also
DynScene::stepLoop

◆ isDynObjectUpdated()

bool DynScene::isDynObjectUpdated ( size_t const  index) const
inline

Check whether the dynamic object at given index has been updated on last step (true) or not (false)

Parameters
indexIndex of dynamic object to be checked
Returns
True if dynamic object at given index has been updated on last step, false otherwise

◆ load()

template<class Archive >
void DynScene::load ( Archive &  ar,
const unsigned int  version 
)
inlineprivate

Load a serialized DynScene from a stream of bytes.

See also
DynScene::serialize(Archive &, const unsigned int)
DynScene::save(Archive &, const unsigned int)

◆ makeStepLoop()

void DynScene::makeStepLoop ( int const  stepInterval)
virtual

Build the step loop with given step interval for the dynamic scene.

Parameters
stepIntervalStep interval for the step loop to be built
See also
StepLoop

◆ numDynObjects()

size_t DynScene::numDynObjects ( )
inline

Obtain the number of dynamic objects in the scene.

Returns
Number of dynamic objects in the scene

◆ readObject()

DynScene * DynScene::readObject ( std::string  path)
static

Read serialized dynamic scene from given file.

Parameters
pathPath to file where a serialized dynamic scene is stored
Returns
Imported dynamic scene

◆ removeDynObject()

void DynScene::removeDynObject ( size_t const  index)
inline

Remove dynamic object at given index.

Parameters
indexIndex of dynamic object to be removed

◆ save()

template<class Archive >
void DynScene::save ( Archive &  ar,
const unsigned int  version 
) const
inlineprivate

◆ serialize()

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

Serialize a DynScene to a stream of bytes.

Template Parameters
ArchiveType of rendering
Parameters
arSpecific rendering for the stream of bytes
versionVersion number for the DynScene
See also
DynScene::save(Archive &, const unsigned int)
DynScene::load(Archive &, const unsigned int)

◆ setDynObject()

void DynScene::setDynObject ( size_t const  index,
shared_ptr< DynObject dynobj 
)
inline

Set dynamic object at given index.

Parameters
indexIndex of dynamic object to be setted
dynobjNew dynamic object

◆ setStepInterval()

void DynScene::setStepInterval ( int const  stepInterval)
inline

Set the step interval for the dynamic scene.

Parameters
stepIntervalThe new step interval for the dynamic scene
See also
DynScene::stepLoop

◆ writeObject()

void DynScene::writeObject ( std::string  path)
overridevirtual

Serialize the dynamic scene and write it to given output file.

Parameters
pathPath to output file where serialized dynamic scene shall be stored

Reimplemented from Scene.

Member Data Documentation

◆ stepLoop

NonVoidStepLoop<bool> DynScene::stepLoop
protected

The step loop for the dynamic scene.

See also
StepLoop

◆ updated

vector<bool> DynScene::updated
protected

Vector of flags controlling whether a dynamic object has been updated after last step (true) or not.

If updated[i] is true it means the i-th dynamic object has been updated on last step, if it is false then it means the i-th dynamic object has NOT been updated on last step.


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