Oriented Bounding Box calculator. More...

#include <OBBox.hpp>

Inheritance diagram for mimmo::OBBox:
Collaboration diagram for mimmo::OBBox:

Public Member Functions

 OBBox ()
 
 OBBox (const bitpit::Config::Section &rootXML)
 
 OBBox (const OBBox &other)
 
virtual ~OBBox ()
 
virtual void absorbSectionXML (const bitpit::Config::Section &slotXML, std::string name="")
 
void buildPorts ()
 
void clearOBBox ()
 
void execute ()
 
virtual void flushSectionXML (bitpit::Config::Section &slotXML, std::string name="")
 
dmatrix33E getAxes ()
 
std::vector< MimmoSharedPointer< MimmoObject > > getGeometries ()
 
OBBStrategy getOBBStrategy ()
 
darray3E getOrigin ()
 
darray3E getSpan ()
 
bool isForcedAABB ()
 
void plot (std::string directory, std::string filename, int counter, bool binary)
 
void setForceAABB (bool flag)
 
void setGeometries (std::vector< MimmoSharedPointer< MimmoObject > > listgeo)
 
void setGeometry (MimmoSharedPointer< MimmoObject > geo)
 
void setOBBStrategy (OBBStrategy strategy)
 
void setOBBStrategyInt (int strategyflag)
 
void setWriteInfo (bool flag)
 
- Public Member Functions inherited from mimmo::BaseManipulation
 BaseManipulation ()
 
 BaseManipulation (const BaseManipulation &other)
 
virtual ~BaseManipulation ()
 
void activate ()
 
bool arePortsBuilt ()
 
void clear ()
 
void disable ()
 
void exec ()
 
BaseManipulationgetChild (int i=0)
 
ConnectionType getConnectionType ()
 
MimmoSharedPointer< MimmoObjectgetGeometry ()
 
MimmoSharedPointer< MimmoObject > & getGeometryReference ()
 
int getId ()
 
bitpit::Logger & getLog ()
 
std::string getName ()
 
int getNChild ()
 
int getNParent ()
 
int getNPortsIn ()
 
int getNPortsOut ()
 
BaseManipulationgetParent (int i=0)
 
std::unordered_map< PortID, PortIn * > getPortsIn ()
 
std::unordered_map< PortID, PortOut * > getPortsOut ()
 
uint getPriority ()
 
virtual std::vector< BaseManipulation * > getSubBlocksEmbedded ()
 
bool isActive ()
 
bool isApply ()
 
bool isChild (BaseManipulation *, int &)
 
bool isParent (BaseManipulation *, int &)
 
bool isPlotInExecution ()
 
BaseManipulationoperator= (const BaseManipulation &other)
 
void removePins ()
 
void removePinsIn ()
 
void removePinsOut ()
 
void setApply (bool flag=true)
 
void setGeometry (MimmoSharedPointer< MimmoObject > geometry)
 
void setId (int)
 
void setLog (bitpit::Logger &log)
 
void setName (std::string name)
 
void setOutputPlot (std::string path)
 
void setPlotInExecution (bool)
 
void setPriority (uint priority)
 
void unsetGeometry ()
 

Protected Member Functions

void computeAABB (std::vector< MimmoSharedPointer< MimmoObject >> &vector_listgeo, darray3E &origin, darray3E &span, dmatrix33E &axes)
 
void computeOBB (std::vector< MimmoSharedPointer< MimmoObject >> &vector_listgeo, darray3E &origin, darray3E &span, dmatrix33E &axes)
 
dmatrix33E inverse (const dmatrix33E &mat)
 
virtual void plotOptionalResults ()
 
void swap (OBBox &x) noexcept
 
dmatrix33E transpose (const dmatrix33E &mat)
 
- Protected Member Functions inherited from mimmo::BaseManipulation
void _apply (MimmoPiercedVector< darray3E > &displacements)
 
void addChild (BaseManipulation *child)
 
void addParent (BaseManipulation *parent)
 
void addPinIn (BaseManipulation *objIn, PortID portR)
 
void addPinOut (BaseManipulation *objOut, PortID portS, PortID portR)
 
virtual void apply ()
 
void cleanBufferIn (PortID port)
 
template<typename T , typename O >
bool createPortIn (O *obj, void(O::*setVar_)(T), PortID portR, bool mandatory=false, int family=0)
 
template<typename T , typename O >
bool createPortIn (T *var_, PortID portR, bool mandatory=false, int family=0)
 
template<typename T , typename O >
bool createPortOut (O *obj, T(O::*getVar_)(), PortID portS)
 
template<typename T , typename O >
bool createPortOut (T *var_, PortID portS)
 
void deletePorts ()
 
PortID findPinIn (PortIn &pin)
 
PortID findPinOut (PortOut &pin)
 
void initializeLogger (bool logexists)
 
void readBufferIn (PortID port)
 
void removePinIn (BaseManipulation *objIn, PortID portR)
 
void removePinIn (PortID portR, int j)
 
void removePinOut (BaseManipulation *objOut, PortID portS)
 
void removePinOut (PortID portS, int j)
 
void setBufferIn (PortID port, mimmo::IBinaryStream &input)
 
void swap (BaseManipulation &x) noexcept
 
void unsetChild (BaseManipulation *child)
 
void unsetParent (BaseManipulation *parent)
 
void write (MimmoSharedPointer< MimmoObject > geometry)
 
template<typename mpv_t >
void write (MimmoSharedPointer< MimmoObject > geometry, MimmoPiercedVector< mpv_t > &data)
 
template<typename mpv_t , typename... Args>
void write (MimmoSharedPointer< MimmoObject > geometry, MimmoPiercedVector< mpv_t > &data, Args ... args)
 
template<typename mpv_t >
void write (MimmoSharedPointer< MimmoObject > geometry, std::vector< MimmoPiercedVector< mpv_t > * > &data)
 
template<typename mpv_t , typename... Args>
void write (MimmoSharedPointer< MimmoObject > geometry, std::vector< MimmoPiercedVector< mpv_t > * > &data, Args ... args)
 
template<typename mpv_t >
void write (MimmoSharedPointer< MimmoObject > geometry, std::vector< MimmoPiercedVector< mpv_t >> &data)
 
template<typename mpv_t , typename... Args>
void write (MimmoSharedPointer< MimmoObject > geometry, std::vector< MimmoPiercedVector< mpv_t >> &data, Args ... args)
 

Protected Attributes

dmatrix33E m_axes
 
std::unordered_map< MimmoSharedPointer< MimmoObject >, int > m_listgeo
 
darray3E m_origin
 
darray3E m_span
 
OBBStrategy m_strategy
 
bool m_writeInfo
 
- Protected Attributes inherited from mimmo::BaseManipulation
bool m_active
 
bool m_apply
 
bool m_arePortsBuilt
 
bmumap m_child
 
int m_counter
 
bool m_execPlot
 
MimmoSharedPointer< MimmoObjectm_geometry
 
bitpit::Logger * m_log
 
std::string m_name
 
std::string m_outputPlot
 
bmumap m_parent
 
std::unordered_map< PortID, PortIn * > m_portIn
 
std::unordered_map< PortID, PortOut * > m_portOut
 
ConnectionType m_portsType
 
uint m_priority
 

Additional Inherited Members

- Public Types inherited from mimmo::BaseManipulation
typedef std::unordered_map< BaseManipulation *, int > bmumap
 
typedef pin::ConnectionType ConnectionType
 
typedef std::string PortID
 
- Static Protected Attributes inherited from mimmo::BaseManipulation
static int sm_baseManipulationCounter
 

Detailed Description

Oriented Bounding Box calculator.

Builds the oriented bounding box of a 3D object. Formats allowed are surface meshes, point clouds or 3D curves, passed as MimmoObjects. No volume meshes are allowed.


Ports available in OBBox Class :


Port Input
PortType variable/function DataType
M_GEOM m_geometry (MC_SCALAR, MD_MIMMO_)
M_VECGEOM setGeometries (MC_VECTOR, MD_MIMMO_)
Port Output
PortType variable/function DataType
M_POINT getOrigin (MC_ARRAY3, MD_FLOAT)
M_AXES getAxes (MC_ARR3ARR3, MD_FLOAT)
M_SPAN getSpan (MC_ARRAY3, MD_FLOAT)


The xml available parameters, sections and subsections are the following :

Inherited from BaseManipulation:

  • ClassName: name of the class as mimmo.OBBox
  • Priority: uint marking priority in multi-chain execution;
  • PlotInExecution: boolean 0/1 print optional results of the class.
  • OutputPlot: target directory for optional results writing.

Proper of the class:

  • OBBStrategy: enum 0-get OBB, 1-get AABB, 2-get the min Volume solution between OBB and AABB
  • WriteInfo: boolean(0/1) if true write info of OBB on file, in plotOptionalResults directory, false do nothing.

Geometries have to be mandatorily added/passed through ports.

Examples
utils_example_00004.cpp.

Definition at line 90 of file OBBox.hpp.

Constructor & Destructor Documentation

◆ OBBox() [1/3]

mimmo::OBBox::OBBox ( )

Basic Constructor. Doing nothing.

Definition at line 31 of file OBBox.cpp.

◆ OBBox() [2/3]

mimmo::OBBox::OBBox ( const bitpit::Config::Section &  rootXML)

Custom constructor reading xml data

Parameters
[in]rootXMLreference to your xml tree section

Definition at line 49 of file OBBox.cpp.

◆ ~OBBox()

mimmo::OBBox::~OBBox ( )
virtual

Destructor

Definition at line 74 of file OBBox.cpp.

◆ OBBox() [3/3]

mimmo::OBBox::OBBox ( const OBBox other)

Copy Constructor

Parameters
[in]otherOBBox where copy from

Definition at line 79 of file OBBox.cpp.

Member Function Documentation

◆ absorbSectionXML()

void mimmo::OBBox::absorbSectionXML ( const bitpit::Config::Section &  slotXML,
std::string  name = "" 
)
virtual

It sets infos reading from a XML bitpit::Config::section.

Parameters
[in]slotXMLbitpit::Config::Section of XML file
[in]namename associated to the slot

Reimplemented from mimmo::BaseManipulation.

Definition at line 549 of file OBBox.cpp.

◆ buildPorts()

void mimmo::OBBox::buildPorts ( )
virtual

It builds the input/output ports of the object

Implements mimmo::BaseManipulation.

Definition at line 106 of file OBBox.cpp.

◆ clearOBBox()

void mimmo::OBBox::clearOBBox ( )

Clean all stuffs in your class

Definition at line 120 of file OBBox.cpp.

◆ computeAABB()

void mimmo::OBBox::computeAABB ( std::vector< MimmoSharedPointer< MimmoObject >> &  vector_listgeo,
darray3E origin,
darray3E span,
dmatrix33E axes 
)
protected

Compute the axis aligned bounding box

Parameters
[in]vector_listgeolist of target geometries
[out]originof the AABB
[out]spanof the AABB
[out]axesof the AABB, as fundamental ref frame

Definition at line 487 of file OBBox.cpp.

◆ computeOBB()

void mimmo::OBBox::computeOBB ( std::vector< MimmoSharedPointer< MimmoObject >> &  vector_listgeo,
darray3E origin,
darray3E span,
dmatrix33E axes 
)
protected

Compute the oriented bounding box

Parameters
[in]vector_listgeolist of target geometries
[out]originof the OBB
[out]spanof the OBB
[out]axesof the OBB, as fundamental ref frame

Definition at line 416 of file OBBox.cpp.

◆ execute()

void mimmo::OBBox::execute ( )
virtual

Execute your object, calculate the OBBox of your geometry. If forced externally, evaluate the AABB, no matter what. Implementation of pure virtual BaseManipulation::execute

Implements mimmo::BaseManipulation.

Definition at line 329 of file OBBox.cpp.

◆ flushSectionXML()

void mimmo::OBBox::flushSectionXML ( bitpit::Config::Section &  slotXML,
std::string  name = "" 
)
virtual

It sets infos from class members in a XML bitpit::Config::section.

Parameters
[in]slotXMLbitpit::Config::Section of XML file
[in]namename associated to the slot

Reimplemented from mimmo::BaseManipulation.

Definition at line 599 of file OBBox.cpp.

◆ getAxes()

dmatrix33E mimmo::OBBox::getAxes ( )

Return the oriented axes of the OBB.

Returns
Number of control nodes

Definition at line 159 of file OBBox.cpp.

◆ getGeometries()

std::vector< MimmoSharedPointer< MimmoObject > > mimmo::OBBox::getGeometries ( )
Returns
current list of linked geoemtry for obbox calculation

Definition at line 168 of file OBBox.cpp.

◆ getOBBStrategy()

OBBStrategy mimmo::OBBox::getOBBStrategy ( )
Returns
class strategy set to evaluate bounding box. See OBBStrategy enum

Definition at line 188 of file OBBox.cpp.

◆ getOrigin()

darray3E mimmo::OBBox::getOrigin ( )

Return the origin of the OBB.

Returns
Number of control nodes

Definition at line 140 of file OBBox.cpp.

◆ getSpan()

darray3E mimmo::OBBox::getSpan ( )

Return the span of the OBB.

Returns
Number of control nodes

Definition at line 149 of file OBBox.cpp.

◆ inverse()

dmatrix33E mimmo::OBBox::inverse ( const dmatrix33E mat)
protected

Invert a 3x3 double matrix

Parameters
[in]mattarget matrix
Returns
new matrix transposed

Definition at line 901 of file OBBox.cpp.

◆ isForcedAABB()

bool mimmo::OBBox::isForcedAABB ( )
Returns
true if the class is set to evaluate a standard Axis Aligned Bounding Box

Definition at line 180 of file OBBox.cpp.

◆ plot()

void mimmo::OBBox::plot ( std::string  directory,
std::string  filename,
int  counter,
bool  binary 
)

Plot the OBB as a structured grid to *vtu file.

Parameters
[in]directoryoutput directory
[in]filenameoutput filename w/out tag
[in]counterinteger identifier of the file
[in]binaryboolean flag for 0-"ascii" or 1-"appended" writing

Definition at line 273 of file OBBox.cpp.

◆ plotOptionalResults()

void mimmo::OBBox::plotOptionalResults ( )
protectedvirtual

Plot Optional results of the class, that is the oriented bounding box as *.vtu mesh

Reimplemented from mimmo::BaseManipulation.

Definition at line 537 of file OBBox.cpp.

◆ setForceAABB()

void mimmo::OBBox::setForceAABB ( bool  flag)

Force class to evaluate a standard Axis Aligned Bounding Box instead of the Oriented one.

Parameters
[in]flagtrue, force AABB evaluation, false evaluate OBB.

Definition at line 232 of file OBBox.cpp.

◆ setGeometries()

void mimmo::OBBox::setGeometries ( std::vector< MimmoSharedPointer< MimmoObject > >  listgeo)

Set the list of target geometries once and for all, and erase any pre-existent list. Not supported volumetric tessellations(type =2).

Parameters
[in]listgeolist of pointers to target geometries

Definition at line 199 of file OBBox.cpp.

◆ setGeometry()

void mimmo::OBBox::setGeometry ( MimmoSharedPointer< MimmoObject geo)
  • Add your target geometry to the list of target geometries. Not supported volumetric tessellations(type =2). Reimplemented from BaseManipulation::setGeometry().
    Parameters
    [in]geopointer to target geometry

Definition at line 212 of file OBBox.cpp.

◆ setOBBStrategy()

void mimmo::OBBox::setOBBStrategy ( OBBStrategy  strategy)

Set class strategy to get the bounding box.See OBBStrategy enum.

Parameters
[in]strategychosen from OBBStrategy enum.

Definition at line 242 of file OBBox.cpp.

◆ setOBBStrategyInt()

void mimmo::OBBox::setOBBStrategyInt ( int  strategyflag)

Set class strategy to get the bounding box.See OBBStrategy enum.

Parameters
[in]strategyflagint chosen from OBBStrategy enum.

Definition at line 251 of file OBBox.cpp.

◆ setWriteInfo()

void mimmo::OBBox::setWriteInfo ( bool  flag)

Force class to write OBB calculated origin, axes and span to file(in the plotOptionalResults directory)

Parameters
[in]flagtrue, write the OBB info on file.
Examples
utils_example_00004.cpp.

Definition at line 262 of file OBBox.cpp.

◆ swap()

void mimmo::OBBox::swap ( OBBox x)
protectednoexcept

Swap function

Parameters
[in]xobject to be swapped

Definition at line 92 of file OBBox.cpp.

◆ transpose()

dmatrix33E mimmo::OBBox::transpose ( const dmatrix33E mat)
protected

Transpose a 3x3 double matrix

Parameters
[in]mattarget matrix
Returns
new matrix transposed

Definition at line 885 of file OBBox.cpp.

Member Data Documentation

◆ m_axes

dmatrix33E mimmo::OBBox::m_axes
protected

reference system of the bbox, ordered aaccording maximum shape variance

Definition at line 95 of file OBBox.hpp.

◆ m_listgeo

std::unordered_map<MimmoSharedPointer<MimmoObject>, int> mimmo::OBBox::m_listgeo
protected

list of geometries linked in input, according to type

Definition at line 97 of file OBBox.hpp.

◆ m_origin

darray3E mimmo::OBBox::m_origin
protected

Origin of the OBB.

Definition at line 93 of file OBBox.hpp.

◆ m_span

darray3E mimmo::OBBox::m_span
protected

Span of the OBB.

Definition at line 94 of file OBBox.hpp.

◆ m_strategy

OBBStrategy mimmo::OBBox::m_strategy
protected

store stratefy chosen, see OBBStrategy enum

Definition at line 98 of file OBBox.hpp.

◆ m_writeInfo

bool mimmo::OBBox::m_writeInfo
protected

write OBB info on file

Definition at line 99 of file OBBox.hpp.


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