Qwt User's Guide 6.3.0
Loading...
Searching...
No Matches
qwt_spline_parametrization.h
1/******************************************************************************
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
12
13#include "qwt_global.h"
14#include "qwt_math.h"
15
16#include <qpoint.h>
17
45{
46 public:
48 enum Type
49 {
55
61
73
83
95
96
105 ParameterManhattan
106 };
107
108 explicit QwtSplineParametrization( int type );
110
111 int type() const;
112
113 virtual double valueIncrement( const QPointF&, const QPointF& ) const;
114
115 static double valueIncrementX( const QPointF&, const QPointF& );
116 static double valueIncrementY( const QPointF&, const QPointF& );
117 static double valueIncrementUniform( const QPointF&, const QPointF& );
118 static double valueIncrementChordal( const QPointF&, const QPointF& );
119 static double valueIncrementCentripetal( const QPointF&, const QPointF& );
120 static double valueIncrementManhattan( const QPointF&, const QPointF& );
121
122 private:
123 const int m_type;
124};
125
135 const QPointF& point1, const QPointF& point2 )
136{
137 return point2.x() - point1.x();
138}
139
149 const QPointF& point1, const QPointF& point2 )
150{
151 return point2.y() - point1.y();
152}
153
163 const QPointF& point1, const QPointF& point2 )
164{
165 Q_UNUSED( point1 )
166 Q_UNUSED( point2 )
167
168 return 1.0;
169}
170
180 const QPointF& point1, const QPointF& point2 )
181{
182 const double dx = point2.x() - point1.x();
183 const double dy = point2.y() - point1.y();
184
185 return std::sqrt( dx * dx + dy * dy );
186}
187
197 const QPointF& point1, const QPointF& point2 )
198{
199 return std::sqrt( valueIncrementChordal( point1, point2 ) );
200}
201
211 const QPointF& point1, const QPointF& point2 )
212{
213 return qAbs( point2.x() - point1.x() ) + qAbs( point2.y() - point1.y() );
214}
215
216#endif
Curve parametrization used for a spline interpolation.
static double valueIncrementChordal(const QPointF &, const QPointF &)
Calculate the ParameterChordal value increment for 2 points.
static double valueIncrementCentripetal(const QPointF &, const QPointF &)
Calculate the ParameterCentripetal value increment for 2 points.
static double valueIncrementX(const QPointF &, const QPointF &)
Calculate the ParameterX value increment for 2 points.
static double valueIncrementUniform(const QPointF &, const QPointF &)
Calculate the ParameterUniform value increment.
static double valueIncrementManhattan(const QPointF &, const QPointF &)
Calculate the ParameterManhattan value increment for 2 points.
static double valueIncrementY(const QPointF &, const QPointF &)
Calculate the ParameterY value increment for 2 points.