geometricProperties.h

Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 // $Id: geometricProperties.h,v 1.25.18.1 2007/03/25 21:25:26 oliver Exp $
00005 //
00006 
00007 #ifndef BALL_STRUCTURE_GEOMETRICPROPERTIES_H
00008 #define BALL_STRUCTURE_GEOMETRICPROPERTIES_H
00009 
00010 #ifndef BALL_COMMON_H
00011 # include <BALL/common.h>
00012 #endif
00013 
00014 #ifndef BALL_MATHS_VECTOR3_H
00015 # include <BALL/MATHS/vector3.h>
00016 #endif
00017 
00018 #ifndef BALL_MATHS_SIMPLEBOX3_H
00019 # include <BALL/MATHS/simpleBox3.h>
00020 #endif
00021 
00022 #ifndef BALL_KERNEL_ATOM_H
00023 # include <BALL/KERNEL/atom.h>
00024 #endif
00025 
00026 #ifndef BALL_KERNEL_FRAGMENT_H
00027 # include <BALL/KERNEL/fragment.h>
00028 #endif
00029 
00030 #ifndef BALL_CONCEPT_PROCESSOR_H
00031 # include <BALL/CONCEPT/processor.h>
00032 #endif
00033 
00034 #ifndef BALL_DATATYPE_STRING_H
00035 # include <BALL/DATATYPE/string.h>
00036 #endif
00037 
00038 #include <vector>
00039 
00040 namespace BALL 
00041 {
00042 
00058   class BALL_EXPORT BoundingBoxProcessor
00059     : public UnaryProcessor<Atom>
00060   {
00061     public:
00062 
00066       
00069     virtual bool start()
00070       ;
00071 
00074     virtual bool finish()
00075       ;
00076 
00079     virtual Processor::Result operator () (Atom& atom)
00080        { return operator() (atom.getPosition());}
00081 
00084     virtual Processor::Result operator () (const Vector3& v)
00085       ;
00086 
00087 
00089 
00092 
00095     SimpleBox3 getBox() const
00096       ;
00097 
00100     const Vector3& getLower() const
00101       ;
00102 
00105     const Vector3& getUpper() const
00106       ;
00107 
00109       
00110     private:
00111 
00112     Vector3 lower_;
00113     Vector3 upper_;
00114   };
00115 
00126   class BALL_EXPORT GeometricCenterProcessor
00127     : public UnaryProcessor<Atom> 
00128   {
00129     public:
00130 
00134 
00137     virtual bool start()
00138       ;
00139 
00142     virtual bool finish()
00143       ;
00144 
00147     virtual Processor::Result operator()(Atom& atom)
00148        { return operator()(atom.getPosition());}
00149 
00152     virtual Processor::Result operator()(const Vector3& v)
00153       ;
00154 
00156 
00159 
00162     Vector3& getCenter()
00163       ;
00164 
00166 
00167     private:
00168 
00169     Vector3 center_;
00170     Size    n_;
00171   };
00172 
00173 
00191   class BALL_EXPORT FragmentDistanceCollector
00192     : public UnaryProcessor<Composite> 
00193   {   
00194     public:
00195 
00199 
00202     FragmentDistanceCollector()
00203       ;
00204 
00209     FragmentDistanceCollector(const Composite& composite)
00210       ;
00211 
00217     FragmentDistanceCollector(const Composite& composite, float distance)
00218       ;
00219       
00220     virtual ~FragmentDistanceCollector()
00221       
00222     {}  
00223       
00225 
00228 
00231     virtual bool start()
00232       ;
00233 
00236     virtual bool finish()
00237       ;
00238 
00241     virtual Processor::Result operator()(Composite& composite)
00242       ;
00243 
00245 
00248 
00252     Size getNumberOfFragments()
00253       ;
00254 
00258     void setComposite(const Composite& composite)
00259       ;
00260 
00264     const Composite* getComposite() const
00265       ;
00266 
00270     float getDistance() const
00271       ;
00272     
00276     void setDistance(float distance)
00277       ;
00278 
00280     
00283     std::vector<Fragment*>  fragments;
00284 
00285 
00286     protected:
00287 
00288     std::vector<Fragment*>  all_fragments_;
00289     const Composite*  reference_composite_;
00290     float             squared_distance_;
00291   };
00292 
00293 
00295 
00299     
00302   BALL_EXPORT Angle calculateTorsionAngle(const Atom& a1, const Atom& a2, const Atom& a3, const Atom& a4)
00303     throw(Exception::IllegalPosition);
00304 
00307   BALL_EXPORT Angle calculateBondAngle(const Atom& a1, const Atom& a2, const Atom& a3)
00308     throw(Exception::IllegalPosition);
00309 
00311 } // namespace BALL
00312 
00313 #endif // BALL_STRUCTURE_GEOMETRICPROPERTIES_H