28 #ifndef opengl_CGeneralizedCylinder_H
29 #define opengl_CGeneralizedCylinder_H
40 using namespace mrpt::math;
59 void calculateNormal();
93 for (
int i=0;i<4;i++) points[i]=p[i];
117 mutable std::vector<TQuadrilateral>
mesh;
130 mutable vector<TPolygonWithPlane>
polys;
164 void render_dl()
const;
173 inline void getAxis(std::vector<TPoint3D> &a)
const {
175 size_t N=axis.size();
177 for (
size_t i=0;i<N;i++) {
186 inline void getAxis(std::vector<CPose3D> &a)
const {
192 inline void setAxis(
const std::vector<TPoint3D> &a) {
193 generatePoses(a,axis);
240 void generateSetOfPolygons(std::vector<TPolygon3D> &res)
const;
245 void getClosedSection(
size_t index1,
size_t index2,
CPolyhedronPtr &poly)
const;
251 getClosedSection(index,index,poly);
257 return axis.size()?(axis.size()-1):0;
263 return fullyVisible?getNumberOfSections():(lastSection-firstSection);
271 last=getNumberOfSections();
289 firstSection=pointer;
299 if (first>last||last>getNumberOfSections())
throw std::logic_error(
"Wrong bound definition");
310 if (fullyVisible||firstSection==0)
throw std::logic_error(
"No more sections");
320 if (fullyVisible||lastSection==getNumberOfSections())
throw std::logic_error(
"No more sections");
329 void removeVisibleSectionAtStart();
335 void removeVisibleSectionAtEnd();
355 void updatePolys()
const;
360 void generatePoses(
const std::vector<TPoint3D> &pIn,std::vector<CPose3D> &pOut);
364 void updateMesh()
const;
372 CGeneralizedCylinder():axis(),generatrix(),mesh(),meshUpToDate(false),polysUpToDate(false),closed(false),fullyVisible(true) {}
376 CGeneralizedCylinder(
const std::vector<TPoint3D> &a,
const std::vector<TPoint3D> &g):generatrix(g),mesh(),meshUpToDate(false),polysUpToDate(false),closed(false),fullyVisible(true) {
377 generatePoses(a,axis);