LTI-Lib latest version v1.9 - last update 10 Apr 2010

ltiConvexHull.h

00001 /*
00002  * Copyright (C) 2002, 2003, 2004, 2005, 2006
00003  * Lehrstuhl fuer Technische Informatik, RWTH-Aachen, Germany
00004  *
00005  * This file is part of the LTI-Computer Vision Library (LTI-Lib)
00006  *
00007  * The LTI-Lib is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public License (LGPL)
00009  * as published by the Free Software Foundation; either version 2.1 of
00010  * the License, or (at your option) any later version.
00011  *
00012  * The LTI-Lib is distributed in the hope that it will be
00013  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
00014  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with the LTI-Lib; see the file LICENSE.  If
00019  * not, write to the Free Software Foundation, Inc., 59 Temple Place -
00020  * Suite 330, Boston, MA 02111-1307, USA.
00021  */
00022 
00023 
00024 /*--------------------------------------------------------------------
00025  * project ....: LTI-Lib: Image Processing and Computer Vision Library
00026  * file .......: ltiConvexHull.h
00027  * authors ....: Pablo Alvarado
00028  * organization: LTI, RWTH Aachen
00029  * creation ...: 16.11.2002
00030  * revisions ..: $Id: ltiConvexHull.h,v 1.7 2006/02/07 18:40:46 ltilib Exp $
00031  */
00032 
00033 #ifndef _LTI_CONVEX_HULL_H_
00034 #define _LTI_CONVEX_HULL_H_
00035 
00036 #include "ltiModifier.h"
00037 #include "ltiPolygonPoints.h"
00038 #include "ltiContour.h"
00039 
00040 namespace lti {
00041   /**
00042    * Computes the convex hull of a set of points.
00043    *
00044    * This functors is just a wrapper for the method \c convexHullFrom of
00045    * the lti::tpolygonPoints class.
00046    */
00047   class convexHull : public modifier {
00048   public:
00049     /**
00050      * the parameters for the class convexHull
00051      */
00052     class parameters : public modifier::parameters {
00053     public:
00054       /**
00055        * default constructor
00056        */
00057       parameters();
00058 
00059       /**
00060        * copy constructor
00061        * @param other the parameters object to be copied
00062        */
00063       parameters(const parameters& other);
00064 
00065       /**
00066        * destructor
00067        */
00068       ~parameters();
00069 
00070       /**
00071        * returns name of this type
00072        */
00073       const char* getTypeName() const;
00074 
00075       /**
00076        * copy the contents of a parameters object
00077        * @param other the parameters object to be copied
00078        * @return a reference to this parameters object
00079        */
00080       parameters& copy(const parameters& other);
00081 
00082       /**
00083        * copy the contents of a parameters object
00084        * @param other the parameters object to be copied
00085        * @return a reference to this parameters object
00086        */
00087       parameters& operator=(const parameters& other);
00088 
00089 
00090       /**
00091        * returns a pointer to a clone of the parameters
00092        */
00093       virtual functor::parameters* clone() const;
00094 
00095       /**
00096        * write the parameters in the given ioHandler
00097        * @param handler the ioHandler to be used
00098        * @param complete if true (the default) the enclosing begin/end will
00099        *        be also written, otherwise only the data block will be written.
00100        * @return true if write was successful
00101        */
00102       virtual bool write(ioHandler& handler,const bool complete=true) const;
00103 
00104       /**
00105        * read the parameters from the given ioHandler
00106        * @param handler the ioHandler to be used
00107        * @param complete if true (the default) the enclosing begin/end will
00108        *        be also written, otherwise only the data block will be written.
00109        * @return true if write was successful
00110        */
00111       virtual bool read(ioHandler& handler,const bool complete=true);
00112 
00113 #     ifdef _LTI_MSC_6
00114       /**
00115        * this function is required by MSVC only, as a workaround for a
00116        * very awful bug, which exists since MSVC V.4.0, and still by
00117        * V.6.0 with all bugfixes (so called "service packs") remains
00118        * there...  This method is also public due to another bug, so please
00119        * NEVER EVER call this method directly: use read() instead
00120        */
00121       bool readMS(ioHandler& handler,const bool complete=true);
00122 
00123       /**
00124        * this function is required by MSVC only, as a workaround for a
00125        * very awful bug, which exists since MSVC V.4.0, and still by
00126        * V.6.0 with all bugfixes (so called "service packs") remains
00127        * there...  This method is also public due to another bug, so please
00128        * NEVER EVER call this method directly: use write() instead
00129        */
00130       bool writeMS(ioHandler& handler,const bool complete=true) const;
00131 #     endif
00132 
00133       // ------------------------------------------------
00134       // the parameters
00135       // ------------------------------------------------
00136 
00137       //TODO: comment the parameters of your functor
00138       // If you add more parameters manually, do not forget to do following:
00139       // 1. indicate in the default constructor the default values
00140       // 2. make sure that the copy member also copy your new parameters
00141       // 3. make sure that the read and write members also read and
00142       //    write your parameters
00143 
00144 
00145     };
00146 
00147     /**
00148      * default constructor
00149      */
00150     convexHull();
00151 
00152     /**
00153      * Construct a functor using the given parameters
00154      */
00155     convexHull(const parameters& par);
00156 
00157     /**
00158      * copy constructor
00159      * @param other the object to be copied
00160      */
00161     convexHull(const convexHull& other);
00162 
00163     /**
00164      * destructor
00165      */
00166     virtual ~convexHull();
00167 
00168     /**
00169      * returns the name of this type ("convexHull")
00170      */
00171     virtual const char* getTypeName() const;
00172 
00173     /**
00174      * operates on a copy of the given %parameters.
00175      * @param src pointList with the source data.
00176      * @param dest pointList where the result will be left.
00177      * @return true if apply successful or false otherwise.
00178      */
00179     bool apply(const pointList& src,polygonPoints& dest) const;
00180 
00181     /**
00182      * operates on a copy of the given %parameters.
00183      * @param src pointList with the source data.
00184      * @param dest pointList where the result will be left.
00185      * @return true if apply successful or false otherwise.
00186      */
00187     bool apply(const ioPoints& src,polygonPoints& dest) const;
00188 
00189     /**
00190      * operates on a copy of the given %parameters.
00191      * @param src pointList with the source data.
00192      * @param dest pointList where the result will be left.
00193      * @return true if apply successful or false otherwise.
00194      */
00195     bool apply(const tpointList<float>& src,tpolygonPoints<float>& dest) const;
00196 
00197     /**
00198      * operates on a copy of the given %parameters.
00199      * @param src pointList with the source data.
00200      * @param dest pointList where the result will be left.
00201      * @return true if apply successful or false otherwise.
00202      */
00203     bool apply(const tpointList<double>& src,
00204                      tpolygonPoints<double>& dest) const;
00205 
00206     /**
00207      * copy data of "other" functor.
00208      * @param other the functor to be copied
00209      * @return a reference to this functor object
00210      */
00211     convexHull& copy(const convexHull& other);
00212 
00213     /**
00214      * alias for copy member
00215      * @param other the functor to be copied
00216      * @return a reference to this functor object
00217      */
00218     convexHull& operator=(const convexHull& other);
00219 
00220     /**
00221      * returns a pointer to a clone of this functor.
00222      */
00223     virtual functor* clone() const;
00224 
00225     /**
00226      * returns used parameters
00227      */
00228     const parameters& getParameters() const;
00229 
00230     //TODO: comment the attributes of your functor
00231     // If you add more attributes manually, do not forget to do following:
00232     // 1. indicate in the default constructor the default values
00233     // 2. make sure that the copy member also copy your new attributes, or
00234     //    to ensure there, that these attributes are properly initialized.
00235 
00236   };
00237 }
00238 
00239 #endif

Generated on Sat Apr 10 15:25:17 2010 for LTI-Lib by Doxygen 1.6.1