Main MRPT website > C++ reference
MRPT logo
Classes | Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions
mrpt::opengl::CGeneralizedCylinder Class Reference

Detailed Description

This object represents any figure obtained by extruding any profile along a given axis.

The profile should lie over a x=0 plane, and the axis must be roughly perpendicular to this plane. In particular, it should be almost perpendicular to the Z axis.

#include <mrpt/opengl/CGeneralizedCylinder.h>

Inheritance diagram for mrpt::opengl::CGeneralizedCylinder:
Inheritance graph
[legend]

List of all members.

Classes

struct  TQuadrilateral
 Auxiliary struct holding any quadrilateral, represented by foour points. More...

Public Member Functions

void render_dl () const
 Render.
virtual bool traceRay (const mrpt::poses::CPose3D &o, double &dist) const
 Ray tracing.
void getAxis (std::vector< TPoint3D > &a) const
 Get axis's spatial coordinates.
void getAxis (std::vector< CPose3D > &a) const
 Get axis, including angular coordinates.
void setAxis (const std::vector< TPoint3D > &a)
 Set the axis points.
void getGeneratrix (std::vector< TPoint3D > &g) const
 Get cylinder's profile.
void setGeneratrix (const std::vector< TPoint3D > g)
 Set cylinder's profile.
bool isClosed () const
 Returns true if each section is a closed polygon.
void setClosed (bool c=true)
 Set whether each section is a closed polygon or not.
void getOrigin (CPolyhedronPtr &poly) const
 Get a polyhedron containing the starting point of the cylinder (its "base").
void getEnd (CPolyhedronPtr &poly) const
 Get a polyhedron containing the ending point of the cylinder (its "base").
void generateSetOfPolygons (std::vector< TPolygon3D > &res) const
 Get the cylinder as a set of polygons in 3D.
void getClosedSection (size_t index1, size_t index2, CPolyhedronPtr &poly) const
 Get a polyhedron consisting of a set of closed sections of the cylinder.
void getClosedSection (size_t index, CPolyhedronPtr &poly) const
 Get a polyhedron consisting of a single section of the cylinder.
size_t getNumberOfSections () const
 Get the number of sections in this cylinder.
size_t getVisibleSections () const
 Get how many visible sections are in the cylinder.
void getVisibleSections (size_t &first, size_t &last) const
 Gets the cylinder's visible sections.
void setAllSectionsVisible ()
 Sets all sections visible.
void setAllSectionsInvisible (size_t pointer=0)
 Hides all sections.
void setVisibleSections (size_t first, size_t last)
 Sets which sections are visible.
void addVisibleSectionAtStart ()
 Adds another visible section at the start of the cylinder.
void addVisibleSectionAtEnd ()
 Adds another visible section at the end of the cylinder.
void removeVisibleSectionAtStart ()
 Removes a visible section from the start of the currently visible set.
void removeVisibleSectionAtEnd ()
 Removes a visible section from the ending of the currently visible set.
bool getFirstSectionPose (mrpt::poses::CPose3D &p)
 Gets the axis pose of the first section, returning false if there is no such pose.
bool getLastSectionPose (mrpt::poses::CPose3D &p)
 Gets the axis pose of the last section, returning false if there is no such pose.
bool getFirstVisibleSectionPose (mrpt::poses::CPose3D &p)
 Gets the axis pose of the first visible section, returning false if there is no such pose.
bool getLastVisibleSectionPose (mrpt::poses::CPose3D &p)
 Gets the axis pose of the last section, returning false if there is no such pose.
void updatePolys () const
 Updates the mutable set of polygons used in ray tracing.

Static Public Member Functions

static CGeneralizedCylinderPtr Create (const std::vector< TPoint3D > &axis, const std::vector< TPoint3D > &generatrix)
 Creation of generalized cylinder from axis and generatrix.

Protected Attributes

vector< CPose3D > axis
 Cylinder's axis.
vector< TPoint3D > generatrix
 Object's generatrix, that is, profile which will be extruded.
std::vector< TQuadrilateral > mesh
 Mutable object with mesh information, used to avoid repeated computations.
CMatrixTemplate< TPoint3D > pointsMesh
 Mutable object with the cylinder's points, used to avoid repeated computations.
bool meshUpToDate
 Mutable flag which tells if recalculations are needed.
vector< TPolygonWithPlane > polys
 Mutable set of data used in ray tracing.
bool polysUpToDate
 Mutable flag telling whether ray tracing temporary data must be recalculated or not.
bool closed
 Boolean variable which determines if the profile is closed at each section.
bool fullyVisible
 Flag to determine whether the object is fully visible or only some sections are.
size_t firstSection
 First visible section, if fullyVisible is set to false.
size_t lastSection
 Last visible section, if fullyVisible is set to false.

Private Member Functions

void generatePoses (const std::vector< TPoint3D > &pIn, std::vector< CPose3D > &pOut)
 Updates the axis, transforming each point into a pose pointing to the next section.
void updateMesh () const
 Updates the mutable mesh.
void getMeshIterators (const vector< TQuadrilateral > &m, vector< TQuadrilateral >::const_iterator &begin, vector< TQuadrilateral >::const_iterator &end) const
 Given a vector of polyhedrons, gets the starting and ending iterators to the section to be actually rendered.
 CGeneralizedCylinder ()
 Basic constructor with default initialization.
 CGeneralizedCylinder (const std::vector< TPoint3D > &a, const std::vector< TPoint3D > &g)
 Constructor with axis and generatrix.
virtual ~CGeneralizedCylinder ()
 Destructor.

RTTI stuff

typedef CGeneralizedCylinderPtr SmartPtr
static mrpt::utils::CLASSINIT _init_CGeneralizedCylinder
static mrpt::utils::TRuntimeClassId classCGeneralizedCylinder
static const
mrpt::utils::TRuntimeClassId * 
classinfo
static const
mrpt::utils::TRuntimeClassId * 
_GetBaseClass ()
virtual const
mrpt::utils::TRuntimeClassId * 
GetRuntimeClass () const
 Returns information about the class of an object in runtime.
virtual mrpt::utils::CObject * duplicate () const
 Returns a copy of the object, indepently of its class.
static mrpt::utils::CObject * CreateObject ()
static CGeneralizedCylinderPtr Create ()

Member Typedef Documentation

A typedef for the associated smart pointer

Definition at line 49 of file CGeneralizedCylinder.h.


Constructor & Destructor Documentation

mrpt::opengl::CGeneralizedCylinder::CGeneralizedCylinder ( ) [inline, private]

Basic constructor with default initialization.

Definition at line 372 of file CGeneralizedCylinder.h.

mrpt::opengl::CGeneralizedCylinder::CGeneralizedCylinder ( const std::vector< TPoint3D > &  a,
const std::vector< TPoint3D > &  g 
) [inline, private]

Constructor with axis and generatrix.

Definition at line 376 of file CGeneralizedCylinder.h.

virtual mrpt::opengl::CGeneralizedCylinder::~CGeneralizedCylinder ( ) [inline, private, virtual]

Destructor.

Definition at line 382 of file CGeneralizedCylinder.h.


Member Function Documentation

static const mrpt::utils::TRuntimeClassId* mrpt::opengl::CGeneralizedCylinder::_GetBaseClass ( ) [static, protected]
void mrpt::opengl::CGeneralizedCylinder::addVisibleSectionAtEnd ( ) [inline]

Adds another visible section at the end of the cylinder.

The cylinder must have an invisible section to display.

Exceptions:
std::logic_errorif there is no section to add to the displaying set.
See also:
addVisibleSectionAtStart,removeVisibleSectionAtStart,removeVisibleSectionAtEnd

Definition at line 319 of file CGeneralizedCylinder.h.

References mrpt::opengl::CRenderizableDisplayList::notifyChange().

void mrpt::opengl::CGeneralizedCylinder::addVisibleSectionAtStart ( ) [inline]

Adds another visible section at the start of the cylinder.

The cylinder must have an invisble section to display.

Exceptions:
std::logic_errorif there is no section to add to the displaying set.
See also:
addVisibleSectionAtEnd,removeVisibleSectionAtStart,removeVisibleSectionAtEnd

Definition at line 309 of file CGeneralizedCylinder.h.

References mrpt::opengl::CRenderizableDisplayList::notifyChange().

static CGeneralizedCylinderPtr mrpt::opengl::CGeneralizedCylinder::Create ( ) [static]
static CGeneralizedCylinderPtr mrpt::opengl::CGeneralizedCylinder::Create ( const std::vector< TPoint3D > &  axis,
const std::vector< TPoint3D > &  generatrix 
) [inline, static]

Creation of generalized cylinder from axis and generatrix.

Definition at line 157 of file CGeneralizedCylinder.h.

References mrpt::opengl::CGeneralizedCylinder.

static mrpt::utils::CObject* mrpt::opengl::CGeneralizedCylinder::CreateObject ( ) [static]
virtual mrpt::utils::CObject* mrpt::opengl::CGeneralizedCylinder::duplicate ( ) const [virtual]

Returns a copy of the object, indepently of its class.

Implements mrpt::utils::CObject.

void mrpt::opengl::CGeneralizedCylinder::generatePoses ( const std::vector< TPoint3D > &  pIn,
std::vector< CPose3D > &  pOut 
) [private]

Updates the axis, transforming each point into a pose pointing to the next section.

void mrpt::opengl::CGeneralizedCylinder::generateSetOfPolygons ( std::vector< TPolygon3D > &  res) const

Get the cylinder as a set of polygons in 3D.

See also:
mrpt::math::TPolygon3D
void mrpt::opengl::CGeneralizedCylinder::getAxis ( std::vector< TPoint3D > &  a) const [inline]

Get axis's spatial coordinates.

Definition at line 173 of file CGeneralizedCylinder.h.

void mrpt::opengl::CGeneralizedCylinder::getAxis ( std::vector< CPose3D > &  a) const [inline]

Get axis, including angular coordinates.

Definition at line 186 of file CGeneralizedCylinder.h.

void mrpt::opengl::CGeneralizedCylinder::getClosedSection ( size_t  index1,
size_t  index2,
CPolyhedronPtr &  poly 
) const

Get a polyhedron consisting of a set of closed sections of the cylinder.

See also:
mrpt::opengl::CPolyhedron
void mrpt::opengl::CGeneralizedCylinder::getClosedSection ( size_t  index,
CPolyhedronPtr &  poly 
) const [inline]

Get a polyhedron consisting of a single section of the cylinder.

See also:
mrpt::opengl::CPolyhedron

Definition at line 250 of file CGeneralizedCylinder.h.

void mrpt::opengl::CGeneralizedCylinder::getEnd ( CPolyhedronPtr &  poly) const

Get a polyhedron containing the ending point of the cylinder (its "base").

See also:
getOrigin,mrpt::opengl::CPolyhedron
bool mrpt::opengl::CGeneralizedCylinder::getFirstSectionPose ( mrpt::poses::CPose3D &  p)

Gets the axis pose of the first section, returning false if there is no such pose.

bool mrpt::opengl::CGeneralizedCylinder::getFirstVisibleSectionPose ( mrpt::poses::CPose3D &  p)

Gets the axis pose of the first visible section, returning false if there is no such pose.

void mrpt::opengl::CGeneralizedCylinder::getGeneratrix ( std::vector< TPoint3D > &  g) const [inline]

Get cylinder's profile.

Definition at line 201 of file CGeneralizedCylinder.h.

bool mrpt::opengl::CGeneralizedCylinder::getLastSectionPose ( mrpt::poses::CPose3D &  p)

Gets the axis pose of the last section, returning false if there is no such pose.

bool mrpt::opengl::CGeneralizedCylinder::getLastVisibleSectionPose ( mrpt::poses::CPose3D &  p)

Gets the axis pose of the last section, returning false if there is no such pose.

void mrpt::opengl::CGeneralizedCylinder::getMeshIterators ( const vector< TQuadrilateral > &  m,
vector< TQuadrilateral >::const_iterator &  begin,
vector< TQuadrilateral >::const_iterator &  end 
) const [private]

Given a vector of polyhedrons, gets the starting and ending iterators to the section to be actually rendered.

size_t mrpt::opengl::CGeneralizedCylinder::getNumberOfSections ( ) const [inline]

Get the number of sections in this cylinder.

Definition at line 256 of file CGeneralizedCylinder.h.

void mrpt::opengl::CGeneralizedCylinder::getOrigin ( CPolyhedronPtr &  poly) const

Get a polyhedron containing the starting point of the cylinder (its "base").

See also:
getEnd,mrpt::opengl::CPolyhedron
virtual const mrpt::utils::TRuntimeClassId* mrpt::opengl::CGeneralizedCylinder::GetRuntimeClass ( ) const [virtual]

Returns information about the class of an object in runtime.

Reimplemented from mrpt::opengl::CRenderizableDisplayList.

size_t mrpt::opengl::CGeneralizedCylinder::getVisibleSections ( ) const [inline]

Get how many visible sections are in the cylinder.

Definition at line 262 of file CGeneralizedCylinder.h.

void mrpt::opengl::CGeneralizedCylinder::getVisibleSections ( size_t &  first,
size_t &  last 
) const [inline]

Gets the cylinder's visible sections.

Definition at line 268 of file CGeneralizedCylinder.h.

bool mrpt::opengl::CGeneralizedCylinder::isClosed ( ) const [inline]

Returns true if each section is a closed polygon.

Definition at line 215 of file CGeneralizedCylinder.h.

void mrpt::opengl::CGeneralizedCylinder::removeVisibleSectionAtEnd ( )

Removes a visible section from the ending of the currently visible set.

Exceptions:
std::logic_errorwhen there is no such section.
See also:
addVisibleSectionAtStart,addVisibleSectionAtEnd,removeVisibleSectionAtStart
void mrpt::opengl::CGeneralizedCylinder::removeVisibleSectionAtStart ( )

Removes a visible section from the start of the currently visible set.

Exceptions:
std::logic_errorif there are no visible sections.
See also:
addVisibleSectionAtStart,addVisibleSectionAtEnd,removeVisibleSectionAtEnd
void mrpt::opengl::CGeneralizedCylinder::render_dl ( ) const [virtual]
void mrpt::opengl::CGeneralizedCylinder::setAllSectionsInvisible ( size_t  pointer = 0) [inline]

Hides all sections.

Definition at line 287 of file CGeneralizedCylinder.h.

References mrpt::opengl::CRenderizableDisplayList::notifyChange().

void mrpt::opengl::CGeneralizedCylinder::setAllSectionsVisible ( ) [inline]

Sets all sections visible.

Definition at line 280 of file CGeneralizedCylinder.h.

References mrpt::opengl::CRenderizableDisplayList::notifyChange().

void mrpt::opengl::CGeneralizedCylinder::setAxis ( const std::vector< TPoint3D > &  a) [inline]

Set the axis points.

Definition at line 192 of file CGeneralizedCylinder.h.

References mrpt::opengl::CRenderizableDisplayList::notifyChange().

void mrpt::opengl::CGeneralizedCylinder::setClosed ( bool  c = true) [inline]

Set whether each section is a closed polygon or not.

Definition at line 221 of file CGeneralizedCylinder.h.

References mrpt::opengl::CRenderizableDisplayList::notifyChange().

void mrpt::opengl::CGeneralizedCylinder::setGeneratrix ( const std::vector< TPoint3D >  g) [inline]

Set cylinder's profile.

Definition at line 207 of file CGeneralizedCylinder.h.

References mrpt::opengl::CRenderizableDisplayList::notifyChange().

void mrpt::opengl::CGeneralizedCylinder::setVisibleSections ( size_t  first,
size_t  last 
) [inline]

Sets which sections are visible.

Exceptions:
std::logic_erroron wrongly defined bounds.

Definition at line 297 of file CGeneralizedCylinder.h.

References mrpt::opengl::CRenderizableDisplayList::notifyChange().

virtual bool mrpt::opengl::CGeneralizedCylinder::traceRay ( const mrpt::poses::CPose3D &  o,
double &  dist 
) const [virtual]

Ray tracing.

See also:
mrpt::opengl::CRenderizable.

Reimplemented from mrpt::opengl::CRenderizable.

void mrpt::opengl::CGeneralizedCylinder::updateMesh ( ) const [private]

Updates the mutable mesh.

void mrpt::opengl::CGeneralizedCylinder::updatePolys ( ) const

Updates the mutable set of polygons used in ray tracing.


Member Data Documentation

Definition at line 49 of file CGeneralizedCylinder.h.

Cylinder's axis.

It's represented as a pose because it holds the angle to get to the next pose.

Definition at line 109 of file CGeneralizedCylinder.h.

Definition at line 49 of file CGeneralizedCylinder.h.

Definition at line 49 of file CGeneralizedCylinder.h.

Boolean variable which determines if the profile is closed at each section.

Definition at line 138 of file CGeneralizedCylinder.h.

First visible section, if fullyVisible is set to false.

See also:
fullyVisible,lastSection

Definition at line 147 of file CGeneralizedCylinder.h.

Flag to determine whether the object is fully visible or only some sections are.

Definition at line 142 of file CGeneralizedCylinder.h.

Object's generatrix, that is, profile which will be extruded.

Definition at line 113 of file CGeneralizedCylinder.h.

Last visible section, if fullyVisible is set to false.

See also:
fullyVisible,firstSection

Definition at line 152 of file CGeneralizedCylinder.h.

Mutable object with mesh information, used to avoid repeated computations.

Definition at line 117 of file CGeneralizedCylinder.h.

Mutable flag which tells if recalculations are needed.

Definition at line 125 of file CGeneralizedCylinder.h.

Mutable object with the cylinder's points, used to avoid repeated computations.

Definition at line 121 of file CGeneralizedCylinder.h.

Mutable set of data used in ray tracing.

See also:
mrpt::math::TPolygonWithPlane

Definition at line 130 of file CGeneralizedCylinder.h.

Mutable flag telling whether ray tracing temporary data must be recalculated or not.

Definition at line 134 of file CGeneralizedCylinder.h.




Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Sun Oct 16 12:16:33 UTC 2011