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

Ken Martin's avatar
Ken Martin committed
3
  Program:   Visualization Toolkit
Ken Martin's avatar
Ken Martin committed
4
  Module:    vtkTextureMapToPlane.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.
Ken Martin's avatar
Ken Martin 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

=========================================================================*/
Ken Martin's avatar
Ken Martin committed
15
// .NAME vtkTextureMapToPlane - generate texture coordinates by mapping points to plane
16
// .SECTION Description
Ken Martin's avatar
Ken Martin committed
17
// vtkTextureMapToPlane is a filter that generates 2D texture coordinates
18 19
// by mapping input dataset points onto a plane. The plane can either be
// user specified or generated automatically. (A least squares method is
20 21
// used to generate the plane automatically.)
//
Ken Martin's avatar
Ken Martin committed
22 23 24 25 26 27 28 29 30 31
// There are two ways you can specify the plane. The first is to provide a
// plane normal. In this case the points are projected to a plane, and the
// points are then mapped into the user specified s-t coordinate range. For
// more control, you can specify a plane with three points: an origin and two
// points defining the two axes of the plane. (This is compatible with the
// vtkPlaneSource.) Using the second method, the SRange and TRange vectors
// are ignored, since the presumption is that the user does not want to scale
// the texture coordinates; and you can adjust the origin and axes points to
// achieve the texture coordinate scaling you need. Note also that using the
// three point method the axes do not have to be orthogonal.
32 33

// .SECTION See Also
34
//  vtkPlaneSource vtkTextureMapToCylinder
Ken Martin's avatar
Ken Martin committed
35
// vtkTextureMapToSphere vtkThresholdTextureCoords
36

37 38
#ifndef vtkTextureMapToPlane_h
#define vtkTextureMapToPlane_h
Will Schroeder's avatar
Will Schroeder committed
39

40
#include "vtkFiltersTextureModule.h" // For export macro
41
#include "vtkDataSetAlgorithm.h"
Will Schroeder's avatar
Will Schroeder committed
42

43
class VTKFILTERSTEXTURE_EXPORT vtkTextureMapToPlane : public vtkDataSetAlgorithm
Will Schroeder's avatar
Will Schroeder committed
44 45
{
public:
46
  vtkTypeMacro(vtkTextureMapToPlane,vtkDataSetAlgorithm);
47
  void PrintSelf(ostream& os, vtkIndent indent);
Will Schroeder's avatar
Will Schroeder committed
48

Ken Martin's avatar
Ken Martin committed
49 50
  // Description:
  // Construct with s,t range=(0,1) and automatic plane generation turned on.
51
  static vtkTextureMapToPlane *New();
Ken Martin's avatar
Ken Martin committed
52

53
  // Description:
Will Schroeder's avatar
Will Schroeder committed
54 55
  // Specify a point defining the origin of the plane. Used in conjunction with
  // the Point1 and Point2 ivars to specify a map plane.
Ken Martin's avatar
Ken Martin committed
56 57
  vtkSetVector3Macro(Origin,double);
  vtkGetVectorMacro(Origin,double,3);
58 59 60

  // Description:
  // Specify a point defining the first axis of the plane.
Ken Martin's avatar
Ken Martin committed
61 62
  vtkSetVector3Macro(Point1,double);
  vtkGetVectorMacro(Point1,double,3);
63 64 65

  // Description:
  // Specify a point defining the second axis of the plane.
Ken Martin's avatar
Ken Martin committed
66 67
  vtkSetVector3Macro(Point2,double);
  vtkGetVectorMacro(Point2,double,3);
68

69
  // Description:
Ken Martin's avatar
Ken Martin committed
70 71 72
  // Specify plane normal. An alternative way to specify a map plane. Using
  // this method, the object will scale the resulting texture coordinate
  // between the SRange and TRange specified.
Ken Martin's avatar
Ken Martin committed
73 74
  vtkSetVector3Macro(Normal,double);
  vtkGetVectorMacro(Normal,double,3);
Will Schroeder's avatar
Will Schroeder committed
75

76 77
  // Description:
  // Specify s-coordinate range for texture s-t coordinate pair.
Ken Martin's avatar
Ken Martin committed
78 79
  vtkSetVector2Macro(SRange,double);
  vtkGetVectorMacro(SRange,double,2);
Will Schroeder's avatar
Will Schroeder committed
80

81 82
  // Description:
  // Specify t-coordinate range for texture s-t coordinate pair.
Ken Martin's avatar
Ken Martin committed
83 84
  vtkSetVector2Macro(TRange,double);
  vtkGetVectorMacro(TRange,double,2);
Will Schroeder's avatar
Will Schroeder committed
85

86 87
  // Description:
  // Turn on/off automatic plane generation.
Ken Martin's avatar
Ken Martin committed
88 89 90
  vtkSetMacro(AutomaticPlaneGeneration,int);
  vtkGetMacro(AutomaticPlaneGeneration,int);
  vtkBooleanMacro(AutomaticPlaneGeneration,int);
Will Schroeder's avatar
Will Schroeder committed
91 92

protected:
93
  vtkTextureMapToPlane();
94
  ~vtkTextureMapToPlane() {}
95

96 97
  int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
  void ComputeNormal(vtkDataSet *output);
98

Ken Martin's avatar
Ken Martin committed
99 100 101 102 103 104
  double Origin[3];
  double Point1[3];
  double Point2[3];
  double Normal[3];
  double SRange[2];
  double TRange[2];
Will Schroeder's avatar
Will Schroeder committed
105
  int AutomaticPlaneGeneration;
106

107 108 109
private:
  vtkTextureMapToPlane(const vtkTextureMapToPlane&);  // Not implemented.
  void operator=(const vtkTextureMapToPlane&);  // Not implemented.
Will Schroeder's avatar
Will Schroeder committed
110 111 112
};

#endif