Quantum GIS API Documentation
1.7.4
|
00001 /*************************************************************************** 00002 Bezier3D.h - description 00003 ------------------- 00004 copyright : (C) 2004 by Marco Hugentobler 00005 email : mhugent@geo.unizh.ch 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 QgsDebugMsg( "Error!!!!! A Bezier-curve can not be parent of a ParametricLine." ); 00089 } 00090 00091 inline void Bezier3D::remove( int i ) 00092 { 00093 QgsDebugMsg( "Error!!!!! A Bezier-curve has no children to remove." ); 00094 } 00095 00096 //-----------------------------------------------setters and getters--------------------------------------------------------------- 00097 00098 inline const Point3D* Bezier3D::getControlPoint( int number ) const 00099 { 00100 return ( *mControlPoly )[number-1]; 00101 } 00102 00103 inline const QVector<Point3D*>* Bezier3D::getControlPoly() const 00104 { 00105 return mControlPoly; 00106 } 00107 00108 inline int Bezier3D::getDegree() const 00109 { 00110 return mDegree; 00111 } 00112 00113 inline ParametricLine* Bezier3D::getParent() const 00114 { 00115 return mParent; 00116 } 00117 00118 inline void Bezier3D::setParent( ParametricLine* par ) 00119 { 00120 mParent = par; 00121 } 00122 00123 inline void Bezier3D::setControlPoly( QVector<Point3D*>* cp ) 00124 { 00125 mControlPoly = cp; 00126 mDegree = mControlPoly->count() - 1; 00127 } 00128 00129 #endif 00130