QGIS API Documentation  2.4.0-Chugiak
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 *
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 );
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  virtual const QVector<Point3D*>* getControlPoly() const;
59  virtual int getDegree() const;
61  virtual ParametricLine* getParent() const;
63  virtual void setParent( ParametricLine* par );
65  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
virtual void setParent(ParametricLine *paral)=0
virtual void setControlPoly(QVector< Point3D * > *cp)=0
#define QgsDebugMsg(str)
Definition: qgslogger.h:36
Class Bezier3D represents a bezier curve, represented by control points.
Definition: Bezier3D.h:26
virtual ParametricLine * getParent() const
Returns the parent.
Definition: Bezier3D.h:118
virtual void remove(int i)
Do not use this method, since a Bezier curve does not consist of other curves.
Definition: Bezier3D.h:95
Do not use this method, since a Bezier curve does not consist of other curves.
Definition: Bezier3D.h:89
virtual const Point3D * getControlPoint(int number) const
Returns a control point.
Definition: Bezier3D.h:103
virtual void calcPoint(float t, Point3D *)=0
virtual void setControlPoly(QVector< Point3D * > *cp)
Sets the control polygon.
Definition: Bezier3D.h:128
virtual int getDegree() const
Returns the degree of the curve.
Definition: Bezier3D.h:113
Point3D is a class to represent a three dimensional point.
Definition: Point3D.h:23
virtual ParametricLine * getParent() const =0
Class Vector3D represents a 3D-Vector, capable to store x-,y- and z-coordinates in double values...
Definition: Vector3D.h:22
virtual void changeDirection()=0
int mDegree
Degree of the parametric Line.
ParametricLine * mParent
Pointer to the parent object.
virtual const QVector< Point3D * > * getControlPoly() const
Returns a pointer to the control polygon.
Definition: Bezier3D.h:108
virtual const Point3D * getControlPoint(int number) const =0
ParametricLine is an Interface for parametric lines.
QVector< Point3D * > * mControlPoly
mControlPoly stores the points of the control polygon
virtual ~Bezier3D()
Destructor.
Definition: Bezier3D.h:82
Bezier3D()
Default constructor.
Definition: Bezier3D.h:72
virtual const QVector< Point3D * > * getControlPoly() const =0
virtual void calcSecDer(float t, Vector3D *v)=0
virtual int getDegree() const =0
virtual void calcFirstDer(float t, Vector3D *v)=0
virtual void setParent(ParametricLine *par)
Sets the parent.
Definition: Bezier3D.h:123