Quantum GIS API Documentation  1.7.5-Wroclaw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Bezier3D.h
Go to the documentation of this file.
1 /***************************************************************************
2  Bezier3D.h - description
3  -------------------
4  copyright : (C) 2004 by Marco Hugentobler
5  email : mhugent@geo.unizh.ch
6  ***************************************************************************/
7 
8 /***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 
17 #ifndef BEZIER3D_H
18 #define BEZIER3D_H
19 
20 #include "ParametricLine.h"
21 #include "Vector3D.h"
22 #include "MathUtils.h"
23 #include "qgslogger.h"
24 
26 class ANALYSIS_EXPORT Bezier3D: public ParametricLine
27 {
28  protected:
29 
30  public:
32  Bezier3D();
34  Bezier3D( ParametricLine* par, QVector<Point3D*>* controlpoly );
36  virtual ~Bezier3D();
38  virtual void add( ParametricLine* pl );
40  virtual void calcFirstDer( float t, Vector3D* v );
42  virtual void calcSecDer( float t, Vector3D* v );
43  //virtual Point3D calcPoint(float t);
45  virtual void calcPoint( float t, Point3D* p );
47  virtual void changeDirection();
48  //virtual void draw(QPainter* p);
49  //virtual bool intersects(ParametricLine* pal);
51  virtual void remove( int i );
53  virtual const Point3D* getControlPoint( int number ) const;
55  virtual const QVector<Point3D*>* getControlPoly() const;
57  virtual int getDegree() const;
59  virtual ParametricLine* getParent() const;
61  virtual void setParent( ParametricLine* par );
63  virtual void setControlPoly( QVector<Point3D*>* cp );
64 
65 };
66 
67 //-----------------------------------------------constructors, destructor and assignment operator------------------------------
68 
69 inline Bezier3D::Bezier3D() : ParametricLine()//default constructor
70 {
71 
72 }
73 
74 inline Bezier3D::Bezier3D( ParametricLine* parent, QVector<Point3D*>* controlpoly ) : ParametricLine( parent, controlpoly )
75 {
76  mDegree = mControlPoly->count() - 1;
77 }
78 
80 {
81 
82 }
83 
84 //----------------------------------------------invalid methods add and remove (because of inheritance from ParametricLine)
85 
86 inline void Bezier3D::add( ParametricLine* pl )
87 {
88  QgsDebugMsg( "Error!!!!! A Bezier-curve can not be parent of a ParametricLine." );
89 }
90 
91 inline void Bezier3D::remove( int i )
92 {
93  QgsDebugMsg( "Error!!!!! A Bezier-curve has no children to remove." );
94 }
95 
96 //-----------------------------------------------setters and getters---------------------------------------------------------------
97 
98 inline const Point3D* Bezier3D::getControlPoint( int number ) const
99 {
100  return ( *mControlPoly )[number-1];
101 }
102 
103 inline const QVector<Point3D*>* Bezier3D::getControlPoly() const
104 {
105  return mControlPoly;
106 }
107 
108 inline int Bezier3D::getDegree() const
109 {
110  return mDegree;
111 }
112 
114 {
115  return mParent;
116 }
117 
119 {
120  mParent = par;
121 }
122 
123 inline void Bezier3D::setControlPoly( QVector<Point3D*>* cp )
124 {
125  mControlPoly = cp;
126  mDegree = mControlPoly->count() - 1;
127 }
128 
129 #endif
130