source: trunk/packages/vizservers/vtkvis/RpStreamlines.h @ 2352

Last change on this file since 2352 was 2349, checked in by ldelgass, 13 years ago

Add disk and filled regular polygon streamline seed sources, allow rotating
polygon seed about its normal. Also, add implementation of relative quat
rotations of camera and add flag to control relative v. absolute.

  • Property svn:eol-style set to native
File size: 3.3 KB
Line 
1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/*
3 * Copyright (C) 2011, Purdue Research Foundation
4 *
5 * Author: Leif Delgass <ldelgass@purdue.edu>
6 */
7
8#ifndef __RAPPTURE_VTKVIS_STREAMLINES_H__
9#define __RAPPTURE_VTKVIS_STREAMLINES_H__
10
11#include <vtkSmartPointer.h>
12#include <vtkProp.h>
13#include <vtkPlaneCollection.h>
14#include <vtkStreamTracer.h>
15#include <vtkPolyDataAlgorithm.h>
16#include <vtkPolyDataMapper.h>
17#include <vtkLookupTable.h>
18#include <vtkAssembly.h>
19
20#include "RpVtkGraphicsObject.h"
21
22namespace Rappture {
23namespace VtkVis {
24
25/**
26 * \brief Streamline visualization of vector fields
27 *
28 * The DataSet must contain vectors
29 */
30class Streamlines : public VtkGraphicsObject {
31public:
32    enum LineType {
33        LINES,
34        TUBES,
35        RIBBONS
36    };
37
38    Streamlines();
39    virtual ~Streamlines();
40
41    virtual const char *getClassName() const
42    {
43        return "Streamlines";
44    }
45
46    virtual void setLighting(bool state);
47
48    virtual void setOpacity(double opacity);
49
50    virtual void setVisibility(bool state);
51
52    virtual bool getVisibility();
53
54    virtual void setEdgeVisibility(bool state);
55
56    virtual void setEdgeColor(float color[3]);
57
58    virtual void setEdgeWidth(float edgeWidth);
59
60    virtual void setClippingPlanes(vtkPlaneCollection *planes);
61
62    void setSeedToRandomPoints(int numPoints);
63
64    void setSeedToRake(double start[3], double end[3], int numPoints);
65
66    void setSeedToDisk(double center[3], double normal[3],
67                       double radius, double innerRadius, int numPoints);
68
69    void setSeedToPolygon(double center[3], double normal[3],
70                          double angle, double radius,
71                          int numSides);
72
73    void setSeedToFilledPolygon(double center[3], double normal[3],
74                                double angle, double radius,
75                                int numSides, int numPoints);
76
77    void setMaxPropagation(double length);
78
79    void setLineTypeToLines();
80
81    void setLineTypeToTubes(int numSides, double radius);
82
83    void setLineTypeToRibbons(double width, double angle);
84
85    void setLookupTable(vtkLookupTable *lut);
86
87    vtkLookupTable *getLookupTable();
88
89    void setSeedVisibility(bool state);
90
91    void setSeedColor(float color[3]);
92
93private:
94    virtual void initProp();
95    virtual void update();
96
97    static double getRandomNum(double min, double max);
98    static void getRandomPoint(double pt[3], const double bounds[6]);
99    static void getRandomPointInTriangle(double pt[3],
100                                         const double v1[3],
101                                         const double v2[3],
102                                         const double v3[3]);
103    static void getRandomPointOnLineSegment(double pt[3],
104                                            const double endpt[3],
105                                            const double endpt2[3]);
106    static void getRandomCellPt(double pt[3], vtkDataSet *ds);
107
108    LineType _lineType;
109    float _seedColor[3];
110    bool _seedVisible;
111
112    vtkSmartPointer<vtkLookupTable> _lut;
113    vtkSmartPointer<vtkActor> _linesActor;
114    vtkSmartPointer<vtkActor> _seedActor;
115    vtkSmartPointer<vtkStreamTracer> _streamTracer;
116    vtkSmartPointer<vtkPolyDataAlgorithm> _lineFilter;
117    vtkSmartPointer<vtkPolyDataMapper> _pdMapper;
118    vtkSmartPointer<vtkPolyDataMapper> _seedMapper;
119};
120
121}
122}
123
124#endif
Note: See TracBrowser for help on using the repository browser.