~ubuntu-branches/ubuntu/breezy/kdemultimedia/breezy

« back to all changes in this revision

Viewing changes to noatun/library/spline.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2005-03-24 04:48:58 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20050324044858-8ff88o9jxej6ii3d
Tags: 4:3.4.0-0ubuntu3
Add kubuntu_02_hide_arts_menu_entries.diff to hide artsbuilder and artscontrol k-menu entries

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
Copyright (C) 1998 J�rgen Hochwald <juergen.hochwald@privat.kkf.net>
 
3
 
 
4
This library is free software; you can redistribute it and/or
 
5
modify it under the terms of the GNU Library General Public
 
6
License as published by the Free Software Foundation; either
 
7
version 2 of the License, or (at your option) any later version.
 
8
 
 
9
This library is distributed in the hope that it will be useful,
 
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
Library General Public License for more details.
 
13
 
 
14
You should have received a copy of the GNU General Public License
 
15
along with this library; see the file COPYING.  If not, write to
 
16
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
17
Boston, MA 02111-1307, USA.
 
18
*/
 
19
 
 
20
 
 
21
 
 
22
#ifndef SPLINE_H
 
23
#define SPLINE_H
 
24
 
 
25
#include <stdlib.h>
 
26
#include <vector>
 
27
 
 
28
class Spline
 
29
{
 
30
        struct Group
 
31
        {
 
32
                double x, y, y2;
 
33
        };
 
34
        
 
35
        std::vector<Spline::Group> mPoints;
 
36
        bool mRecalc;
 
37
        double yp1;
 
38
        double ypn;
 
39
        
 
40
        // stupid AIX[?] compiler won't let me give it a value here
 
41
        static const bool natural;
 
42
 
 
43
public:
 
44
        Spline();
 
45
        Spline(const Spline &copy);
 
46
        
 
47
        Spline &operator =(const Spline &copy);
 
48
        ~Spline();
 
49
        
 
50
        /**
 
51
         * if the curve had @p count points, return them
 
52
         **/
 
53
        std::vector<double> points(int count) const;
 
54
        
 
55
        void add(double x, double y);
 
56
        double spline(double xarg) const;
 
57
        double operator[] (double xarg) const { return spline(xarg); }
 
58
        int numPoints() const { return mPoints.size(); }
 
59
        double x(int num) const;
 
60
        double y(int num) const;
 
61
 
 
62
        void clear();
 
63
        
 
64
private:
 
65
        void calcSpline() const
 
66
        {
 
67
                const_cast<Spline*>(this)->calcSpline();
 
68
        }
 
69
        void calcSpline();
 
70
        
 
71
};
 
72
 
 
73
#endif
 
74