|
Quantum GIS API Documentation
master-ce49b66
|
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 00035 Bezier3D( ParametricLine* par, QVector<Point3D*>* controlpoly ); 00037 virtual ~Bezier3D(); 00039 virtual void add( ParametricLine *pl ); 00041 virtual void calcFirstDer( float t, Vector3D* v ); 00043 virtual void calcSecDer( float t, Vector3D* v ); 00044 //virtual Point3D calcPoint(float t); 00046 virtual void calcPoint( float t, Point3D* p ); 00048 virtual void changeDirection(); 00049 //virtual void draw(QPainter* p); 00050 //virtual bool intersects(ParametricLine* pal); 00052 virtual void remove( int i ); 00054 virtual const Point3D* getControlPoint( int number ) const; 00056 00057 virtual const QVector<Point3D*>* getControlPoly() const; 00059 virtual int getDegree() const; 00061 virtual ParametricLine* getParent() const; 00063 virtual void setParent( ParametricLine* par ); 00065 00066 virtual void setControlPoly( QVector<Point3D*>* cp ); 00067 00068 }; 00069 00070 //-----------------------------------------------constructors, destructor and assignment operator------------------------------ 00071 00072 inline Bezier3D::Bezier3D() : ParametricLine()//default constructor 00073 { 00074 00075 } 00076 00077 inline Bezier3D::Bezier3D( ParametricLine* parent, QVector<Point3D*>* controlpoly ) : ParametricLine( parent, controlpoly ) 00078 { 00079 mDegree = mControlPoly->count() - 1; 00080 } 00081 00082 inline Bezier3D::~Bezier3D() 00083 { 00084 00085 } 00086 00087 //----------------------------------------------invalid methods add and remove (because of inheritance from ParametricLine) 00088 00089 inline void Bezier3D::add( ParametricLine *pl ) 00090 { 00091 Q_UNUSED( pl ); 00092 QgsDebugMsg( "Error!!!!! A Bezier-curve can not be parent of a ParametricLine." ); 00093 } 00094 00095 inline void Bezier3D::remove( int i ) 00096 { 00097 Q_UNUSED( i ); 00098 QgsDebugMsg( "Error!!!!! A Bezier-curve has no children to remove." ); 00099 } 00100 00101 //-----------------------------------------------setters and getters--------------------------------------------------------------- 00102 00103 inline const Point3D* Bezier3D::getControlPoint( int number ) const 00104 { 00105 return ( *mControlPoly )[number-1]; 00106 } 00107 00108 inline const QVector<Point3D*>* Bezier3D::getControlPoly() const 00109 { 00110 return mControlPoly; 00111 } 00112 00113 inline int Bezier3D::getDegree() const 00114 { 00115 return mDegree; 00116 } 00117 00118 inline ParametricLine* Bezier3D::getParent() const 00119 { 00120 return mParent; 00121 } 00122 00123 inline void Bezier3D::setParent( ParametricLine* par ) 00124 { 00125 mParent = par; 00126 } 00127 00128 inline void Bezier3D::setControlPoly( QVector<Point3D*>* cp ) 00129 { 00130 mControlPoly = cp; 00131 mDegree = mControlPoly->count() - 1; 00132 } 00133 00134 #endif 00135