Code_TYMPAN  4.2.0
Industrial site acoustic simulation
Public Member Functions | Protected Attributes | List of all members
Scene Class Reference

This class mainly define a mesh (list of Shape) used by the Simulation object. More...

#include <Scene.h>

Inheritance diagram for Scene:
Inheritance graph
[legend]
Collaboration diagram for Scene:
Collaboration graph
[legend]

Public Member Functions

 Scene ()
 Constructor. More...
 
 Scene (const Scene &other)
 Copy constructor. More...
 
virtual ~Scene ()
 Destructor. More...
 
void clean ()
 Clear all arrays. More...
 
void addShape (Shape *shape)
 Add a shape to the list. More...
 
BBox getGlobalBox ()
 Return global bounding box. More...
 
AcceleratorgetAccelerator () const
 Get the accelerator. More...
 
std::vector< Shape * > * getShapes ()
 Return all the shapes. More...
 
const std::vector< Shape * > * getShapes () const
 
std::vector< vec3 > * getVertices ()
 Return all the vertices. More...
 
const std::vector< vec3 > * getVertices () const
 
std::vector< Shape * > getShapes (int shape_type)
 Return all the shapes of a specific type. More...
 
bool finish (int accelerator_id=1, leafTreatment::treatment _intersectionChoice=leafTreatment::FIRST)
 Build the selected accelerator on the scene. More...
 
bool getIndex (vec3 &search, unsigned int &result)
 Get the index of a vertex in the vertices array. More...
 
bool getVertex (unsigned int &search, vec3 &result)
 Get a vertex from the vertices array with its index. More...
 
bool addVertex (const vec3 &newVertex, unsigned int &index)
 Add a vertex to the vertices array. More...
 
ShapeaddTriangle (unsigned int i1, unsigned int i2, unsigned int i3, Material *m, const bool &isSol=false)
 Add a triangle to the scene built with the vertices array. More...
 
void addBuilding (vec3 origine, vec3 dimension, Material *m)
 Add a building to the scene. More...
 
void export_to_ply (std::string fileName)
 Export the Scene to a PLY format file named fileName. More...
 
void import_from_ply (std::string fileName)
 Import a Scene from a PLY format file named fileName. More...
 
- Public Member Functions inherited from Base
 Base ()
 Default constructor. More...
 
 Base (const Base &other)
 Copy constructor. More...
 
virtual ~Base ()
 Destructor. More...
 
std::string getName ()
 Get the name of the object. More...
 
void setName (const std::string &_name)
 Set the name of the object. More...
 

Protected Attributes

std::vector< Shape * > shapes
 Array of pointers to the shapes. More...
 
BBox globalBox
 Bounding box of the Scene. More...
 
Acceleratoraccelerator
 Pointer to the accelerator. More...
 
std::vector< vec3 > vertices
 All the vertices used by the different shapes. More...
 
std::map< vec3, unsigned int, compVecregisteredVertices
 Association between a vertex and his index in vertices. More...
 
unsigned int compteurPrimitive
 Primitives counter. More...
 
unsigned int compteurFace
 Faces counter. More...
 
- Protected Attributes inherited from Base
std::string name
 Each instantiated object may be named. More...
 

Detailed Description

This class mainly define a mesh (list of Shape) used by the Simulation object.

Definition at line 50 of file Scene.h.

Constructor & Destructor Documentation

◆ Scene() [1/2]

Scene::Scene ( )
inline

Constructor.

Definition at line 55 of file Scene.h.

◆ Scene() [2/2]

Scene::Scene ( const Scene other)
inline

Copy constructor.

Definition at line 57 of file Scene.h.

◆ ~Scene()

virtual Scene::~Scene ( )
inlinevirtual

Destructor.

Definition at line 59 of file Scene.h.

Member Function Documentation

◆ addBuilding()

void Scene::addBuilding ( vec3  origine,
vec3  dimension,
Material m 
)

Add a building to the scene.

Parameters
originePosition
dimensionDimensions
mMaterial

Definition at line 129 of file Scene.cpp.

Here is the call graph for this function:

◆ addShape()

void Scene::addShape ( Shape shape)
inline

Add a shape to the list.

Definition at line 63 of file Scene.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addTriangle()

Shape * Scene::addTriangle ( unsigned int  i1,
unsigned int  i2,
unsigned int  i3,
Material m,
const bool &  isSol = false 
)

Add a triangle to the scene built with the vertices array.

Parameters
i1Index of first vertex in vertices
i2Index of second vertex in vertices
i3Index of third vertex in vertices
mMaterial
isSolTrue is ground triangle
Returns
The triangle

Definition at line 121 of file Scene.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addVertex()

bool Scene::addVertex ( const vec3 &  newVertex,
unsigned int &  index 
)

Add a vertex to the vertices array.

Parameters
newVertex[in] New vertex
index[out] Index in the array vertices
Returns
True if succeeds, else false

Definition at line 104 of file Scene.cpp.

Here is the caller graph for this function:

◆ clean()

void Scene::clean ( )

Clear all arrays.

Definition at line 31 of file Scene.cpp.

Here is the caller graph for this function:

◆ export_to_ply()

void Scene::export_to_ply ( std::string  fileName)

Export the Scene to a PLY format file named fileName.

Definition at line 169 of file Scene.cpp.

Here is the caller graph for this function:

◆ finish()

bool Scene::finish ( int  accelerator_id = 1,
leafTreatment::treatment  _intersectionChoice = leafTreatment::FIRST 
)

Build the selected accelerator on the scene.

Parameters
accelerator_idAccelerator id
_intersectionChoiceIntersection choice
Returns
True if succeeds, false if not

Definition at line 46 of file Scene.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAccelerator()

Accelerator* Scene::getAccelerator ( ) const
inline

Get the accelerator.

Definition at line 74 of file Scene.h.

Here is the caller graph for this function:

◆ getGlobalBox()

BBox Scene::getGlobalBox ( )
inline

Return global bounding box.

Definition at line 72 of file Scene.h.

Here is the caller graph for this function:

◆ getIndex()

bool Scene::getIndex ( vec3 &  search,
unsigned int &  result 
)

Get the index of a vertex in the vertices array.

Parameters
search[in] Vertex
result[out] Index found
Returns
True if succeeds, false if not

Definition at line 81 of file Scene.cpp.

◆ getShapes() [1/3]

std::vector<Shape*>* Scene::getShapes ( )
inline

Return all the shapes.

Definition at line 77 of file Scene.h.

Here is the caller graph for this function:

◆ getShapes() [2/3]

const std::vector<Shape*>* Scene::getShapes ( ) const
inline

Definition at line 78 of file Scene.h.

◆ getShapes() [3/3]

std::vector< Shape * > Scene::getShapes ( int  shape_type)

Return all the shapes of a specific type.

Definition at line 159 of file Scene.cpp.

◆ getVertex()

bool Scene::getVertex ( unsigned int &  search,
vec3 &  result 
)

Get a vertex from the vertices array with its index.

Parameters
search[in] Index
result[out] Vertex found
Returns
True if vertex is found else false

Definition at line 93 of file Scene.cpp.

◆ getVertices() [1/2]

std::vector<vec3>* Scene::getVertices ( )
inline

Return all the vertices.

Definition at line 80 of file Scene.h.

Here is the caller graph for this function:

◆ getVertices() [2/2]

const std::vector<vec3>* Scene::getVertices ( ) const
inline

Definition at line 81 of file Scene.h.

◆ import_from_ply()

void Scene::import_from_ply ( std::string  fileName)

Import a Scene from a PLY format file named fileName.

Definition at line 232 of file Scene.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ accelerator

Accelerator* Scene::accelerator
protected

Pointer to the accelerator.

Definition at line 141 of file Scene.h.

◆ compteurFace

unsigned int Scene::compteurFace
protected

Faces counter.

Definition at line 147 of file Scene.h.

◆ compteurPrimitive

unsigned int Scene::compteurPrimitive
protected

Primitives counter.

Definition at line 146 of file Scene.h.

◆ globalBox

BBox Scene::globalBox
protected

Bounding box of the Scene.

Definition at line 140 of file Scene.h.

◆ registeredVertices

std::map<vec3, unsigned int, compVec> Scene::registeredVertices
protected

Association between a vertex and his index in vertices.

Definition at line 144 of file Scene.h.

◆ shapes

std::vector<Shape*> Scene::shapes
protected

Array of pointers to the shapes.

Definition at line 139 of file Scene.h.

◆ vertices

std::vector<vec3> Scene::vertices
protected

All the vertices used by the different shapes.

Definition at line 143 of file Scene.h.


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