1 /*=========================================================================
2 
3   Program:   Visualization Toolkit
4   Module:    vtkParametricRoman.cxx
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 #include "vtkParametricRoman.h"
16 #include "vtkMath.h"
17 #include "vtkObjectFactory.h"
18 
19 vtkStandardNewMacro(vtkParametricRoman);
20 
21 //------------------------------------------------------------------------------
vtkParametricRoman()22 vtkParametricRoman::vtkParametricRoman()
23   : Radius(1)
24 {
25   this->MinimumU = 0;
26   this->MaximumU = vtkMath::Pi();
27   this->MinimumV = 0;
28   this->MaximumV = vtkMath::Pi();
29 
30   this->JoinU = 1;
31   this->JoinV = 1;
32   this->TwistU = 1;
33   this->TwistV = 0;
34   this->ClockwiseOrdering = 0;
35   this->DerivativesAvailable = 1;
36 }
37 
38 //------------------------------------------------------------------------------
39 vtkParametricRoman::~vtkParametricRoman() = default;
40 
41 //------------------------------------------------------------------------------
Evaluate(double uvw[3],double Pt[3],double Duvw[9])42 void vtkParametricRoman::Evaluate(double uvw[3], double Pt[3], double Duvw[9])
43 {
44   double u = uvw[0];
45   double v = uvw[1];
46   double* Du = Duvw;
47   double* Dv = Duvw + 3;
48 
49   double cu = cos(u);
50   double c2u = cos(2.0 * u);
51   double su = sin(u);
52   double s2u = sin(2.0 * u);
53   double cv = cos(v);
54   double cv2 = cv * cv;
55   double c2v = cos(2.0 * v);
56   double s2v = sin(2.0 * v);
57   double sv = sin(v);
58   double a2 = this->Radius * this->Radius;
59 
60   // The point
61   Pt[0] = a2 * cv2 * s2u / 2.0;
62   Pt[1] = a2 * su * s2v / 2.0;
63   Pt[2] = a2 * cu * s2v / 2.0;
64 
65   // The derivatives are:
66   Du[0] = a2 * cv2 * c2u;
67   Du[1] = a2 * cu * s2v / 2.0;
68   Du[2] = -a2 * su * s2v / 2.0;
69   Dv[0] = -a2 * cv * s2u * sv;
70   Dv[1] = a2 * su * c2v;
71   Dv[2] = a2 * cu * c2v;
72 }
73 
74 //------------------------------------------------------------------------------
EvaluateScalar(double * vtkNotUsed (uv[3]),double * vtkNotUsed (Pt[3]),double * vtkNotUsed (Duv[9]))75 double vtkParametricRoman::EvaluateScalar(
76   double* vtkNotUsed(uv[3]), double* vtkNotUsed(Pt[3]), double* vtkNotUsed(Duv[9]))
77 {
78   return 0;
79 }
80 
81 //------------------------------------------------------------------------------
PrintSelf(ostream & os,vtkIndent indent)82 void vtkParametricRoman::PrintSelf(ostream& os, vtkIndent indent)
83 {
84   this->Superclass::PrintSelf(os, indent);
85 
86   os << indent << "Radius: " << this->Radius << "\n";
87 }
88