Go to the documentation of this file.
9 #ifndef opengl_CGeneralizedCylinder_H
10 #define opengl_CGeneralizedCylinder_H
39 void calculateNormal();
73 for (
int i=0;i<4;i++) points[i]=p[i];
91 mutable std::vector<TQuadrilateral>
mesh;
100 mutable std::vector<mrpt::math::TPolygonWithPlane>
polys;
121 static CGeneralizedCylinderPtr Create(
const std::vector<mrpt::math::TPoint3D> &axis,
const std::vector<mrpt::math::TPoint3D> &generatrix);
135 inline
void getAxis(std::vector<
mrpt::math::TPoint3D> &a)
const {
137 size_t N=axis.size();
139 for (
size_t i=0;i<N;i++) {
154 inline void setAxis(
const std::vector<mrpt::math::TPoint3D> &a) {
155 generatePoses(a,axis);
192 void getOrigin(CPolyhedronPtr &poly)
const;
197 void getEnd(CPolyhedronPtr &poly)
const;
202 void generateSetOfPolygons(std::vector<mrpt::math::TPolygon3D> &res)
const;
207 void getClosedSection(
size_t index1,
size_t index2,CPolyhedronPtr &poly)
const;
213 getClosedSection(index,index,poly);
219 return axis.size()?(axis.size()-1):0;
225 return fullyVisible?getNumberOfSections():(lastSection-firstSection);
233 last=getNumberOfSections();
251 firstSection=pointer;
261 if (first>last||last>getNumberOfSections())
throw std::logic_error(
"Wrong bound definition");
272 if (fullyVisible||firstSection==0)
throw std::logic_error(
"No more sections");
282 if (fullyVisible||lastSection==getNumberOfSections())
throw std::logic_error(
"No more sections");
291 void removeVisibleSectionAtStart();
297 void removeVisibleSectionAtEnd();
317 void updatePolys()
const;
330 void updateMesh()
const;
338 CGeneralizedCylinder():axis(),generatrix(),mesh(),meshUpToDate(false),polysUpToDate(false),closed(false),fullyVisible(true) {}
342 CGeneralizedCylinder(
const std::vector<mrpt::math::TPoint3D> &a,
const std::vector<mrpt::math::TPoint3D> &g):generatrix(g),mesh(),meshUpToDate(false),polysUpToDate(false),closed(false),fullyVisible(true) {
343 generatePoses(a,axis);
EIGEN_STRONG_INLINE iterator begin()
bool fullyVisible
Flag to determine whether the object is fully visible or only some sections are.
class OPENGL_IMPEXP CGeneralizedCylinder
bool meshUpToDate
Mutable flag which tells if recalculations are needed.
A renderizable object suitable for rendering with OpenGL's display lists.
void getAxis(mrpt::aligned_containers< mrpt::poses::CPose3D >::vector_t &a) const
Get axis, including angular coordinates.
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated)
EIGEN_STRONG_INLINE iterator end()
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
bool polysUpToDate
Mutable flag telling whether ray tracing temporary data must be recalculated or not.
void addVisibleSectionAtStart()
Adds another visible section at the start of the cylinder.
void setAxis(const std::vector< mrpt::math::TPoint3D > &a)
Set the axis points.
void getClosedSection(size_t index, CPolyhedronPtr &poly) const
Get a polyhedron consisting of a single section of the cylinder.
const typedef Scalar * const_iterator
size_t lastSection
Last visible section, if fullyVisible is set to false.
void setGeneratrix(const std::vector< mrpt::math::TPoint3D > &g)
Set cylinder's profile.
CGeneralizedCylinder(const std::vector< mrpt::math::TPoint3D > &a, const std::vector< mrpt::math::TPoint3D > &g)
Constructor with axis and generatrix.
void setClosed(bool c=true)
Set whether each section is a closed polygon or not.
virtual ~CGeneralizedCylinder()
Destructor.
void getAsPolygonUnsafe(mrpt::math::TPolygon3D &vec) const
Given a polygon with 4 already positions allocated, this method fills it with the quadrilateral point...
~TQuadrilateral()
Destructor.
bool closed
Boolean variable which determines if the profile is closed at each section.
Auxiliary struct holding any quadrilateral, represented by foour points.
TQuadrilateral(const T(&p)[4])
Construction from any array of four compatible objects.
void getGeneratrix(std::vector< mrpt::math::TPoint3D > &g) const
Get cylinder's profile.
std::vector< TQuadrilateral > mesh
Mutable object with mesh information, used to avoid repeated computations.
mrpt::aligned_containers< mrpt::poses::CPose3D >::vector_t axis
Cylinder's axis.
CGeneralizedCylinder()
Basic constructor with default initialization.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
This object represents any figure obtained by extruding any profile along a given axis.
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
void setAllSectionsInvisible(size_t pointer=0)
Hides all sections.
void getVisibleSections(size_t &first, size_t &last) const
Gets the cylinder's visible sections.
3D polygon, inheriting from std::vector<TPoint3D>
std::vector< mrpt::math::TPoint3D > generatrix
Object's generatrix, that is, profile which will be extruded.
void setVisibleSections(size_t first, size_t last)
Sets which sections are visible.
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
TQuadrilateral(const mrpt::math::TPoint3D &p1, const mrpt::math::TPoint3D &p2, const mrpt::math::TPoint3D &p3, const mrpt::math::TPoint3D &p4)
Constructor from 4 points.
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
size_t getVisibleSections() const
Get how many visible sections are in the cylinder.
void addVisibleSectionAtEnd()
Adds another visible section at the end of the cylinder.
mrpt::math::CMatrixTemplate< mrpt::math::TPoint3D > pointsMesh
Mutable object with the cylinder's points, used to avoid repeated computations.
std::vector< mrpt::math::TPolygonWithPlane > polys
Mutable set of data used in ray tracing.
TQuadrilateral()
Empty constructor.
bool BASE_IMPEXP traceRay(const vector< TPolygonWithPlane > &vec, const mrpt::poses::CPose3D &pose, double &dist)
Fast ray tracing method using polygons' properties.
size_t getNumberOfSections() const
Get the number of sections in this cylinder.
size_t firstSection
First visible section, if fullyVisible is set to false.
bool isClosed() const
Returns true if each section is a closed polygon.
std::vector< TYPE1, Eigen::aligned_allocator< TYPE1 > > vector_t
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
void setAllSectionsVisible()
Sets all sections visible.
Page generated by Doxygen 1.8.17 for MRPT 1.4.0 SVN: at Sat Jan 18 22:37:07 UTC 2020 | | |