1 /*=========================================================================
2 
3   Program:   Visualization Toolkit
4   Module:    vtkHedgeHog.h
5 
6   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7   All rights reserved.
8   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10      This software is distributed WITHOUT ANY WARRANTY; without even
11      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12      PURPOSE.  See the above copyright notice for more information.
13 
14 =========================================================================*/
15 // .NAME vtkHedgeHog - create oriented lines from vector data
16 // .SECTION Description
17 // vtkHedgeHog creates oriented lines from the input data set. Line
18 // length is controlled by vector (or normal) magnitude times scale
19 // factor. If VectorMode is UseNormal, normals determine the orientation
20 // of the lines. Lines are colored by scalar data, if available.
21 
22 #ifndef vtkHedgeHog_h
23 #define vtkHedgeHog_h
24 
25 #include "vtkFiltersCoreModule.h" // For export macro
26 #include "vtkPolyDataAlgorithm.h"
27 
28 #define VTK_USE_VECTOR 0
29 #define VTK_USE_NORMAL 1
30 
31 class VTKFILTERSCORE_EXPORT vtkHedgeHog : public vtkPolyDataAlgorithm
32 {
33 public:
34   static vtkHedgeHog *New();
35   vtkTypeMacro(vtkHedgeHog,vtkPolyDataAlgorithm);
36   void PrintSelf(ostream& os, vtkIndent indent);
37 
38   // Description:
39   // Set scale factor to control size of oriented lines.
40   vtkSetMacro(ScaleFactor,double);
41   vtkGetMacro(ScaleFactor,double);
42 
43   // Description:
44   // Specify whether to use vector or normal to perform vector operations.
45   vtkSetMacro(VectorMode,int);
46   vtkGetMacro(VectorMode,int);
SetVectorModeToUseVector()47   void SetVectorModeToUseVector() {this->SetVectorMode(VTK_USE_VECTOR);};
SetVectorModeToUseNormal()48   void SetVectorModeToUseNormal() {this->SetVectorMode(VTK_USE_NORMAL);};
49   const char *GetVectorModeAsString();
50 
51   // Description:
52   // Set/get the desired precision for the output types. See the documentation
53   // for the vtkAlgorithm::DesiredOutputPrecision enum for an explanation of
54   // the available precision settings.
55   vtkSetMacro(OutputPointsPrecision,int);
56   vtkGetMacro(OutputPointsPrecision,int);
57 
58 protected:
59   vtkHedgeHog();
~vtkHedgeHog()60   ~vtkHedgeHog() {}
61 
62   virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
63   virtual int FillInputPortInformation(int port, vtkInformation *info);
64   double ScaleFactor;
65   int VectorMode; // Orient/scale via normal or via vector data
66   int OutputPointsPrecision;
67 
68 private:
69   vtkHedgeHog(const vtkHedgeHog&);  // Not implemented.
70   void operator=(const vtkHedgeHog&);  // Not implemented.
71 };
72 
73 // Description:
74 // Return the vector mode as a character string.
GetVectorModeAsString(void)75 inline const char *vtkHedgeHog::GetVectorModeAsString(void)
76 {
77   if ( this->VectorMode == VTK_USE_VECTOR)
78     {
79     return "UseVector";
80     }
81   else if ( this->VectorMode == VTK_USE_NORMAL)
82     {
83     return "UseNormal";
84     }
85   else
86     {
87     return "Unknown";
88     }
89 }
90 #endif
91