Helios++
Helios software for LiDAR simulations
Primitive Class Referenceabstract

Abstract class defining the common behavior for all primitives. More...

#include <Primitive.h>

Inheritance diagram for Primitive:

Public Member Functions

virtual Primitiveclone ()=0
 
virtual void _clone (Primitive *p)
 
virtual AABBgetAABB ()=0
 Obtain the axis aligned bounding box containing the primitive. More...
 
virtual glm::dvec3 getCentroid ()=0
 Obtain the primitive centroid. More...
 
virtual double getIncidenceAngle_rad (const glm::dvec3 &rayOrigin, const glm::dvec3 &rayDir, const glm::dvec3 &intersectionPoint)=0
 Obtain the incidence angle in radians. More...
 
virtual std::vector< double > getRayIntersection (const glm::dvec3 &rayOrigin, const glm::dvec3 &rayDir)=0
 Obtain the intersection point between primitive and given ray. More...
 
virtual double getRayIntersectionDistance (const glm::dvec3 &rayOrigin, const glm::dvec3 &rayDir)=0
 Obtain the intersection distance between primitive and given ray. More...
 
virtual void onFinishLoading (NoiseSource< double > &uniformNoiseSource)
 Method to be triggered once all Primitives have been loaded. More...
 
virtual size_t getNumVertices ()
 Obtain the number of vertices returned by the getVertices function. More...
 
virtual VertexgetVertices ()=0
 Obtain basic vertices for the primitive. More...
 
virtual size_t getNumFullVertices ()
 Obtain the number of vertices returned by the getNumFullVertices function. More...
 
virtual VertexgetFullVertices ()
 Obtain full vertices for the primitive. More...
 
virtual double getGroundZOffset ()
 Offset for ground point z coordinate. More...
 
virtual void update ()=0
 Necessary primitive updates after modification. More...
 
virtual bool canHandleIntersections ()
 Specify if the primitive can handle intersections or not. More...
 
virtual IntersectionHandlingResult onRayIntersection (NoiseSource< double > &uniformNoiseSource, glm::dvec3 &rayDirection, glm::dvec3 const &insideIntersectionPoint, glm::dvec3 const &outsideIntersectionPoint, double rayIntensity)
 Handle ray intersections. More...
 
virtual void rotate (Rotation &r)
 Performs rotation over primitive. More...
 
virtual void scale (double const factor)
 Scale primitive by given factor. More...
 
virtual void translate (glm::dvec3 const &shift)
 Translate primitive by given shift. More...
 
virtual bool canComputeSigmaWithLadLut ()
 Check if primitive can compute sigma using LadLut or not. More...
 
virtual double computeSigmaWithLadLut (glm::dvec3 const &direction)
 Compute sigma using LadLut. More...
 

Public Attributes

std::shared_ptr< ScenePartpart = nullptr
 Shared pointer to the scene part the primitive belongs to. More...
 
std::shared_ptr< Materialmaterial = nullptr
 Shared pointer to the material defining certain properties such as reflectance, specularity, ... More...
 

Private Member Functions

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

Friends

class boost::serialization::access
 
std::ostream & operator<< (std::ostream &out, Primitive &p)
 Output stream operator << overloading.
 

Detailed Description

Abstract class defining the common behavior for all primitives.

Member Function Documentation

◆ canComputeSigmaWithLadLut()

virtual bool Primitive::canComputeSigmaWithLadLut ( )
inlinevirtual

Check if primitive can compute sigma using LadLut or not.

Returns
True if primitive can compute sigma using LadLut, false otherwise
See also
LadLut

Reimplemented in DetailedVoxel.

◆ canHandleIntersections()

virtual bool Primitive::canHandleIntersections ( )
inlinevirtual

Specify if the primitive can handle intersections or not.

By default primitives cannot handle intersections. Primitives which can handle intersections should override this method and return true. This method is used to avoid unnecessary computations for those primitives which are not going to handle intersections.

Returns
True if the primitive can handle intersections, False otherwise

Reimplemented in DetailedVoxel.

◆ computeSigmaWithLadLut()

virtual double Primitive::computeSigmaWithLadLut ( glm::dvec3 const &  direction)
inlinevirtual

Compute sigma using LadLut.

This computation will only be possible when primitive is able to do it. For this purpose, a LadLut is required. Also, the primitive must be able to use the LadLut.

Returns
sigma
See also
Primitive::canComputeIntensityWithLadLut
LadLut

Reimplemented in DetailedVoxel.

◆ getAABB()

virtual AABB* Primitive::getAABB ( )
pure virtual

Obtain the axis aligned bounding box containing the primitive.

Returns
Axis aligned bounding box containing the primitive

Implemented in Voxel, AABB, and Triangle.

◆ getCentroid()

virtual glm::dvec3 Primitive::getCentroid ( )
pure virtual

Obtain the primitive centroid.

Returns
Primitive centroid

Implemented in Voxel, AABB, and Triangle.

◆ getFullVertices()

virtual Vertex* Primitive::getFullVertices ( )
inlinevirtual

Obtain full vertices for the primitive.

FullVertices is a set containing basic vertices and, when necessary, those extra vertices required to define all the space occupied by the primitive.

Thi is necessary, for instance, for correct voxels ray intersection.

Returns
Full vertices for the primitive
See also
Primitive::getVertices

Reimplemented in Voxel.

◆ getGroundZOffset()

virtual double Primitive::getGroundZOffset ( )
inlinevirtual

Offset for ground point z coordinate.

When finding ground points it is necessary to consider the offset. For triangles or similar plane-like primitives, the offset is 0. However, when considering primitives with volume, the z offset must be considered to compute the ground surface and not the first intersected point.

Imagine the ray with originWaypoint at o is going through the given voxel. It will intersect at p first. However, the ground point must be q, because the ground is understood as the voxel upper surface. This offset is used to assist computing the ground point (see Scene getGrountPointAt function) ___q____

___p____
|
|
|
o
Returns
Offset for ground point z coordinate
See also
Scene::getGroundPointAt

Reimplemented in Voxel.

◆ getIncidenceAngle_rad()

virtual double Primitive::getIncidenceAngle_rad ( const glm::dvec3 &  rayOrigin,
const glm::dvec3 &  rayDir,
const glm::dvec3 &  intersectionPoint 
)
pure virtual

Obtain the incidence angle in radians.

Parameters
rayOriginRay origin coordinates
rayDirRay director vector
intersectionPointIntersection point between ray and primitive
Returns
Incidence angle (radians)

Implemented in Voxel, Triangle, and AABB.

◆ getNumFullVertices()

virtual size_t Primitive::getNumFullVertices ( )
inlinevirtual

Obtain the number of vertices returned by the getNumFullVertices function.

Returns
Nummber of vertices returned by the getNumFullVertices function
See also
Primitive::getFullVertices

Reimplemented in Voxel.

◆ getNumVertices()

virtual size_t Primitive::getNumVertices ( )
inlinevirtual

Obtain the number of vertices returned by the getVertices function.

Returns
Number of vertices returned by the getVertices function
See also
Primitive::getVertices

Reimplemented in Voxel, AABB, and Triangle.

◆ getRayIntersection()

virtual std::vector<double> Primitive::getRayIntersection ( const glm::dvec3 &  rayOrigin,
const glm::dvec3 &  rayDir 
)
pure virtual

Obtain the intersection point between primitive and given ray.

Parameters
rayOriginRay origin coordinates
rayDirRay director vector
Returns
Intersection point between primitive and given ray

Implemented in Voxel, Triangle, and AABB.

◆ getRayIntersectionDistance()

virtual double Primitive::getRayIntersectionDistance ( const glm::dvec3 &  rayOrigin,
const glm::dvec3 &  rayDir 
)
pure virtual

Obtain the intersection distance between primitive and given ray.

Parameters
rayOriginRay origin coordinates
rayDirRay director vector
Returns
Intersection distance between primitive and given ray. If no intersection is possible, then < 0 should be returned (generally -1).

Implemented in Voxel, Triangle, and AABB.

◆ getVertices()

virtual Vertex* Primitive::getVertices ( )
pure virtual

Obtain basic vertices for the primitive.

Returns
Basic vertices for the primitive
See also
Primitive::getFullVertices

Implemented in Voxel, AABB, and Triangle.

◆ onFinishLoading()

virtual void Primitive::onFinishLoading ( NoiseSource< double > &  uniformNoiseSource)
inlinevirtual

Method to be triggered once all Primitives have been loaded.

It can be used to prepare primitives after being loaded but before starting the simulation. It is not necessary that this method does nothing at all, but it can be used by primitives which need it.

Parameters
[in]uniformNoiseSourceUniform noise source in range [-1, 1]
See also
DetailedVoxel

Reimplemented in DetailedVoxel.

◆ onRayIntersection()

IntersectionHandlingResult Primitive::onRayIntersection ( NoiseSource< double > &  uniformNoiseSource,
glm::dvec3 &  rayDirection,
glm::dvec3 const &  insideIntersectionPoint,
glm::dvec3 const &  outsideIntersectionPoint,
double  rayIntensity 
)
virtual

Handle ray intersections.

This function acts as a callback to apply desired behavior when intersection events are notified.

Parameters
uniformNoiseSourceThe uniform noise source used to handle randomness simmulation
rayDirectionThe direction of the ray. It is necessary to apply randomness while avoiding the intersection point to go outside voxel limits
insideIntersectionPointThe point where the ray enters the primitive
outsideIntersectionPointThe point where the ray exits the primitive
rayIntensityIntensity for the ray intersecting the primitive
extraAn extra argument that can be used by handlers which need it
Returns
Result of handling the intersection

Reimplemented in DetailedVoxel.

◆ rotate()

void Primitive::rotate ( Rotation r)
virtual

Performs rotation over primitive.

Parameters
rRotation to perform

Reimplemented in Voxel.

◆ scale()

void Primitive::scale ( double const  factor)
virtual

Scale primitive by given factor.

Parameters
factorScale factor

Reimplemented in Voxel.

◆ translate()

void Primitive::translate ( glm::dvec3 const &  shift)
virtual

Translate primitive by given shift.

Parameters
shiftTranslation vector

Reimplemented in Voxel.

◆ update()

virtual void Primitive::update ( )
pure virtual

Necessary primitive updates after modification.

See also
Scene::finalizeLoading

Implemented in Voxel, AABB, and Triangle.

Member Data Documentation

◆ material

std::shared_ptr<Material> Primitive::material = nullptr

Shared pointer to the material defining certain properties such as reflectance, specularity, ...

See also
Material

◆ part

std::shared_ptr<ScenePart> Primitive::part = nullptr

Shared pointer to the scene part the primitive belongs to.

See also
ScenePart

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