Qwt User's Guide: QwtSplineParametrization Class Reference

Qwt User's Guide 6.2.0

Public Types | Public Member Functions | Static Public Member Functions | List of all members
QwtSplineParametrization Class Reference

Curve parametrization used for a spline interpolation. More...

`#include <qwt_spline_parametrization.h>`

## Public Types
enum | Type { ParameterX , ParameterY , ParameterUniform , ParameterChordal , ParameterCentripetal , ParameterManhattan }
| Parametrization type. More...

## Public Member Functions
| QwtSplineParametrization (int type)
virtual | ~QwtSplineParametrization ()
| Destructor.
int | type () const
virtual double | valueIncrement (const QPointF &, const QPointF &) const
| Calculate the parameter value increment for 2 points. More...

## Static Public Member Functions
static double | valueIncrementX (const QPointF &, const QPointF &)
| Calculate the ParameterX value increment for 2 points. More...
static double | valueIncrementY (const QPointF &, const QPointF &)
| Calculate the ParameterY value increment for 2 points. More...
static double | valueIncrementUniform (const QPointF &, const QPointF &)
| Calculate the ParameterUniform value increment. More...
static double | valueIncrementChordal (const QPointF &, const QPointF &)
| Calculate the ParameterChordal value increment for 2 points. More...
static double | valueIncrementCentripetal (const QPointF &, const QPointF &)
| Calculate the ParameterCentripetal value increment for 2 points. More...
static double | valueIncrementManhattan (const QPointF &, const QPointF &)
| Calculate the ParameterManhattan value increment for 2 points. More...

## Detailed Description

Curve parametrization used for a spline interpolation.

Parametrization is the process of finding a parameter value for each curve point - usually related to some physical quantity ( distance, time ... ).

Often accumulating the curve length is the intended way of parametrization, but as the interpolated curve is not known in advance an approximation needs to be used.

The values are calculated by cumulating increments, that are provided by QwtSplineParametrization. As the curve parameters need to be montonically increasing, each increment need to be positive.

- t[0] = 0;
- t[i] = t[i-1] + valueIncrement( point[i-1], p[i] );

QwtSplineParametrization provides the most common used type of parametrizations and offers an interface to inject custom implementations.

Note
  The most relevant types of parametrization are trying to provide an approximation of the curve length.

See also
  QwtSpline::setParametrization()

Definition at line 44 of file qwt_spline_parametrization.h.

## Member Enumeration Documentation

## ◆ Type

enum QwtSplineParametrization::Type

Parametrization type.

Enumerator
ParameterX | No parametrization: t[i] = x[i] See also valueIncrementX()
ParameterY | No parametrization: t[i] = y[i] See also valueIncrementY()
ParameterUniform | Uniform parametrization: t[i] = i; A very fast parametrization, with good results, when the geometry of the control points is somehow "equidistant". F.e. when recording the position of a body, that is moving with constant speed every n seconds. See also valueIncrementUniform()
ParameterChordal | Parametrization using the chordal length between two control points The chordal length is the most commonly used approximation for the curve length. See also valueIncrementChordal()
ParameterCentripetal | Centripetal parametrization Based on the square root of the chordal length. Its name stems from the physical observations regarding the centripetal force, of a body moving along the curve. See also valueIncrementCentripetal()
ParameterManhattan | Parametrization using the manhattan length between two control points Approximating the curve length by the manhattan length is faster than the chordal length, but usually gives worse results. See also valueIncrementManhattan()

Definition at line 48 of file qwt_spline_parametrization.h.

## Constructor & Destructor Documentation

## ◆ QwtSplineParametrization()

QwtSplineParametrization::QwtSplineParametrization | ( | int | type | ) |
| explicit

Constructor

Parameters

  type | Parametrization type

See also
  type()

Definition at line 17 of file qwt_spline_parametrization.cpp.

## Member Function Documentation

## ◆ type()

int QwtSplineParametrization::type | ( |  | ) | const

Returns
  Parametrization type

Definition at line 72 of file qwt_spline_parametrization.cpp.

## ◆ valueIncrement()

double QwtSplineParametrization::valueIncrement | ( | const QPointF & | point1,
|  | const QPointF & | point2
| ) |  | const
| virtual

Calculate the parameter value increment for 2 points.

Parameters

  point1 | First point
  point2 | Second point

Returns
  Value increment

Definition at line 35 of file qwt_spline_parametrization.cpp.

## ◆ valueIncrementCentripetal()

double QwtSplineParametrization::valueIncrementCentripetal | ( | const QPointF & | point1,
|  | const QPointF & | point2
| ) |  |
| inlinestatic

Calculate the ParameterCentripetal value increment for 2 points.

Parameters

  point1 | First point
  point2 | Second point

Returns
  The square root of a chordal increment

Definition at line 196 of file qwt_spline_parametrization.h.

## ◆ valueIncrementChordal()

double QwtSplineParametrization::valueIncrementChordal | ( | const QPointF & | point1,
|  | const QPointF & | point2
| ) |  |
| inlinestatic

Calculate the ParameterChordal value increment for 2 points.

Parameters

  point1 | First point
  point2 | Second point

Returns
  qSqrt( dx * dx + dy * dy );

Definition at line 179 of file qwt_spline_parametrization.h.

## ◆ valueIncrementManhattan()

double QwtSplineParametrization::valueIncrementManhattan | ( | const QPointF & | point1,
|  | const QPointF & | point2
| ) |  |
| inlinestatic

Calculate the ParameterManhattan value increment for 2 points.

Parameters

  point1 | First point
  point2 | Second point

Returns
  | point2.x() - point1.x() | + | point2.y() - point1.y() |

Definition at line 210 of file qwt_spline_parametrization.h.

## ◆ valueIncrementUniform()

double QwtSplineParametrization::valueIncrementUniform | ( | const QPointF & | point1,
|  | const QPointF & | point2
| ) |  |
| inlinestatic

Calculate the ParameterUniform value increment.

Parameters

  point1 | First point
  point2 | Second point

Returns
  1.0

Definition at line 162 of file qwt_spline_parametrization.h.

## ◆ valueIncrementX()

double QwtSplineParametrization::valueIncrementX | ( | const QPointF & | point1,
|  | const QPointF & | point2
| ) |  |
| inlinestatic

Calculate the ParameterX value increment for 2 points.

Parameters

  point1 | First point
  point2 | Second point

Returns
  point2.x() - point1.x();

Definition at line 134 of file qwt_spline_parametrization.h.

## ◆ valueIncrementY()

double QwtSplineParametrization::valueIncrementY | ( | const QPointF & | point1,
|  | const QPointF & | point2
| ) |  |
| inlinestatic

Calculate the ParameterY value increment for 2 points.

Parameters

  point1 | First point
  point2 | Second point

Returns
  point2.y() - point1.y();

Definition at line 148 of file qwt_spline_parametrization.h.