source: nanovis/tags/1.1.3/ContourLineFilter.h @ 4833

Last change on this file since 4833 was 3492, checked in by ldelgass, 11 years ago

Fix camera reset for nanovis. Includes refactoring of vector/matrix classes
in nanovis to consolidate into vrmath library. Also add preliminary canonical
view control to clients for testing.

  • 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 CONTOURLINEFILTER_H
3#define 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
12class ContourLineFilter
13{
14public:
15    class ContourLine
16    {
17    public:
18        ContourLine(float value);
19
20        /**
21         * @return Returns the number of points
22         */
23        int createLine(int width, int height, vrmath::Vector3f *vertices, bool top);
24        int createLine(int width, int height, vrmath::Vector4f *vertices, bool top);
25
26        float _value;
27        std::list<vrmath::Vector3f> _points;
28
29    private:
30        bool isValueWithIn(float v1, float v2)
31        {
32            return ((_value >= v1 && _value <= v2) ||
33                    (_value >= v2 && _value <= v1));
34        }
35        void getContourPoint(int vertexIndex1, int vertexIndex2, vrmath::Vector3f *vertices, int width, bool top);
36        void getContourPoint(int vertexIndex1, int vertexIndex2, vrmath::Vector4f *vertices, int width, bool top);
37    };
38
39    typedef std::list<ContourLine *> ContourLineList;
40    typedef std::vector<vrmath::Vector3f> Vector3fArray;
41
42    ContourLineFilter();
43
44    nv::graphics::Geometry *create(float min, float max, int linecount, vrmath::Vector3f *vertices, int width, int height);
45    nv::graphics::Geometry *create(float min, float max, int linecount, vrmath::Vector4f *vertices, int width, int height);
46
47    void setColorMap(Vector3fArray *colorMap);
48   
49    void setHeightTop(bool top)
50    {
51        _top = top;
52    }
53
54private:
55    void clear();
56
57    ContourLineList _lines;
58    Vector3fArray *_colorMap;
59    bool _top;
60};
61
62#endif
Note: See TracBrowser for help on using the repository browser.