qwt_spline_parametrization.h
Go to the documentation of this file.
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2  * Qwt Widget Library
3  * Copyright (C) 1997 Josef Wilgen
4  * Copyright (C) 2002 Uwe Rathmann
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the Qwt License, Version 1.0
8  *****************************************************************************/
9 
10 #ifndef QWT_SPLINE_PARAMETRIZATION_H
11 #define QWT_SPLINE_PARAMETRIZATION_H 1
12 
13 #include "qwt_global.h"
14 #include <qmath.h>
15 #include <qpoint.h>
16 
44 {
45 public:
47  enum Type
48  {
54 
60 
72 
82 
94 
95 
104  ParameterManhattan
105  };
106 
107  explicit QwtSplineParametrization( int type );
108  virtual ~QwtSplineParametrization();
109 
110  int type() const;
111 
112  virtual double valueIncrement( const QPointF &, const QPointF & ) const;
113 
114  static double valueIncrementX( const QPointF &, const QPointF & );
115  static double valueIncrementY( const QPointF &, const QPointF & );
116  static double valueIncrementUniform( const QPointF &, const QPointF & );
117  static double valueIncrementChordal( const QPointF &, const QPointF & );
118  static double valueIncrementCentripetal( const QPointF &, const QPointF & );
119  static double valueIncrementManhattan( const QPointF &, const QPointF & );
120 
121 private:
122  const int d_type;
123 };
124 
134  const QPointF &point1, const QPointF &point2 )
135 {
136  return point2.x() - point1.x();
137 }
138 
148  const QPointF &point1, const QPointF &point2 )
149 {
150  return point2.y() - point1.y();
151 }
152 
162  const QPointF &point1, const QPointF &point2 )
163 {
164  Q_UNUSED( point1 )
165  Q_UNUSED( point2 )
166 
167  return 1.0;
168 }
169 
179  const QPointF &point1, const QPointF &point2 )
180 {
181  const double dx = point2.x() - point1.x();
182  const double dy = point2.y() - point1.y();
183 
184  return qSqrt( dx * dx + dy * dy );
185 }
186 
196  const QPointF &point1, const QPointF &point2 )
197 {
198  return qSqrt( valueIncrementChordal( point1, point2 ) );
199 }
200 
210  const QPointF &point1, const QPointF &point2 )
211 {
212  return qAbs( point2.x() - point1.x() ) + qAbs( point2.y() - point1.y() );
213 }
214 
215 #endif
Curve parametrization used for a spline interpolation.
static double valueIncrementCentripetal(const QPointF &, const QPointF &)
Calculate the ParameterCentripetal value increment for 2 points.
#define QWT_EXPORT
Definition: qwt_global.h:38
static double valueIncrementChordal(const QPointF &, const QPointF &)
Calculate the ParameterChordal value increment for 2 points.
static double valueIncrementY(const QPointF &, const QPointF &)
Calculate the ParameterY value increment for 2 points.
static double valueIncrementUniform(const QPointF &, const QPointF &)
Calculate the ParameterUniform value increment.
static double valueIncrementX(const QPointF &, const QPointF &)
Calculate the ParameterX value increment for 2 points.
static double valueIncrementManhattan(const QPointF &, const QPointF &)
Calculate the ParameterManhattan value increment for 2 points.


plotjuggler
Author(s): Davide Faconti
autogenerated on Sat Jul 6 2019 03:44:18