vtkParametricKlein.h 3.58 KB
Newer Older
1 2 3 4 5
/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkParametricKlein.h

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

10 11
     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 13 14
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
15
// .NAME vtkParametricKlein - Generates a "classical" representation of a Klein bottle.
16
// .SECTION Description
17
// vtkParametricKlein generates a "classical" representation of a Klein
18 19
// bottle.  A Klein bottle is a closed surface with no interior and only one
// surface.  It is unrealisable in 3 dimensions without intersecting
20
// surfaces.  It can be
21
// realised in 4 dimensions by considering the map \f$F:R^2 \rightarrow R^4\f$  given by:
22
//
23
// - \f$f(u,v) = ((r*cos(v)+a)*cos(u),(r*cos(v)+a)*sin(u),r*sin(v)*cos(u/2),r*sin(v)*sin(u/2))\f$
24
//
25
// The classical representation of the immersion in \f$R^3\f$ is returned by this function.
26
//
27
//
28 29
// For further information about this surface, please consult the
// technical description "Parametric surfaces" in http://www.vtk.org/documents.php
30 31
// in the "VTK Technical Documents" section in the VTk.org web pages.
//
32
// .SECTION Thanks
33
// Andrew Maclean andrew.amaclean@gmail.com for creating and contributing the
34 35
// class.
//
36 37
#ifndef vtkParametricKlein_h
#define vtkParametricKlein_h
38

39
#include "vtkCommonComputationalGeometryModule.h" // For export macro
40 41
#include "vtkParametricFunction.h"

42
class VTKCOMMONCOMPUTATIONALGEOMETRY_EXPORT vtkParametricKlein : public vtkParametricFunction
43 44
{
public:
45
  vtkTypeMacro(vtkParametricKlein,vtkParametricFunction);
46
  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
47

48 49
  // Description:
  // Construct a Klein Bottle with the following parameters:
50
  // MinimumU = 0, MaximumU = 2*Pi,
51
  // MinimumV = -Pi, MaximumV = Pi,
52 53
  // JoinU = 0, JoinV = 1,
  // TwistU = 0, TwistV = 0,
54
  // ClockwiseOrdering = 1,
55
  // DerivativesAvailable = 1,
56
  static vtkParametricKlein *New();  //! Initialise the parameters for the Klein bottle
57

58 59
  // Description
  // Return the parametric dimension of the class.
60
  int GetDimension() VTK_OVERRIDE {return 2;}
61 62

  // Description:
63
  // A Klein bottle.
64
  //
65
  // This function performs the mapping \f$f(u,v) \rightarrow (x,y,x)\f$, returning it
66
  // as Pt. It also returns the partial derivatives Du and Dv.
67 68
  // \f$Pt = (x, y, z), Du = (dx/du, dy/du, dz/du), Dv = (dx/dv, dy/dv, dz/dv)\f$ .
  // Then the normal is \f$N = Du X Dv\f$ .
69
  void Evaluate(double uvw[3], double Pt[3], double Duvw[9]) VTK_OVERRIDE;
70 71

  // Description:
72
  // Calculate a user defined scalar using one or all of uvw, Pt, Duvw.
73
  //
74
  // uvw are the parameters with Pt being the the cartesian point,
75 76
  // Duvw are the derivatives of this point with respect to u, v and w.
  // Pt, Duvw are obtained from Evaluate().
77 78
  //
  // This function is only called if the ScalarMode has the value
79
  // vtkParametricFunctionSource::SCALAR_FUNCTION_DEFINED
80
  //
81 82
  // If the user does not need to calculate a scalar, then the
  // instantiated function should return zero.
83
  //
84
  double EvaluateScalar(double uvw[3], double Pt[3], double Duvw[9]) VTK_OVERRIDE;
85 86 87

protected:
  vtkParametricKlein();
88
  ~vtkParametricKlein() VTK_OVERRIDE;
89 90

private:
91
  vtkParametricKlein(const vtkParametricKlein&) VTK_DELETE_FUNCTION;
92
  void operator=(const vtkParametricKlein&) VTK_DELETE_FUNCTION;
93 94 95
};

#endif