source: nanovis/trunk/ContourLineFilter.h @ 5704

Last change on this file since 5704 was 3613, checked in by ldelgass, 7 years ago

Include namespace in header guard defines

  • Property svn:eol-style set to native
File size: 1.6 KB
Line 
1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2#ifndef NV_CONTOURLINEFILTER_H
3#define NV_CONTOURLINEFILTER_H
4
5#include <list>
6#include <vector>
7
8#include <graphics/Geometry.h>
9#include <vrmath/Vector3f.h>
10#include <vrmath/Vector4f.h>
11
12namespace nv {
13
14class ContourLineFilter
15{
16public:
17    class ContourLine
18    {
19    public:
20        ContourLine(float value);
21
22        /**
23         * @return Returns the number of points
24         */
25        int createLine(int width, int height, vrmath::Vector3f *vertices, bool top);
26        int createLine(int width, int height, vrmath::Vector4f *vertices, bool top);
27
28        float _value;
29        std::list<vrmath::Vector3f> _points;
30
31    private:
32        bool isValueWithIn(float v1, float v2)
33        {
34            return ((_value >= v1 && _value <= v2) || 
35                    (_value >= v2 && _value <= v1));
36        }
37        void getContourPoint(int vertexIndex1, int vertexIndex2, vrmath::Vector3f *vertices, int width, bool top);
38        void getContourPoint(int vertexIndex1, int vertexIndex2, vrmath::Vector4f *vertices, int width, bool top);
39    };
40
41    typedef std::list<ContourLine *> ContourLineList;
42    typedef std::vector<vrmath::Vector3f> Vector3fArray;
43
44    ContourLineFilter();
45
46    nv::graphics::Geometry *create(float min, float max, int linecount, vrmath::Vector3f *vertices, int width, int height);
47    nv::graphics::Geometry *create(float min, float max, int linecount, vrmath::Vector4f *vertices, int width, int height);
48
49    void setColorMap(Vector3fArray *colorMap);
50   
51    void setHeightTop(bool top)
52    {
53        _top = top;
54    }
55
56private:
57    void clear();
58
59    ContourLineList _lines;
60    Vector3fArray *_colorMap;
61    bool _top;
62};
63
64}
65
66#endif
Note: See TracBrowser for help on using the repository browser.