vtkTextureMapToCylinder.h 3.95 KB
Newer Older
Will Schroeder's avatar
Will Schroeder committed
1 2
/*=========================================================================

3
  Program:   Visualization Toolkit
Ken Martin's avatar
Ken Martin committed
4
  Module:    vtkTextureMapToCylinder.h
Will Schroeder's avatar
Will Schroeder committed
5

6
  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 8
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
Will Schroeder's avatar
Will Schroeder committed
9

10 11
     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12
     PURPOSE.  See the above copyright notice for more information.
Will Schroeder's avatar
Will Schroeder committed
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
/**
 * @class   vtkTextureMapToCylinder
 * @brief   generate texture coordinates by mapping points to cylinder
 *
 * vtkTextureMapToCylinder is a filter that generates 2D texture coordinates
 * by mapping input dataset points onto a cylinder. The cylinder can either be
 * user specified or generated automatically. (The cylinder is generated
 * automatically by computing the axis of the cylinder.)  Note that the
 * generated texture coordinates for the s-coordinate ranges from (0-1)
 * (corresponding to angle of 0->360 around axis), while the mapping of
 * the t-coordinate is controlled by the projection of points along the axis.
 *
 * To specify a cylinder manually, you must provide two points that
 * define the axis of the cylinder. The length of the axis will affect the
 * t-coordinates.
 *
 * A special ivar controls how the s-coordinate is generated. If PreventSeam
 * is set to true, the s-texture varies from 0->1 and then 1->0 (corresponding
 * to angles of 0->180 and 180->360).
 *
 * @warning
 * Since the resulting texture s-coordinate will lie between (0,1), and the
 * origin of the texture coordinates is not user-controllable, you may want
 * to use the class vtkTransformTexture to linearly scale and shift the origin
 * of the texture coordinates.
 *
 * @sa
 * vtkTextureMapToPlane vtkTextureMapToSphere
 * vtkTransformTexture vtkThresholdTextureCoords
*/
Will Schroeder's avatar
Will Schroeder committed
45

46 47
#ifndef vtkTextureMapToCylinder_h
#define vtkTextureMapToCylinder_h
Will Schroeder's avatar
Will Schroeder committed
48

49
#include "vtkFiltersTextureModule.h" // For export macro
50
#include "vtkDataSetAlgorithm.h"
Will Schroeder's avatar
Will Schroeder committed
51

52
class VTKFILTERSTEXTURE_EXPORT vtkTextureMapToCylinder : public vtkDataSetAlgorithm
Will Schroeder's avatar
Will Schroeder committed
53 54
{
public:
55
  vtkTypeMacro(vtkTextureMapToCylinder,vtkDataSetAlgorithm);
56
  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
Will Schroeder's avatar
Will Schroeder committed
57

58 59 60 61 62
  /**
   * Create object with cylinder axis parallel to z-axis (points (0,0,-0.5)
   * and (0,0,0.5)). The PreventSeam ivar is set to true. The cylinder is
   * automatically generated.
   */
63
  static vtkTextureMapToCylinder *New();
Ken Martin's avatar
Ken Martin committed
64

65 66 67 68
  //@{
  /**
   * Specify the first point defining the cylinder axis,
   */
Ken Martin's avatar
Ken Martin committed
69 70
  vtkSetVector3Macro(Point1,double);
  vtkGetVectorMacro(Point1,double,3);
71
  //@}
Will Schroeder's avatar
Will Schroeder committed
72

73 74 75 76
  //@{
  /**
   * Specify the second point defining the cylinder axis,
   */
Ken Martin's avatar
Ken Martin committed
77 78
  vtkSetVector3Macro(Point2,double);
  vtkGetVectorMacro(Point2,double,3);
79
  //@}
Will Schroeder's avatar
Will Schroeder committed
80

81 82 83 84 85
  //@{
  /**
   * Turn on/off automatic cylinder generation. This means it automatically
   * finds the cylinder center and axis.
   */
Will Schroeder's avatar
Will Schroeder committed
86 87 88
  vtkSetMacro(AutomaticCylinderGeneration,int);
  vtkGetMacro(AutomaticCylinderGeneration,int);
  vtkBooleanMacro(AutomaticCylinderGeneration,int);
89 90 91 92 93 94 95 96 97
  //@}

  //@{
  /**
   * Control how the texture coordinates are generated. If PreventSeam is
   * set, the s-coordinate ranges from 0->1 and 1->0 corresponding to the
   * angle variation from 0->180 and 180->0. Otherwise, the s-coordinate
   * ranges from 0->1 from 0->360 degrees.
   */
Will Schroeder's avatar
Will Schroeder committed
98 99 100
  vtkSetMacro(PreventSeam,int);
  vtkGetMacro(PreventSeam,int);
  vtkBooleanMacro(PreventSeam,int);
101
  //@}
Will Schroeder's avatar
Will Schroeder committed
102 103

protected:
104
  vtkTextureMapToCylinder();
105
  ~vtkTextureMapToCylinder() VTK_OVERRIDE {}
106

107
  int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) VTK_OVERRIDE;
Will Schroeder's avatar
Will Schroeder committed
108

Ken Martin's avatar
Ken Martin committed
109 110
  double Point1[3];
  double Point2[3];
Will Schroeder's avatar
Will Schroeder committed
111 112 113
  int AutomaticCylinderGeneration;
  int PreventSeam;

114
private:
115
  vtkTextureMapToCylinder(const vtkTextureMapToCylinder&) VTK_DELETE_FUNCTION;
116
  void operator=(const vtkTextureMapToCylinder&) VTK_DELETE_FUNCTION;
Will Schroeder's avatar
Will Schroeder committed
117 118 119 120 121
};

#endif