Quantum GIS API Documentation  1.8
src/analysis/interpolation/Bezier3D.h
Go to the documentation of this file.
00001 /***************************************************************************
00002                           Bezier3D.h  -  description
00003                              -------------------
00004     copyright            : (C) 2004 by Marco Hugentobler
00005     email                : [email protected]
00006  ***************************************************************************/
00007 
00008 /***************************************************************************
00009  *                                                                         *
00010  *   This program is free software; you can redistribute it and/or modify  *
00011  *   it under the terms of the GNU General Public License as published by  *
00012  *   the Free Software Foundation; either version 2 of the License, or     *
00013  *   (at your option) any later version.                                   *
00014  *                                                                         *
00015  ***************************************************************************/
00016 
00017 #ifndef BEZIER3D_H
00018 #define BEZIER3D_H
00019 
00020 #include "ParametricLine.h"
00021 #include "Vector3D.h"
00022 #include "MathUtils.h"
00023 #include "qgslogger.h"
00024 
00026 class ANALYSIS_EXPORT Bezier3D: public ParametricLine
00027 {
00028   protected:
00029 
00030   public:
00032     Bezier3D();
00034     Bezier3D( ParametricLine* par, QVector<Point3D*>* controlpoly );
00036     virtual ~Bezier3D();
00038     virtual void add( ParametricLine *pl );
00040     virtual void calcFirstDer( float t, Vector3D* v );
00042     virtual void calcSecDer( float t, Vector3D* v );
00043     //virtual Point3D calcPoint(float t);
00045     virtual void calcPoint( float t, Point3D* p );
00047     virtual void changeDirection();
00048     //virtual void draw(QPainter* p);
00049     //virtual bool intersects(ParametricLine* pal);
00051     virtual void remove( int i );
00053     virtual const Point3D* getControlPoint( int number ) const;
00055     virtual const QVector<Point3D*>* getControlPoly() const;
00057     virtual int getDegree() const;
00059     virtual ParametricLine* getParent() const;
00061     virtual void setParent( ParametricLine* par );
00063     virtual void setControlPoly( QVector<Point3D*>* cp );
00064 
00065 };
00066 
00067 //-----------------------------------------------constructors, destructor and assignment operator------------------------------
00068 
00069 inline Bezier3D::Bezier3D() : ParametricLine()//default constructor
00070 {
00071 
00072 }
00073 
00074 inline Bezier3D::Bezier3D( ParametricLine* parent, QVector<Point3D*>* controlpoly ) : ParametricLine( parent, controlpoly )
00075 {
00076   mDegree = mControlPoly->count() - 1;
00077 }
00078 
00079 inline Bezier3D::~Bezier3D()
00080 {
00081 
00082 }
00083 
00084 //----------------------------------------------invalid methods add and remove (because of inheritance from ParametricLine)
00085 
00086 inline void Bezier3D::add( ParametricLine *pl )
00087 {
00088   Q_UNUSED( pl );
00089   QgsDebugMsg( "Error!!!!! A Bezier-curve can not be parent of a ParametricLine." );
00090 }
00091 
00092 inline void Bezier3D::remove( int i )
00093 {
00094   Q_UNUSED( i );
00095   QgsDebugMsg( "Error!!!!! A Bezier-curve has no children to remove." );
00096 }
00097 
00098 //-----------------------------------------------setters and getters---------------------------------------------------------------
00099 
00100 inline const Point3D* Bezier3D::getControlPoint( int number ) const
00101 {
00102   return ( *mControlPoly )[number-1];
00103 }
00104 
00105 inline const QVector<Point3D*>* Bezier3D::getControlPoly() const
00106 {
00107   return mControlPoly;
00108 }
00109 
00110 inline int Bezier3D::getDegree() const
00111 {
00112   return mDegree;
00113 }
00114 
00115 inline ParametricLine* Bezier3D::getParent() const
00116 {
00117   return mParent;
00118 }
00119 
00120 inline void Bezier3D::setParent( ParametricLine* par )
00121 {
00122   mParent = par;
00123 }
00124 
00125 inline void Bezier3D::setControlPoly( QVector<Point3D*>* cp )
00126 {
00127   mControlPoly = cp;
00128   mDegree = mControlPoly->count() - 1;
00129 }
00130 
00131 #endif
00132 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines