Helios++
Helios software for LiDAR simulations
Scene Class Reference

Class representing a scene asset. More...

#include <Scene.h>

Inheritance diagram for Scene:
Collaboration diagram for Scene:

Public Member Functions

 Scene ()=default
 Scene default constructor.
 
 Scene (Scene &s)
 
bool finalizeLoading ()
 Handle scene loading finish process. 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 &rayOrigin, glm::dvec3 &rayDir, bool groundOnly)
 Obtain the intersection between the ray and the scene, if any. More...
 
std::map< double, Primitive * > getIntersections (glm::dvec3 &rayOrigin, glm::dvec3 &rayDir, bool 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...
 
void writeObject (std::string path)
 Serialize the scene and write it to given output file. More...
 
- Public Member Functions inherited from Asset
std::string getLocationString ()
 Obtain asset location string. More...
 

Static Public Member Functions

static ScenereadObject (std::string path)
 Read serialized scene from given file. More...
 

Public Attributes

std::vector< Primitive * > primitives
 Vector of primitives composing the scene.
 
- Public Attributes inherited from Asset
std::string id = ""
 Asset identifier.
 
std::string name = "Unnamed Asset"
 Asset name.
 
std::string sourceFilePath = ""
 Path to asset file.
 

Private Member Functions

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

Private Attributes

std::shared_ptr< KDTreeNodeRootkdtree
 KDTree splitting scene points/vertices to speed-up intersection 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.
 

Friends

class boost::serialization::access
 

Detailed Description

Class representing a scene asset.

Member Function Documentation

◆ finalizeLoading()

bool Scene::finalizeLoading ( )

Handle scene loading finish process.

Computations such as primitives update and centering the scene (all its vertices) so the axis aligned bounding box defining its boundaries start at (0, 0, 0) and also KDTree building are performed here

Returns
True if scene loading was successfully finished, false otherwise

◆ getAABB()

shared_ptr< AABB > Scene::getAABB ( )

Obtain the axis aligned bounding box defining scene boundaries.

See also
Scene::bbox

◆ getGroundPointAt()

dvec3 Scene::getGroundPointAt ( glm::dvec3  point)

Obtain the ground point at specified XY coordinates.

Parameters
pointPoint definint the XY coordinates for which the ground point shall be obtained
Returns
Intersected ground point

◆ getIntersection()

shared_ptr< RaySceneIntersection > Scene::getIntersection ( glm::dvec3 &  rayOrigin,
glm::dvec3 &  rayDir,
bool  groundOnly 
)

Obtain the intersection between the ray and the scene, if any.

Parameters
rayOriginRay origin 3D coordinates
rayDirRay 3D director vector
groundOnlyFlag to specify if only ground points must be considered (true) or not (false)
Returns
Obtained intersection, nullptr if no intersection was detected
See also
RaySceneIntersection
KDTreeRaycaster
KDTreeRaycaster::search

◆ getIntersections()

map< double, Primitive * > Scene::getIntersections ( glm::dvec3 &  rayOrigin,
glm::dvec3 &  rayDir,
bool  groundOnly 
)

Obtain all intersections between the ray and the scene, if any.

Parameters
rayOriginRay origin 3D coordinates
rayDirRay 3D director vector
groundOnlyFlag to specify if only ground points must be considered (true) or not (false)
Returns
Map of all primitives intersected by the ray, which key is the distance with respect to ray origin
See also
RaySceneIntersection
KDTreeRaycaster
KDTreeRaycaster::searchAll

◆ getShift()

dvec3 Scene::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.

Returns
Minimum boundaries of the original axis aligned bounding box, before translating to (0, 0, 0)

◆ readObject()

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

Read serialized scene from given file.

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

◆ writeObject()

void Scene::writeObject ( std::string  path)

Serialize the scene and write it to given output file.

Parameters
pathPath to output file where serialized scene shall be stored

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