vtkTextureMapToSphere.h 3.61 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:    vtkTextureMapToSphere.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

=========================================================================*/
// .NAME vtkTextureMapToSphere - generate texture coordinates by mapping points to sphere
// .SECTION Description
Ken Martin's avatar
Ken Martin committed
17 18 19 20
// vtkTextureMapToSphere is a filter that generates 2D texture coordinates by
// mapping input dataset points onto a sphere. The sphere can either be user
// specified or generated automatically. (The sphere is generated
// automatically by computing the center (i.e., averaged coordinates) of the
Bill Lorensen's avatar
Bill Lorensen committed
21
// sphere.)  Note that the generated texture coordinates range between
Ken Martin's avatar
Ken Martin committed
22 23 24 25
// (0,1). The s-coordinate lies in the angular direction around the z-axis,
// measured counter-clockwise from the x-axis. The t-coordinate lies in the
// angular direction measured down from the north pole towards the south
// pole.
Will Schroeder's avatar
Will Schroeder committed
26 27 28 29 30
//
// 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).

Ken Martin's avatar
Ken Martin committed
31 32
// .SECTION Caveats
// The resulting texture coordinates will lie between (0,1), and the texture
Bill Lorensen's avatar
Bill Lorensen committed
33
// coordinates are determined with respect to the modeler's x-y-z coordinate
Ken Martin's avatar
Ken Martin committed
34 35
// system. Use the class vtkTransformTextureCoords to linearly scale and
// shift the origin of the texture coordinates (if necessary).
Will Schroeder's avatar
Will Schroeder committed
36 37

// .SECTION See Also
38
// vtkTextureMapToPlane vtkTextureMapToCylinder
Will Schroeder's avatar
Will Schroeder committed
39 40 41 42 43
// vtkTransformTexture vtkThresholdTextureCoords

#ifndef __vtkTextureMapToSphere_h
#define __vtkTextureMapToSphere_h

44
#include "vtkFiltersTextureModule.h" // For export macro
45
#include "vtkDataSetAlgorithm.h"
Will Schroeder's avatar
Will Schroeder committed
46

47
class VTKFILTERSTEXTURE_EXPORT vtkTextureMapToSphere : public vtkDataSetAlgorithm
Will Schroeder's avatar
Will Schroeder committed
48 49
{
public:
50
  vtkTypeMacro(vtkTextureMapToSphere,vtkDataSetAlgorithm);
51
  void PrintSelf(ostream& os, vtkIndent indent);
Will Schroeder's avatar
Will Schroeder committed
52

Ken Martin's avatar
Ken Martin committed
53 54 55
  // Description:
  // Create object with Center (0,0,0) and the PreventSeam ivar is set to
  // true. The sphere center is automatically computed.
56
  static vtkTextureMapToSphere *New();
Ken Martin's avatar
Ken Martin committed
57

Will Schroeder's avatar
Will Schroeder committed
58 59
  // Description:
  // Specify a point defining the center of the sphere.
Ken Martin's avatar
Ken Martin committed
60 61
  vtkSetVector3Macro(Center,double);
  vtkGetVectorMacro(Center,double,3);
Will Schroeder's avatar
Will Schroeder committed
62 63

  // Description:
Ken Martin's avatar
Ken Martin committed
64 65
  // Turn on/off automatic sphere generation. This means it automatically
  // finds the sphere center.
Will Schroeder's avatar
Will Schroeder committed
66 67 68 69 70
  vtkSetMacro(AutomaticSphereGeneration,int);
  vtkGetMacro(AutomaticSphereGeneration,int);
  vtkBooleanMacro(AutomaticSphereGeneration,int);

  // Description:
Ken Martin's avatar
Ken Martin committed
71 72 73
  // Control how the texture coordinates are generated. If PreventSeam is
  // set, the s-coordinate ranges from 0->1 and 1->0 corresponding to the
  // theta angle variation between 0->180 and 180->0 degrees. Otherwise, the
Bill Lorensen's avatar
Bill Lorensen committed
74
  // s-coordinate ranges from 0->1 between 0->360 degrees.
Will Schroeder's avatar
Will Schroeder committed
75 76 77 78 79
  vtkSetMacro(PreventSeam,int);
  vtkGetMacro(PreventSeam,int);
  vtkBooleanMacro(PreventSeam,int);

protected:
80
  vtkTextureMapToSphere();
81
  ~vtkTextureMapToSphere() {}
82

83
  int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
Will Schroeder's avatar
Will Schroeder committed
84

Ken Martin's avatar
Ken Martin committed
85
  double Center[3];
Will Schroeder's avatar
Will Schroeder committed
86 87 88
  int AutomaticSphereGeneration;
  int PreventSeam;

89 90 91
private:
  vtkTextureMapToSphere(const vtkTextureMapToSphere&);  // Not implemented.
  void operator=(const vtkTextureMapToSphere&);  // Not implemented.
Will Schroeder's avatar
Will Schroeder committed
92 93 94 95 96
};

#endif