QGIS API Documentation  2.6.0-Brighton
Bezier3D.h
Go to the documentation of this file.
1 /***************************************************************************
2  Bezier3D.h - description
3  -------------------
4  copyright : (C) 2004 by Marco Hugentobler
5  email : [email protected]
6  ***************************************************************************/
7
8 /***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
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
35  Bezier3D( ParametricLine* par, QVector<Point3D*>* controlpoly );
37  virtual ~Bezier3D();
39  virtual void add( ParametricLine *pl );
41  virtual void calcFirstDer( float t, Vector3D* v );
43  virtual void calcSecDer( float t, Vector3D* v );
44  //virtual Point3D calcPoint(float t);
46  virtual void calcPoint( float t, Point3D* p );
48  virtual void changeDirection();
49  //virtual void draw(QPainter* p);
50  //virtual bool intersects(ParametricLine* pal);
52  virtual void remove( int i );
54  virtual const Point3D* getControlPoint( int number ) const;
56
57  virtual const QVector<Point3D*>* getControlPoly() const;
59  virtual int getDegree() const;
61  virtual ParametricLine* getParent() const;
63  virtual void setParent( ParametricLine* par );
65
66  virtual void setControlPoly( QVector<Point3D*>* cp );
67
68 };
69
70 //-----------------------------------------------constructors, destructor and assignment operator------------------------------
71
72 inline Bezier3D::Bezier3D() : ParametricLine()//default constructor
73 {
74
75 }
76
77 inline Bezier3D::Bezier3D( ParametricLine* parent, QVector<Point3D*>* controlpoly ) : ParametricLine( parent, controlpoly )
78 {
79  mDegree = mControlPoly->count() - 1;
80 }
81
83 {
84
85 }
86
87 //----------------------------------------------invalid methods add and remove (because of inheritance from ParametricLine)
88
89 inline void Bezier3D::add( ParametricLine *pl )
90 {
91  Q_UNUSED( pl );
92  QgsDebugMsg( "Error!!!!! A Bezier-curve can not be parent of a ParametricLine." );
93 }
94
95 inline void Bezier3D::remove( int i )
96 {
97  Q_UNUSED( i );
98  QgsDebugMsg( "Error!!!!! A Bezier-curve has no children to remove." );
99 }
100
101 //-----------------------------------------------setters and getters---------------------------------------------------------------
102
103 inline const Point3D* Bezier3D::getControlPoint( int number ) const
104 {
105  return ( *mControlPoly )[number-1];
106 }
107
108 inline const QVector<Point3D*>* Bezier3D::getControlPoly() const
109 {
110  return mControlPoly;
111 }
112
113 inline int Bezier3D::getDegree() const
114 {
115  return mDegree;
116 }
117
119 {
120  return mParent;
121 }
122
124 {
125  mParent = par;
126 }
127
128 inline void Bezier3D::setControlPoly( QVector<Point3D*>* cp )
129 {
130  mControlPoly = cp;
131  mDegree = mControlPoly->count() - 1;
132 }
133
134 #endif
135