AntiSimmetry.h

Go to the documentation of this file.
00001 // ----------------------------------------------------------------------------
00002 //
00003 // $Id$
00004 //
00005 // Copyright 2008, 2009, 2010, 2011, 2012  Antonio Franchi and Paolo Stegagno    
00006 //
00007 // This file is part of MIP.
00008 //
00009 // MIP is free software: you can redistribute it and/or modify
00010 // it under the terms of the GNU General Public License as published by
00011 // the Free Software Foundation, either version 3 of the License, or
00012 // (at your option) any later version.
00013 //
00014 // MIP is distributed in the hope that it will be useful,
00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 // GNU General Public License for more details.
00018 //
00019 // You should have received a copy of the GNU General Public License
00020 // along with MIP. If not, see <http://www.gnu.org/licenses/>.
00021 //
00022 // Contact info: antonio.franchi@tuebingen.mpg.de stegagno@diag.uniroma1.it
00023 //
00024 // ----------------------------------------------------------------------------
00025 
00026 
00030 
00036 
00037 
00038 #ifndef __ANTI_SIMMETRY_H
00039 #define __ANTI_SIMMETRY_H
00040 
00041 #include <Spaces.h>
00042 #include <Scan.h>
00043 
00044 namespace MipAlgorithms{
00045  
00047  
00048  /* @{ */
00052  class AntiSimmetryIn{
00053   public:
00054    
00056    vector<Position> formation;
00057    
00059    int myPosition;
00060    
00062    AntiSimmetryIn();
00063    
00067    AntiSimmetryIn(vector<Position> &f, int i);
00068  };
00069  
00070  
00074  class AntiSimmetryParams {
00075   
00076   Decimal _discretizationStep;
00077   
00078   public:
00080    AntiSimmetryParams();
00081    
00084    AntiSimmetryParams(Decimal ds);
00085    
00088    Decimal discretizationStep();
00089    
00092    string print();
00093  };
00094  
00095  
00099  class AntiSimmetryVars {
00100   
00101   Position _centroid;
00102   
00103   vector<Position> _centeredFormation;
00104   
00105   vector<Decimal> _simmetryFunction;
00106   
00107   int _minSimmetryFunctionRange;
00108   
00109   int _maxSimmetryFunctionRange;
00110   
00111   Decimal _minSimmetryFunction;
00112   
00113   int _minSimmetryFunctionIndex;
00114   
00115   vector<Position> _closestRotatedFormation;
00116   
00117   public:
00120    AntiSimmetryVars(AntiSimmetryParams &par);
00121    
00124    Position getCentroid();
00125    
00128    void setCentroid(Position &value);
00129    
00133    Position getCenteredFormation(int index);
00134    
00137    void getCenteredFormation(vector<Position> &ceForm);
00138    
00141    int getCenteredFormationSize();
00142    
00146    void setCenteredFormation(int index, Position& value);
00147    
00150    void setCenteredFormationSize(int value);
00151    
00154    vector<Decimal> getSimmetryFunction();
00155    
00159    Decimal getSimmetryFunction(int index);
00160    
00163    int getSimmetryFunctionSize();
00164    
00168    void setSimmetryFunction(int index, Decimal value);
00169    
00172    int getMinSimmetryFunctionRange();
00173    
00176    int getMaxSimmetryFunctionRange();
00177    
00181    void setSimmetryFunctionRange(int min, int max);
00182    
00185    Decimal getMinSimmetryFunction();
00186    
00189    void setMinSimmetryFunction(Decimal min);
00190    
00193    int getMinSimmetryFunctionIndex();
00194    
00197    void setMinSimmetryFunctionIndex(int minInd);
00198    
00201    void getClosestRotatedFormation(vector<Position> &clForm);
00202    
00205    void setClosestRotatedFormation(vector<Position> &clForm);
00206    
00209    string print();
00210  };
00211  
00212  
00216  class AntiSimmetry {
00217   private:
00218    AntiSimmetryVars*  _vars;
00219    AntiSimmetryParams _params;
00220    
00221    void _computeCentroid(AntiSimmetryIn &in);
00222    void _computeCenteredFormation(AntiSimmetryIn &in);
00223    void _computeSimmetryFunction();
00224    void _findMinSimmetryFunctionValues();
00225    Position _computeControl(AntiSimmetryIn &in);
00226    
00227   public:
00230    AntiSimmetry(AntiSimmetryParams inParams);
00231    
00233    ~AntiSimmetry();
00234    
00237    Position step(AntiSimmetryIn &in);
00238    
00241    vector<Position> getSimmetryFunction();
00242    
00245    int getMinSimmetryFunctionRange();
00246    
00249    int getMaxSimmetryFunctionRange();
00250    
00253    Decimal getMinSimmetryFunction();
00254    
00257    int getMinSimmetryFunctionIndex();
00258    
00261    Position getCentroid();
00262    
00265    void getCenteredFormation(vector<Position> &ceForm);
00266    
00269    void getClosestRotatedFormation(vector<Position> &clForm);
00270    
00273    string print();
00274  };
00275  
00276  /* @} */
00277  
00278 } // end namespace MipAlgorithms
00279 
00280 
00281 #endif
00282 
00283 
00284 
00285 
00286 
00287 
00288 
00289 
00290 
00291 

Generated on Mon Feb 20 07:01:06 2017 for MIP by  doxygen 1.5.6