Helios++
Helios software for LiDAR simulations
Voxel Class Reference

Class representing a voxel primitive. More...

#include <Voxel.h>

Inheritance diagram for Voxel:
Collaboration diagram for Voxel:

Public Member Functions

 Voxel ()=default
 Default voxel constructor.
 
 Voxel (glm::dvec3 center, double voxelSize)
 Voxel constructor. More...
 
 Voxel (double x, double y, double z, double halfVoxelSize)
 Voxel constructor. More...
 
Primitiveclone () override
 
void _clone (Primitive *p) override
 
void swap (Voxel &voxel)
 Swap semantic implementation for voxel. More...
 
 Voxel (Voxel const &voxel)
 
Voxeloperator= (Voxel const &voxel)
 
 Voxel (Voxel &&voxel)
 
Voxeloperator= (Voxel &&voxel)
 
AABBgetAABB () override
 
glm::dvec3 getCentroid () override
 
double getIncidenceAngle_rad (const glm::dvec3 &rayOrigin, const glm::dvec3 &rayDir, const glm::dvec3 &intersectionPoint) override
 
double getIncidenceAngleClosestFace_rad (const glm::dvec3 &rayOrigin, const glm::dvec3 &rayDir, const glm::dvec3 &intersectionPoint)
 Obtain the incidence angle with respect to closest face for given intersection point. More...
 
std::vector< double > getRayIntersection (const glm::dvec3 &rayOrigin, const glm::dvec3 &rayDir) override
 
double getRayIntersectionDistance (const glm::dvec3 &rayOrigin, const glm::dvec3 &rayDir) override
 
virtual size_t getNumVertices () override
 
VertexgetVertices () override
 
virtual size_t getNumFullVertices () override
 
VertexgetFullVertices () override
 
double getGroundZOffset () override
 
bool hasNormal ()
 Check if voxel has a valid normal. More...
 
void rotate (Rotation &r) override
  Voxel cannot be rotated More...
 
void scale (double const factor) override
 
void translate (glm::dvec3 const &shift) override
 
void update () override
 
- Public Member Functions inherited from Primitive
virtual void onFinishLoading (NoiseSource< double > &uniformNoiseSource)
 Method to be triggered once all Primitives have been loaded. 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 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

Vertex v
 Vertex representing the voxel center.
 
int numPoints = 0
 Number of points inside the voxel. Useful when the voxel has been built from a point cloud.
 
double r = 0
 Aggregated red component from points inside voxel.
 
double g = 0
 Aggregated green component from points inside voxel.
 
double b = 0
 Aggregated blue component from points inside voxel.
 
glm::dvec3 normal = glm::dvec3(0, 0, 0)
 Voxel normal vecctor.
 
AABBbbox = nullptr
 Axis aligned bounding box containing the voxel.
 
Color4f color
 Voxel color. This attribute is not used at the moment and might be removed in the future.
 
double halfSize
 Half of the voxel sizxe.
 
- Public Attributes inherited from Primitive
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<typename Archive >
void serialize (Archive &ar, const unsigned int version)
 

Friends

class boost::serialization::access
 

Detailed Description

Class representing a voxel primitive.

Constructor & Destructor Documentation

◆ Voxel() [1/2]

Voxel::Voxel ( glm::dvec3  center,
double  voxelSize 
)

Voxel constructor.

Parameters
centerVoxel center coordinates
voxelSizeVoxel size

◆ Voxel() [2/2]

Voxel::Voxel ( double  x,
double  y,
double  z,
double  halfVoxelSize 
)

Voxel constructor.

Parameters
xX coordinate of voxel center
yY coordinate of voxel center
zZ coordinate of voxel center
halfVoxelSizeHalf of the voxel size

Member Function Documentation

◆ _clone()

void Voxel::_clone ( Primitive p)
overridevirtual
See also
Primitive::_clone

Reimplemented from Primitive.

◆ clone()

Primitive * Voxel::clone ( )
overridevirtual
See also
Primitive::clone

Implements Primitive.

◆ getAABB()

AABB * Voxel::getAABB ( )
overridevirtual
See also
Primitive::getAABB

Implements Primitive.

◆ getCentroid()

glm::dvec3 Voxel::getCentroid ( )
overridevirtual
See also
Primitive::getCentroid

Implements Primitive.

◆ getFullVertices()

Vertex * Voxel::getFullVertices ( )
overridevirtual
See also
Voxel::getFullVertices

Reimplemented from Primitive.

◆ getGroundZOffset()

double Voxel::getGroundZOffset ( )
inlineoverridevirtual
See also
Voxel::getGroundZOffset

Reimplemented from Primitive.

◆ getIncidenceAngle_rad()

double Voxel::getIncidenceAngle_rad ( const glm::dvec3 &  rayOrigin,
const glm::dvec3 &  rayDir,
const glm::dvec3 &  intersectionPoint 
)
overridevirtual

◆ getIncidenceAngleClosestFace_rad()

double Voxel::getIncidenceAngleClosestFace_rad ( const glm::dvec3 &  rayOrigin,
const glm::dvec3 &  rayDir,
const glm::dvec3 &  intersectionPoint 
)

Obtain the incidence angle with respect to closest face for given intersection point.

This function is meant to be used when there is no valid voxel normal available to compute incidence angle.

Returns
Incidence angle (radians) with respect to closest face

◆ getNumFullVertices()

virtual size_t Voxel::getNumFullVertices ( )
inlineoverridevirtual
See also
Voxel::getNumFullVertices

Reimplemented from Primitive.

◆ getNumVertices()

virtual size_t Voxel::getNumVertices ( )
inlineoverridevirtual
See also
Voxel::getNumVertices

Reimplemented from Primitive.

◆ getRayIntersection()

std::vector< double > Voxel::getRayIntersection ( const glm::dvec3 &  rayOrigin,
const glm::dvec3 &  rayDir 
)
overridevirtual
See also
Voxel::getRayIntersection

Implements Primitive.

◆ getRayIntersectionDistance()

double Voxel::getRayIntersectionDistance ( const glm::dvec3 &  rayOrigin,
const glm::dvec3 &  rayDir 
)
overridevirtual

◆ getVertices()

Vertex * Voxel::getVertices ( )
overridevirtual
See also
Voxel::getVertices

Implements Primitive.

◆ hasNormal()

bool Voxel::hasNormal ( )
inline

Check if voxel has a valid normal.

A valid normal is any normal distinct than (0, 0, 0)

Returns
True if voxel has a valid normal, false otherwise

◆ rotate()

void Voxel::rotate ( Rotation r)
inlineoverridevirtual

Voxel cannot be rotated

See also
Primitive::rotate

Reimplemented from Primitive.

◆ scale()

void Voxel::scale ( double const  factor)
inlineoverridevirtual
See also
Primitive::scale

Reimplemented from Primitive.

◆ swap()

void Voxel::swap ( Voxel voxel)
inline

Swap semantic implementation for voxel.

Parameters
voxelVoxel to swap with

◆ translate()

void Voxel::translate ( glm::dvec3 const &  shift)
inlineoverridevirtual
See also
Primitive::translate

Reimplemented from Primitive.

◆ update()

void Voxel::update ( )
overridevirtual
See also
Primitive::update

Implements Primitive.


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