openmbvcppinterface  3.1.0
OpenMBV C++ Interface
OpenMBV::SpineExtrusion Class Reference

Class for all bodies extruded along a curve. More...

#include <spineextrusion.h>

Inheritance diagram for OpenMBV::SpineExtrusion:
[legend]

Public Types

enum  CrossSectionOrienation { orthogonalWithTwist , cardanWrtWorld , cardanWrtWorldShader }
 
- Public Types inherited from OpenMBV::Body
enum  DrawStyle { filled , lines , points }
 

Public Member Functions

void setNumberOfSpinePoints (const int num)
 
int getNumberOfSpinePoints ()
 
void setContour (const std::shared_ptr< std::vector< std::shared_ptr< PolygonPoint > > > &contour_)
 
std::shared_ptr< std::vector< std::shared_ptr< PolygonPoint > > > getContour ()
 
void setScaleFactor (const double scale)
 
double getScaleFactor ()
 
void setInitialRotation (const std::vector< double > &initRot)
 
void setInitialRotation (double a, double b, double g)
 
void setStateOffSet (const std::vector< double > &stateOff)
 
std::vector< double > getStateOffSet ()
 
void setCrossSectionOrientation (CrossSectionOrienation o)
 
CrossSectionOrienation getCrossSectionOrientation ()
 
void setCounterClockWise (bool f)
 
bool getCounterClockWise ()
 
void setUpdateNormals (bool f)
 
bool getUpdateNormals ()
 
std::vector< double > getInitialRotation ()
 
template<typename T >
void append (const T &row)
 
int getRows () override
 
std::vector< Float > getRow (int i) override
 
void initializeUsingXML (xercesc::DOMElement *element) override
 
xercesc::DOMElement * writeXMLFile (xercesc::DOMNode *parent) override
 
- Public Member Functions inherited from OpenMBV::DynamicColoredBody
void setMinimalColorValue (double min)
 
double getMinimalColorValue ()
 
void setMaximalColorValue (double max)
 
double getMaximalColorValue ()
 
void setDynamicColor (const double col)
 
double getDynamicColor ()
 
void setDiffuseColor (const std::vector< double > &hsv)
 
void setDiffuseColor (double h, double s, double v)
 
std::vector< double > getDiffuseColor ()
 
void setTransparency (double t)
 
double getTransparency ()
 
void initializeUsingXML (xercesc::DOMElement *element) override
 
xercesc::DOMElement * writeXMLFile (xercesc::DOMNode *parent) override
 
- Public Member Functions inherited from OpenMBV::Body
void setOutLine (bool ol)
 
bool getOutLine ()
 
void setShilouetteEdge (bool ol)
 
bool getShilouetteEdge ()
 
void setDrawMethod (DrawStyle ds)
 
DrawStyle getDrawMethod ()
 
void setPointSize (double ps)
 
double getPointSize ()
 
void setLineWidth (double lw)
 
double getLineWidth ()
 
void initializeUsingXML (xercesc::DOMElement *element) override
 
xercesc::DOMElement * writeXMLFile (xercesc::DOMNode *parent) override
 
virtual int getRows ()=0
 
virtual std::vector< Float > getRow (int i)=0
 
- Public Member Functions inherited from OpenMBV::Object
void setEnable (bool enable)
 
bool getEnable ()
 
void setBoundingBox (bool bbox)
 
bool getBoundingBox ()
 
void setName (const std::string &name_)
 
std::string getName ()
 
virtual std::string getFullName ()
 
void setEnvironment (bool env)
 
bool getEnvironment ()
 
virtual void initializeUsingXML (xercesc::DOMElement *element)
 
virtual xercesc::DOMElement * writeXMLFile (xercesc::DOMNode *parent)
 
std::shared_ptr< GroupgetTopLevelGroup ()
 
std::weak_ptr< GroupgetParent ()
 
H5::GroupBasegetHDF5Group ()
 
std::string getID () const
 
void setID (std::string ID_)
 

Protected Member Functions

void createHDF5File () override
 
void openHDF5File () override
 
void createHDF5File () override
 
void openHDF5File () override
 
virtual void createHDF5File ()=0
 
virtual void openHDF5File ()=0
 

Protected Attributes

int numberOfSpinePoints {0}
 
std::shared_ptr< std::vector< std::shared_ptr< PolygonPoint > > > contour
 
H5::VectorSerie< Float > * data {nullptr}
 
double scaleFactor {1}
 
CrossSectionOrienation csOri { orthogonalWithTwist }
 
bool ccw { true }
 
bool updateNormals { true }
 
std::vector< double > initialRotation
 
std::vector< double > stateOffSet
 
- Protected Attributes inherited from OpenMBV::DynamicColoredBody
double minimalColorValue {0}
 
double maximalColorValue {1}
 
double dynamicColor
 
std::vector< double > diffuseColor
 
double transparency {0}
 
- Protected Attributes inherited from OpenMBV::Body
std::string outLineStr
 
std::string shilouetteEdgeStr
 
DrawStyle drawMethod {filled}
 
double pointSize {0}
 
double lineWidth {0}
 
- Protected Attributes inherited from OpenMBV::Object
std::string name
 
std::string enableStr
 
std::string boundingBoxStr
 
std::string ID
 
std::string environmentStr
 
std::weak_ptr< Groupparent
 
H5::GroupBasehdf5Group {nullptr}
 
std::string fullName
 

Friends

class ObjectFactory
 

Detailed Description

Class for all bodies extruded along a curve.

Author
Thorsten Schindler

HDF5-Dataset: The HDF5 dataset of this object is a 2D array of single or double precision values. Each row represents one dataset in time.

The cross section is either orthogonal to the curve with a twist around the curve OR freely rotated with respect to the world system. The cross section is defined in the x-z-plane

If the cross section is orthogonal to the curve then a row consists of the following columns in order given in world frame (N is the number of spine points): time, spine point 1 x, spine point 1 y, spine point 1 z, spine twist 1, spine point 2 x, spine point 2 y, spine point 2 z, spine twist 2, ..., spine point N x, spine point N y, spine point N z, spine twist N

If the cross section is freely rotated a row consists of the following columns in order given in world frame (N is the number of spine points): time, spine point 1 x, spine point 1 y, spine point 1 z, cross section alpha 1, cross section beta 1, cross section gamma 1, spine point 2 x, spine point 2 y, spine point 2 z, cross section alpha 2, cross section beta 2, cross section gamma 2, ..., spine point N x, spine point N y, spine point N z, cross section alpha N, cross section beta N, cross section gamma N where alpha, beta and gamma are cardan angles.

cardanWrtWorld draws the spine-extrusion with pure-basic Coin functionality. Hence, all Coin features like object picking and boundary box calculation is available. However, for very large number of cross-section points and spine points the rendering can be slow since Coin needs to update and recalculate all vertices and normals at each frame (on the CPU). cardanWrtWorldShader draws the spine-extrusion by passing the data from the HDF5 file just to vertex and fragment OpenGL shaders. The complete recalculation of the vertices and normals is then done by the shader (on the GPU). Hence, some Coin features like object picking and boundary box calculation are not available for this type. However, for very large number of cross-section points and spine points the rendering will be much faster.

Member Function Documentation

◆ append()

template<typename T >
void OpenMBV::SpineExtrusion::append ( const T &  row)
inline

Append a data vector to the h5 datsset

◆ createHDF5File()

void OpenMBV::SpineExtrusion::createHDF5File ( )
overrideprotectedvirtual

Write H5 file for time-dependent data.

Reimplemented from OpenMBV::Body.

◆ getInitialRotation()

std::vector< double > OpenMBV::SpineExtrusion::getInitialRotation ( )
inline

Get the initial rotation of the body.

◆ getNumberOfSpinePoints()

int OpenMBV::SpineExtrusion::getNumberOfSpinePoints ( )
inline

Get the number of spine points used for extrusion along a path.

◆ getRow()

std::vector< Float > OpenMBV::SpineExtrusion::getRow ( int  i)
inlineoverridevirtual

Get row number i of the default data. NOTE: see also append()

Implements OpenMBV::Body.

◆ getRows()

int OpenMBV::SpineExtrusion::getRows ( )
inlineoverridevirtual

Get the number of rows of the default data. Returns 0, if no default data is avaliable. NOTE: see also append()

Implements OpenMBV::Body.

◆ initializeUsingXML()

void OpenMBV::SpineExtrusion::initializeUsingXML ( xercesc::DOMElement *  element)
overridevirtual

Initializes the time invariant part of the object using a XML node

Reimplemented from OpenMBV::DynamicColoredBody.

◆ openHDF5File()

void OpenMBV::SpineExtrusion::openHDF5File ( )
overrideprotectedvirtual

Reimplemented from OpenMBV::Body.

◆ setContour()

void OpenMBV::SpineExtrusion::setContour ( const std::shared_ptr< std::vector< std::shared_ptr< PolygonPoint > > > &  contour_)
inline

Set the 2D contour (cross-section) of the extrusion. The contour (polygon) points must be in clockwise order.

◆ setInitialRotation()

void OpenMBV::SpineExtrusion::setInitialRotation ( const std::vector< double > &  initRot)
inline

Set the initial rotation of the body. This is only used if 'crossSectionOrientation' is set to 'orthogonalWithTwist' and the initial spine is fully colinear.

◆ setNumberOfSpinePoints()

void OpenMBV::SpineExtrusion::setNumberOfSpinePoints ( const int  num)
inline

Set the number of spine points used for extrusion along a path.

◆ setScaleFactor()

void OpenMBV::SpineExtrusion::setScaleFactor ( const double  scale)
inline

Set the scale factor of the body.

◆ setUpdateNormals()

void OpenMBV::SpineExtrusion::setUpdateNormals ( bool  f)
inline

If true, the default, the normal vectors (and, of course the points) are update at each frame. If false, the normal vectors are only updated at the very first call but ever again. This option is only relevant for crossSectionOrientation=cardanWrtWorld and false leads to faster rendering.

◆ writeXMLFile()

DOMElement * OpenMBV::SpineExtrusion::writeXMLFile ( xercesc::DOMNode *  parent)
overridevirtual

Write XML file for not time-dependent data.

Reimplemented from OpenMBV::DynamicColoredBody.

Member Data Documentation

◆ contour

std::shared_ptr<std::vector<std::shared_ptr<PolygonPoint> > > OpenMBV::SpineExtrusion::contour
protected

Vector of local x-y points.

◆ data

H5::VectorSerie<Float>* OpenMBV::SpineExtrusion::data {nullptr}
protected

Each row comprises [time,spine world position,spine twist,...,spine world position,spine twist].

◆ initialRotation

std::vector<double> OpenMBV::SpineExtrusion::initialRotation
protected

Intial rotation of the body.

◆ numberOfSpinePoints

int OpenMBV::SpineExtrusion::numberOfSpinePoints {0}
protected

Number of spine points used for extrusion along a path.

◆ scaleFactor

double OpenMBV::SpineExtrusion::scaleFactor {1}
protected

Scale factor of the body.

◆ stateOffSet

std::vector<double> OpenMBV::SpineExtrusion::stateOffSet
protected

optional offset for spine vector, may be used as inital position superposed by deflections or as static


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