aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/math/ranged_value.h
blob: 5a4c35de7641ea58eb583ae07fd8d98e2fc51216 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef __JE_RANGED_VALUE_H__
#define __JE_RANGED_VALUE_H__

#include "../common/types.h"

#include <vector>

namespace JinEngine
{
    namespace Math
    {
        /*
         * y ^
         *   |--------     _
         *   |        \   / \
         *   |         ---   \
         *   |                \
         *   |                 \
         *   +----------------------> x
        */
        class RangedValue
        {
        public:
            RangedValue();

            ///
            /// Points of ranged value.
            /// 
            /// @param points Points.
            /// @param n Number of points.
            ///
            RangedValue(float* points, uint n);

            virtual ~RangedValue() {}

            virtual void addPoint(float x, float y);

            virtual void removePoint(uint i);

            virtual void insertPoint(uint i, float x, float y);

            virtual float getValue(float x);

            virtual void clear();

        private:
            std::vector<float> mXAxis;
            std::vector<float> mYAxis;

            uint mCount;

        };

    }
}

#endif