Radium Engine  1.5.20
Loading...
Searching...
No Matches
Ra::Core::Geometry::VolumeGrid Class Reference

Discrete volume data storing values in a regular grid. More...

#include <Core/Geometry/Volume.hpp>

+ Inheritance diagram for Ra::Core::Geometry::VolumeGrid:
+ Collaboration diagram for Ra::Core::Geometry::VolumeGrid:

Public Types

using ValueType = AbstractDiscreteVolume::ValueType
 
using IndexType = AbstractDiscreteVolume::IndexType
 
using GradientType = Eigen::Matrix<ValueType, 4, 1>
 
using Container = std::vector<ValueType>
 
using GradientContainer = std::vector<GradientType>
 
- Public Types inherited from Ra::Core::Geometry::AbstractDiscreteVolume
using ValueType = AbstractVolume::ValueType
 
using IndexType = Vector3i
 
- Public Types inherited from Ra::Core::Geometry::AbstractVolume
enum  VolumeStorageType { UNKNOWN = 1 << 0 , PARAMETRIC = 1 << 1 , DISCRETE_DENSE = 1 << 2 , DISCRETE_SPARSE = 1 << 3 }
 The type of geometry. More...
 
using ValueType = Scalar
 Type of value encoded in the volume.
 

Public Member Functions

 VolumeGrid (const ValueType &defaultValue=ValueType(0.))
 
 VolumeGrid (const VolumeGrid &data)=default
 
VolumeGridoperator= (const VolumeGrid &)=default
 
const Containerdata () const
 Direct access to the managed data.
 
Containerdata ()
 Direct access, with modification allowed to the managed data.
 
void addToAllBins (const ValueType &value)
 Add a value to all bins.
 
bool hasGradients () const
 Test if gradients are defined.
 
void computeGradients ()
 Generate gradients from data.
 
const GradientContainergradient () const
 Direct access to the managed gradients.
 
GradientContainergradient ()
 Direct access, with modification allowed to the managed gradients.
 
bool addToBin (const ValueType &value, Eigen::Ref< const IndexType > p)
 
Utils::optional< ValueType > getBinValue (Eigen::Ref< const IndexType > p) const
 Get the value of the given bin.
 
- Public Member Functions inherited from Ra::Core::Geometry::AbstractDiscreteVolume
 AbstractDiscreteVolume (const AbstractDiscreteVolume &data)=default
 
AbstractDiscreteVolumeoperator= (const AbstractDiscreteVolume &)=default
 
void clear () override
 Erases all data, making the geometry empty.
 
Aabb computeAabb () const override
 Compute the aabb of the volume.
 
const Vector3i & size () const
 return the size (number of bins ni each dimension) of the volume
 
void setSize (Eigen::Ref< const Vector3i > size)
 
const Vector3 & binSize () const
 return the bin size
 
void setBinSize (Eigen::Ref< const Vector3 > binSize)
 Set the bin size.
 
Utils::optional< ValueType > getBinValue (Eigen::Ref< const IndexType > p) const
 Get the value of the given bin.
 
Utils::optional< ValueType > getValue (Eigen::Ref< const Vector3 > p) const override final
 
bool addToBin (const ValueType &value, Eigen::Ref< const IndexType > p)
 
- Public Member Functions inherited from Ra::Core::Geometry::AbstractVolume
 AbstractVolume (const AbstractVolume &data)=default
 
AbstractVolumeoperator= (const AbstractVolume &)=default
 
VolumeStorageType getType () const
 Return the type of geometry.
 
void displayInfo () const
 Print info to the Debug output. Need to be extended by child classes.
 
bool isParametric () const
 
bool isDiscrete () const
 Return true if the volume is discrete. Can be cast as AbstractDiscreteVolume.
 
bool isDense () const
 Return true if the volume is dense (implies isDiscrete to be true)
 
bool isSparse () const
 Return true if the volume is sparse (implies isDiscrete to be true)
 
- Public Member Functions inherited from Ra::Core::Geometry::AbstractGeometry
 AbstractGeometry (const AbstractGeometry &other)
 
AbstractGeometryoperator= (const AbstractGeometry &other)
 
Ra::Core::Utils::ObservableVoid & getAabbObservable ()
 

Protected Member Functions

Utils::optional< ValueType > getBinValue (typename IndexType::Scalar idx) const override
 
void addToBin (const ValueType &value, typename IndexType::Scalar idx) override
 
void updateStorage () override
 
- Protected Member Functions inherited from Ra::Core::Geometry::AbstractDiscreteVolume
 AbstractDiscreteVolume (const VolumeStorageType &type)
 
Utils::optional< typename IndexType::Scalar > linearIndex (Eigen::Ref< const IndexType > p) const
 Convert the 3D position into a linear index on the bin set.
 
- Protected Member Functions inherited from Ra::Core::Geometry::AbstractVolume
 AbstractVolume (const VolumeStorageType &type)
 
void setType (const VolumeStorageType &type)
 Set the type of geometry.
 
- Protected Member Functions inherited from Ra::Core::Geometry::AbstractGeometry
bool isAabbValid () const
 
Core::Aabb getAabb () const
 
void invalidateAabb () const
 
void setAabb (const Core::Aabb &aabb) const
 

Additional Inherited Members

- Protected Attributes inherited from Ra::Core::Geometry::AbstractVolume
VolumeStorageType m_type
 The type of geometry for the object.
 

Detailed Description

Discrete volume data storing values in a regular grid.

Definition at line 181 of file Volume.hpp.

Member Typedef Documentation

◆ Container

Definition at line 190 of file Volume.hpp.

◆ GradientContainer

Definition at line 191 of file Volume.hpp.

◆ GradientType

using Ra::Core::Geometry::VolumeGrid::GradientType = Eigen::Matrix<ValueType, 4, 1>

Definition at line 188 of file Volume.hpp.

◆ IndexType

using Ra::Core::Geometry::VolumeGrid::IndexType = AbstractDiscreteVolume::IndexType

Definition at line 185 of file Volume.hpp.

◆ ValueType

using Ra::Core::Geometry::VolumeGrid::ValueType = AbstractDiscreteVolume::ValueType

Definition at line 184 of file Volume.hpp.

Constructor & Destructor Documentation

◆ VolumeGrid()

Ra::Core::Geometry::VolumeGrid::VolumeGrid ( const ValueType & defaultValue = ValueType( 0. ))
inline

Definition at line 194 of file Volume.hpp.

Member Function Documentation

◆ addToAllBins()

void Ra::Core::Geometry::VolumeGrid::addToAllBins ( const ValueType & value)
inline

Add a value to all bins.

Definition at line 209 of file Volume.hpp.

◆ addToBin() [1/2]

bool Ra::Core::Geometry::AbstractDiscreteVolume::addToBin ( const ValueType & value,
Eigen::Ref< const IndexType > p )
inline

Increment bin p by value.

Note
: does nothing if p is out of bounds.

Definition at line 150 of file Volume.hpp.

◆ addToBin() [2/2]

void Ra::Core::Geometry::VolumeGrid::addToBin ( const ValueType & value,
typename IndexType::Scalar idx )
inlineoverrideprotectedvirtual

Add a value to the given bin

Warning
no bounds checking on the parameter idx

Implements Ra::Core::Geometry::AbstractDiscreteVolume.

Definition at line 235 of file Volume.hpp.

◆ computeGradients()

void Ra::Core::Geometry::VolumeGrid::computeGradients ( )

Generate gradients from data.

Definition at line 71 of file Volume.cpp.

◆ data() [1/2]

Container & Ra::Core::Geometry::VolumeGrid::data ( )
inline

Direct access, with modification allowed to the managed data.

Definition at line 206 of file Volume.hpp.

◆ data() [2/2]

const Container & Ra::Core::Geometry::VolumeGrid::data ( ) const
inline

Direct access to the managed data.

Definition at line 204 of file Volume.hpp.

◆ getBinValue() [1/2]

Utils::optional< ValueType > Ra::Core::Geometry::AbstractDiscreteVolume::getBinValue ( Eigen::Ref< const IndexType > p) const
inline

Get the value of the given bin.

Definition at line 133 of file Volume.hpp.

◆ getBinValue() [2/2]

Utils::optional< ValueType > Ra::Core::Geometry::VolumeGrid::getBinValue ( typename IndexType::Scalar idx) const
inlineoverrideprotectedvirtual

Get the function value a given position p

Warning
no bounds checking on the parameter p

Implements Ra::Core::Geometry::AbstractDiscreteVolume.

Definition at line 229 of file Volume.hpp.

◆ gradient() [1/2]

GradientContainer & Ra::Core::Geometry::VolumeGrid::gradient ( )
inline

Direct access, with modification allowed to the managed gradients.

Definition at line 224 of file Volume.hpp.

◆ gradient() [2/2]

const GradientContainer & Ra::Core::Geometry::VolumeGrid::gradient ( ) const
inline

Direct access to the managed gradients.

Definition at line 222 of file Volume.hpp.

◆ hasGradients()

bool Ra::Core::Geometry::VolumeGrid::hasGradients ( ) const
inline

Test if gradients are defined.

Definition at line 216 of file Volume.hpp.

◆ updateStorage()

void Ra::Core::Geometry::VolumeGrid::updateStorage ( )
inlineoverrideprotectedvirtual
Warning
This method needs to be updated in case we switch to multidimensionnal functions

Implements Ra::Core::Geometry::AbstractDiscreteVolume.

Definition at line 240 of file Volume.hpp.


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