Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
PointCloudObject.h
Go to the documentation of this file.
00001 /********************************************************************
00002 **                Image Component Library (ICL)                    **
00003 **                                                                 **
00004 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld          **
00005 **                         Neuroinformatics Group                  **
00006 ** Website: www.iclcv.org and                                      **
00007 **          http://opensource.cit-ec.de/projects/icl               **
00008 **                                                                 **
00009 ** File   : ICLGeom/src/ICLGeom/PointCloudObject.h                 **
00010 ** Module : ICLGeom                                                **
00011 ** Authors: Christof Elbrechter, Patrick Nobou                     **
00012 **                                                                 **
00013 **                                                                 **
00014 ** GNU LESSER GENERAL PUBLIC LICENSE                               **
00015 ** This file may be used under the terms of the GNU Lesser General **
00016 ** Public License version 3.0 as published by the                  **
00017 **                                                                 **
00018 ** Free Software Foundation and appearing in the file LICENSE.LGPL **
00019 ** included in the packaging of this file.  Please review the      **
00020 ** following information to ensure the license requirements will   **
00021 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt                **
00022 **                                                                 **
00023 ** The development of this software was supported by the           **
00024 ** Excellence Cluster EXC 277 Cognitive Interaction Technology.    **
00025 ** The Excellence Cluster EXC 277 is a grant of the Deutsche       **
00026 ** Forschungsgemeinschaft (DFG) in the context of the German       **
00027 ** Excellence Initiative.                                          **
00028 **                                                                 **
00029 ********************************************************************/
00030 
00031 #pragma once
00032 
00033 #include <ICLUtils/CompatMacros.h>
00034 #include <ICLGeom/PointCloudObjectBase.h>
00035 
00036 namespace icl{
00037   namespace geom{
00038     
00040 
00052     class ICLGeom_API PointCloudObject : public PointCloudObjectBase{
00053       protected:
00054       bool m_organized;          
00055       utils::Size m_dim2D;       
00056       bool m_hasNormals;         
00057       bool m_hasColors;          
00058       bool m_hasLabels;          
00059       std::vector<int> m_labels; 
00060       public:
00061       
00062       
00064       PointCloudObject(bool withNormals=false, bool withColors=false, bool withLabels=false);
00065       
00067       PointCloudObject(int numPoints, bool withNormals=false, bool withColors=true, bool withLabels=false);
00068       
00070 
00075       PointCloudObject(int width, int height, bool organized=true, bool withNormals=false, 
00076                        bool withColors=true, bool withLabels=false);
00077   
00079       virtual bool supports(FeatureType t) const;
00080       
00082       virtual bool isOrganized() const;
00083 
00085       virtual utils::Size getSize() const throw (utils::ICLException);
00086       
00088       virtual int getDim() const;
00089   
00091 
00092       virtual void setSize(const utils::Size &size);
00093   
00095       virtual core::DataSegment<float,3> selectXYZ();
00096 
00098       virtual core::DataSegment<float,4> selectXYZH();
00099       
00101       virtual core::DataSegment<float,4> selectRGBA32f();
00102 
00104 
00105       virtual core::DataSegment<float,4> selectNormal();
00106 
00108 
00109       virtual core::DataSegment<icl32s,1> selectLabel();
00110       
00112       virtual void customRender();
00113 
00115       virtual bool canAddFeature(FeatureType t) const;
00116       
00118 
00120       virtual void addFeature(FeatureType t) throw (utils::ICLException);
00121   
00123       virtual PointCloudObject *copy() const {
00124         return new PointCloudObject(*this);
00125       }
00126 
00128 
00131       void push_back(const Vec &point){
00132         addVertex(point,GeomColor(0,100,255,255));
00133         if(m_hasNormals) m_normals.push_back(Vec(0,0,0,1));
00134       }
00135       
00137 
00138       void push_back(const Vec &point, const GeomColor &color){
00139         addVertex(point,color);
00140         if(m_hasNormals) m_normals.push_back(Vec(0,0,0,1));
00141       }
00142 
00144 
00145       void push_back(const Vec &point, const Vec &normal, const GeomColor &color){
00146         addVertex(point,color);
00147         if(m_hasNormals) m_normals.push_back(normal);
00148       }
00149       
00150       private:
00151       
00153       using SceneObject::addVertex;
00154       using SceneObject::addNormal;
00155   
00156     };
00157   
00158     
00159     
00160   } // namespace geom
00161 }
00162 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines