IvfFunctions.h

00001 //
00002 // Copyright 1999-2006 by Structural Mechanics, Lund University.
00003 //
00004 // This library is free software; you can redistribute it and/or
00005 // modify it under the terms of the GNU Library General Public
00006 // License as published by the Free Software Foundation; either
00007 // version 2 of the License, or (at your option) any later version.
00008 //
00009 // This library is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // Library General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU Library General Public
00015 // License along with this library; if not, write to the Free Software
00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00017 // USA.
00018 //
00019 // Please report all bugs and problems to "ivf@byggmek.lth.se".
00020 //
00021 //
00022 // Written by Jonas Lindemann
00023 //
00024 
00025 #ifndef _IvfFunctions_h_
00026 #define _IvfFunctions_h_
00027 
00028 #include <ivfmath/IvfMathBase.h>
00029 #include <ivfmath/IvfVec3d.h>
00030 #include <ivf/ivfconfig.h>
00031 
00032 IvfSmartPointer(CIvfFunction2d);
00033 
00041 class IVFMATH_API CIvfFunction2d : public CIvfMathBase {
00042 private:
00043 
00044 public:
00045         IvfClassInfo("CIvfFunction2d",CIvfMathBase);
00052         virtual double f(double x) = 0;
00053 };
00054 
00055 class IVFMATH_API CIvfScalarVectorFunction : public CIvfMathBase {
00056 private:
00057 
00058 public:
00059         IvfClassInfo("CIvfScalarVectorFunction",CIvfMathBase);
00060 
00061         virtual CIvfVec3d& f(double x) = 0;
00062 };
00063 
00064 IvfSmartPointer(CIvfLine2d);
00065 
00073 class IVFMATH_API CIvfLine2d : public CIvfFunction2d {
00074 private:
00075         double m_k;
00076         double m_m;
00077 public:
00084         CIvfLine2d(double x1, double y1, double x2, double y2);
00085 
00091         CIvfLine2d();
00092 
00093         IvfClassInfo("CIvfLine2d",CIvfFunction2d);
00094 
00100         CIvfLine2d(double k, double m);
00101 
00103         virtual double f(double x);
00104 };
00105 
00106 IvfSmartPointer(CIvfTheta2d);
00107 
00119 class IVFMATH_API CIvfTheta2d : public CIvfFunction2d {
00120 private:
00121 
00122 public:
00123         IvfClassInfo("CIvfTheta2d",CIvfFunction2d);
00125         virtual double f(double x);
00126 };
00127 
00128 IvfSmartPointer(CIvfPulse2d);
00129 
00139 class IVFMATH_API CIvfPulse2d : public CIvfFunction2d {
00140 private:
00141         double m_delta;
00142         CIvfTheta2d m_theta;
00143 public:
00150         CIvfPulse2d(double delta);
00151 
00152         IvfClassInfo("CIvfPulse2d",CIvfFunction2d);
00153 
00155         virtual double f(double x);
00156 };
00157 
00158 IvfSmartPointer(CIvfEnvPos2d);
00159 
00167 class IVFMATH_API CIvfEnvPos2d : public CIvfMathBase {
00168 private:
00169         double m_pos[2];
00170 public:
00176         CIvfEnvPos2d();
00177 
00184         CIvfEnvPos2d(double x, double y);
00185 
00186         IvfClassInfo("CIvfEnvPos2d",CIvfMathBase);
00187 
00189         double getY();
00190 
00192         double getX();
00193 };
00194 
00198 struct SIvfEnvPos2dCompare {
00199     bool operator() (CIvfEnvPos2d* p1, CIvfEnvPos2d* p2) const {
00200         return (p1->getX()<p2->getX());
00201     }
00202 };
00203 
00204 namespace std {};
00205 
00206 typedef std::set<CIvfEnvPos2d*, SIvfEnvPos2dCompare> CIvfEnvelopePosSet;
00207 typedef std::set<CIvfEnvPos2d*, SIvfEnvPos2dCompare>::iterator CIvfEnvelopePosSetIter;
00208 typedef std::vector<CIvfEnvPos2d*> CIvfEnvelopePosVector;
00209 typedef std::vector<CIvfEnvPos2d*>::iterator CIvfEnvelopePosVectorIter;
00210 
00211 IvfSmartPointer(CIvfEnvelope2d);
00212 
00221 class IVFMATH_API CIvfEnvelope2d : public CIvfFunction2d {
00222 private:
00223         double interpolate(CIvfEnvPos2d* pos1, CIvfEnvPos2d* pos2, double x);
00224         CIvfEnvelopePosSet m_envelopeSet;
00225         CIvfEnvelopePosVector m_envelope;
00226         double m_range[2];
00227         bool m_finished;
00228 public:
00230         CIvfEnvelope2d();
00231 
00233         virtual ~CIvfEnvelope2d();
00234 
00235         IvfClassInfo("CIvfEnvelope2d",CIvfFunction2d);
00236 
00238         void addPoint(double x, double y);
00239 
00248         void finish();
00249 
00251         void clear();
00252 
00254         double getMinX();
00255 
00257         double getMaxX();
00258 
00260         virtual double f(double x);
00261 };
00262 
00263 #endif

Generated on Fri Sep 1 15:36:47 2006 for Interactive Visualisation Framework - Ivf++ by  doxygen 1.4.6-NO