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

Triangle class. More...

#include <Triangle.h>

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

Public Member Functions

 Triangle ()
 Default constructor. More...
 
 Triangle (unsigned int p1, unsigned int p2, unsigned int p3, std::vector< vec3 > *_vertices, Material *_m, const bool &isSol=false)
 Constructor with 3 index points of the array _vertices. More...
 
 Triangle (const vec3 &p1, const vec3 &p2, const vec3 &p3, Material *m, const bool &isSol=false)
 Constructor with 3 points. More...
 
 Triangle (const Triangle &other)
 Copy constructor. More...
 
virtual ~Triangle ()
 Destructor. More...
 
virtual void updateBBox ()
 Update the bounding box: More...
 
virtual bool getIntersection (Ray &ray, Intersection &inter)
 Get the Intersection between a ray and this shape. More...
 
void setNormal (const vec3 &_normal)
 Set/Get the normal. More...
 
virtual vec3 getNormal (const vec3 pos=vec3())
 Get normal. More...
 
virtual bool sample (decimal density, std::vector< vec3 > &samples)
 Uncommented method cause not used. More...
 
virtual int form ()
 Return type of the shape. More...
 
- Public Member Functions inherited from Shape
 Shape ()
 Default constructor. More...
 
 Shape (const std::string _name)
 Constructor by giving a name to the Shape. More...
 
 Shape (Shape *other)
 Copy constructor. More...
 
virtual ~Shape ()
 Destructor. More...
 
 Shape (const Shape &other)
 Copy constructor. More...
 
virtual ShapeClone ()
 Clone and return a pointer to a Shape. More...
 
MaterialgetMaterial ()
 Return the pointed material. More...
 
void setMaterial (Material *m)
 Set the material. More...
 
BBox getBBox ()
 Return the bounding box. More...
 
void setVertices (std::vector< vec3 > *_vertices)
 Set/Get global vertices. More...
 
vector< vec3 > * getVertices ()
 
vector< unsigned int > * getLocalVertices ()
 Get local vertices. More...
 
virtual bool isVisible ()
 Return visibility. More...
 
void setPrimitiveId (int id)
 Set/Get the primitive id. More...
 
int getPrimitiveId () const
 
void setFaceId (int id)
 Set/Get the face id. More...
 
int getFaceId () const
 
void setEtageId (int id)
 Set/Get the floor id. More...
 
int getEtageId ()
 
void setBuildingId (int id)
 Set/Get the building id. More...
 
int getBuildingId ()
 
bool isSol () const
 Get/Set the flag _isSol (ground or not) More...
 
void setIsSol (const bool &isSol)
 
- 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

vec3 p
 First vertex (vertex1=p) More...
 
vec3 u
 Vector to reach the second vertex (vertex2=p+u) More...
 
vec3 v
 Vector to reach the third vertex (vertex3=p+v) More...
 
vec3 normal
 Normal to triangle. More...
 
- Protected Attributes inherited from Shape
BBox box
 Bounding box of the shape. More...
 
Materialmaterial
 Pointer to material. More...
 
std::vector< vec3 > * vertices
 GlobalVertices of the scene. More...
 
std::vector< unsigned int > localVertices
 Index of the vertices used for this shape. More...
 
int primitiveId
 Index of the primitive (given by the scene) More...
 
int faceId
 Index of the face supporting the primitive. More...
 
int buildingId
 Index of the building supporting the primitive (-1 if none) More...
 
int etageId
 Index of the floor (etage) supporting the primitive (-1 if none) More...
 
bool _isSol
 Triangle type (false = non natural, true = ground) More...
 
- Protected Attributes inherited from Base
std::string name
 Each instantiated object may be named. More...
 

Detailed Description

Triangle class.

Definition at line 24 of file Triangle.h.

Constructor & Destructor Documentation

◆ Triangle() [1/4]

Triangle::Triangle ( )
inline

Default constructor.

Definition at line 29 of file Triangle.h.

◆ Triangle() [2/4]

Triangle::Triangle ( unsigned int  p1,
unsigned int  p2,
unsigned int  p3,
std::vector< vec3 > *  _vertices,
Material _m,
const bool &  isSol = false 
)

Constructor with 3 index points of the array _vertices.

Definition at line 36 of file Triangle.cpp.

Here is the call graph for this function:

◆ Triangle() [3/4]

Triangle::Triangle ( const vec3 &  p1,
const vec3 &  p2,
const vec3 &  p3,
Material m,
const bool &  isSol = false 
)

Constructor with 3 points.

Definition at line 20 of file Triangle.cpp.

Here is the call graph for this function:

◆ Triangle() [4/4]

Triangle::Triangle ( const Triangle other)
inline

Copy constructor.

Definition at line 39 of file Triangle.h.

◆ ~Triangle()

virtual Triangle::~Triangle ( )
inlinevirtual

Destructor.

Definition at line 44 of file Triangle.h.

Member Function Documentation

◆ form()

virtual int Triangle::form ( )
inlinevirtual

Return type of the shape.

Reimplemented from Shape.

Definition at line 63 of file Triangle.h.

◆ getIntersection()

bool Triangle::getIntersection ( Ray ray,
Intersection inter 
)
virtual

Get the Intersection between a ray and this shape.

Reimplemented from Shape.

Definition at line 70 of file Triangle.cpp.

Here is the call graph for this function:

◆ getNormal()

virtual vec3 Triangle::getNormal ( const vec3  pos = vec3())
inlinevirtual

Get normal.

Reimplemented from Shape.

Definition at line 55 of file Triangle.h.

◆ sample()

bool Triangle::sample ( decimal  density,
std::vector< vec3 > &  samples 
)
virtual

Uncommented method cause not used.

Reimplemented from Shape.

Definition at line 102 of file Triangle.cpp.

◆ setNormal()

void Triangle::setNormal ( const vec3 &  _normal)
inline

Set/Get the normal.

Definition at line 51 of file Triangle.h.

◆ updateBBox()

void Triangle::updateBBox ( )
virtual

Update the bounding box:

Reimplemented from Shape.

Definition at line 61 of file Triangle.cpp.

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

Member Data Documentation

◆ normal

vec3 Triangle::normal
protected

Normal to triangle.

Definition at line 73 of file Triangle.h.

◆ p

vec3 Triangle::p
protected

First vertex (vertex1=p)

Definition at line 69 of file Triangle.h.

◆ u

vec3 Triangle::u
protected

Vector to reach the second vertex (vertex2=p+u)

Definition at line 70 of file Triangle.h.

◆ v

vec3 Triangle::v
protected

Vector to reach the third vertex (vertex3=p+v)

Definition at line 71 of file Triangle.h.


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