| 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 | #include "qwt_spline_parametrization.h"
|
|---|
| 11 |
|
|---|
| 12 | /*!
|
|---|
| 13 | Constructor
|
|---|
| 14 | \param type Parametrization type
|
|---|
| 15 | \sa type()
|
|---|
| 16 | */
|
|---|
| 17 | QwtSplineParametrization::QwtSplineParametrization( int type )
|
|---|
| 18 | : m_type( type )
|
|---|
| 19 | {
|
|---|
| 20 | }
|
|---|
| 21 |
|
|---|
| 22 | //! Destructor
|
|---|
| 23 | QwtSplineParametrization::~QwtSplineParametrization()
|
|---|
| 24 | {
|
|---|
| 25 | }
|
|---|
| 26 |
|
|---|
| 27 | /*!
|
|---|
| 28 | \brief Calculate the parameter value increment for 2 points
|
|---|
| 29 |
|
|---|
| 30 | \param point1 First point
|
|---|
| 31 | \param point2 Second point
|
|---|
| 32 |
|
|---|
| 33 | \return Value increment
|
|---|
| 34 | */
|
|---|
| 35 | double QwtSplineParametrization::valueIncrement(
|
|---|
| 36 | const QPointF& point1, const QPointF& point2 ) const
|
|---|
| 37 | {
|
|---|
| 38 | switch( m_type )
|
|---|
| 39 | {
|
|---|
| 40 | case QwtSplineParametrization::ParameterX:
|
|---|
| 41 | {
|
|---|
| 42 | return valueIncrementX( point1, point2 );
|
|---|
| 43 | }
|
|---|
| 44 | case QwtSplineParametrization::ParameterY:
|
|---|
| 45 | {
|
|---|
| 46 | return valueIncrementY( point1, point2 );
|
|---|
| 47 | }
|
|---|
| 48 | case QwtSplineParametrization::ParameterCentripetal:
|
|---|
| 49 | {
|
|---|
| 50 | return valueIncrementCentripetal( point1, point2 );
|
|---|
| 51 | }
|
|---|
| 52 | case QwtSplineParametrization::ParameterChordal:
|
|---|
| 53 | {
|
|---|
| 54 | return valueIncrementChordal( point1, point2 );
|
|---|
| 55 | }
|
|---|
| 56 | case QwtSplineParametrization::ParameterManhattan:
|
|---|
| 57 | {
|
|---|
| 58 | return valueIncrementManhattan( point1, point2 );
|
|---|
| 59 | }
|
|---|
| 60 | case QwtSplineParametrization::ParameterUniform:
|
|---|
| 61 | {
|
|---|
| 62 | return valueIncrementUniform( point1, point2 );
|
|---|
| 63 | }
|
|---|
| 64 | default:
|
|---|
| 65 | {
|
|---|
| 66 | return 1;
|
|---|
| 67 | }
|
|---|
| 68 | }
|
|---|
| 69 | }
|
|---|
| 70 |
|
|---|
| 71 | //! \return Parametrization type
|
|---|
| 72 | int QwtSplineParametrization::type() const
|
|---|
| 73 | {
|
|---|
| 74 | return m_type;
|
|---|
| 75 | }
|
|---|