QGIS API Documentation  2.99.0-Master (c558d51)
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 *
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 "qgslogger.h"
22 
25 class ANALYSIS_EXPORT Bezier3D: public ParametricLine
26 {
27  protected:
28 
29  public:
31  Bezier3D();
33  Bezier3D( ParametricLine* par, QVector<Point3D*>* controlpoly );
35  virtual ~Bezier3D();
37  virtual void add( ParametricLine *pl ) override;
39  virtual void calcFirstDer( float t, Vector3D* v ) override;
41  virtual void calcSecDer( float t, Vector3D* v ) override;
42  //virtual Point3D calcPoint(float t);
44  virtual void calcPoint( float t, Point3D* p ) override;
46  virtual void changeDirection() override;
47  //virtual void draw(QPainter* p);
48  //virtual bool intersects(ParametricLine* pal);
50  virtual void remove( int i ) override;
52  virtual const Point3D* getControlPoint( int number ) const override;
54  virtual const QVector<Point3D*>* getControlPoly() const override;
56  virtual int getDegree() const override;
58  virtual ParametricLine* getParent() const override;
60  virtual void setParent( ParametricLine* par ) override;
62  virtual void setControlPoly( QVector<Point3D*>* cp ) override;
63 
64 };
65 
66 //-----------------------------------------------constructors, destructor and assignment operator------------------------------
67 
68 inline Bezier3D::Bezier3D() : ParametricLine()//default constructor
69 {
70 
71 }
72 
73 inline Bezier3D::Bezier3D( ParametricLine* parent, QVector<Point3D*>* controlpoly ) : ParametricLine( parent, controlpoly )
74 {
75  mDegree = mControlPoly->count() - 1;
76 }
77 
79 {
80 
81 }
82 
83 //----------------------------------------------invalid methods add and remove (because of inheritance from ParametricLine)
84 
85 inline void Bezier3D::add( ParametricLine *pl )
86 {
87  Q_UNUSED( pl );
88  QgsDebugMsg( "Error!!!!! A Bezier-curve can not be parent of a ParametricLine." );
89 }
90 
91 inline void Bezier3D::remove( int i )
92 {
93  Q_UNUSED( i );
94  QgsDebugMsg( "Error!!!!! A Bezier-curve has no children to remove." );
95 }
96 
97 //-----------------------------------------------setters and getters---------------------------------------------------------------
98 
99 inline const Point3D* Bezier3D::getControlPoint( int number ) const
100 {
101  return ( *mControlPoly )[number-1];
102 }
103 
104 inline const QVector<Point3D*>* Bezier3D::getControlPoly() const
105 {
106  return mControlPoly;
107 }
108 
109 inline int Bezier3D::getDegree() const
110 {
111  return mDegree;
112 }
113 
115 {
116  return mParent;
117 }
118 
120 {
121  mParent = par;
122 }
123 
124 inline void Bezier3D::setControlPoly( QVector<Point3D*>* cp )
125 {
126  mControlPoly = cp;
127  mDegree = mControlPoly->count() - 1;
128 }
129 
130 #endif
131 
virtual ParametricLine * getParent() const =0
virtual void setParent(ParametricLine *par) override
Sets the parent.
Definition: Bezier3D.h:119
virtual void add(ParametricLine *pl) override
Do not use this method, since a Bezier curve does not consist of other curves.
Definition: Bezier3D.h:85
#define QgsDebugMsg(str)
Definition: qgslogger.h:33
Class Bezier3D represents a bezier curve, represented by control points.
Definition: Bezier3D.h:25
virtual void calcFirstDer(float t, Vector3D *v)=0
virtual void calcSecDer(float t, Vector3D *v)=0
virtual const QVector< Point3D * > * getControlPoly() const =0
virtual const QVector< Point3D * > * getControlPoly() const override
Returns a pointer to the control polygon.
Definition: Bezier3D.h:104
Point3D is a class to represent a three dimensional point.
Definition: Point3D.h:24
virtual const Point3D * getControlPoint(int number) const =0
virtual void setParent(ParametricLine *paral)=0
Class Vector3D represents a 3D-Vector, capable to store x-,y- and z-coordinates in double values...
Definition: Vector3D.h:28
virtual void changeDirection()=0
virtual int getDegree() const override
Returns the degree of the curve.
Definition: Bezier3D.h:109
int mDegree
Degree of the parametric Line.
virtual ParametricLine * getParent() const override
Returns the parent.
Definition: Bezier3D.h:114
virtual void add(ParametricLine *pl)=0
ParametricLine * mParent
Pointer to the parent object. If there isn&#39;t one, mParent is 0.
virtual int getDegree() const =0
ParametricLine is an Interface for parametric lines.
QVector< Point3D * > * mControlPoly
MControlPoly stores the points of the control polygon.
virtual void setControlPoly(QVector< Point3D * > *cp) override
Sets the control polygon.
Definition: Bezier3D.h:124
virtual const Point3D * getControlPoint(int number) const override
Returns a control point.
Definition: Bezier3D.h:99
virtual ~Bezier3D()
Destructor.
Definition: Bezier3D.h:78
Bezier3D()
Default constructor.
Definition: Bezier3D.h:68
virtual void remove(int i) override
Do not use this method, since a Bezier curve does not consist of other curves.
Definition: Bezier3D.h:91
virtual void setControlPoly(QVector< Point3D * > *cp)=0
virtual void calcPoint(float t, Point3D *)=0