1 /*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkParametricBohemianDome.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 "vtkParametricBohemianDome.h"
16 #include "vtkMath.h"
17 #include "vtkObjectFactory.h"
18
19 vtkStandardNewMacro(vtkParametricBohemianDome);
20 //----------------------------------------------------------------------------//
vtkParametricBohemianDome()21 vtkParametricBohemianDome::vtkParametricBohemianDome()
22 : A(0.5)
23 , B(1.5)
24 , C(1.0)
25 {
26 // Preset triangulation parameters
27 this->MinimumU = -vtkMath::Pi();
28 this->MaximumU = vtkMath::Pi();
29 this->MinimumV = -vtkMath::Pi();
30 this->MaximumV = vtkMath::Pi();
31
32 this->JoinU = 1;
33 this->JoinV = 1;
34 this->TwistU = 0;
35 this->TwistV = 1;
36 this->ClockwiseOrdering = 0;
37 this->DerivativesAvailable = 1;
38 }
39
40 //----------------------------------------------------------------------------//
41 vtkParametricBohemianDome::~vtkParametricBohemianDome() = default;
42
43 //----------------------------------------------------------------------------//
Evaluate(double uvw[3],double Pt[3],double Duvw[9])44 void vtkParametricBohemianDome::Evaluate(double uvw[3], double Pt[3], double Duvw[9])
45 {
46 // Copy the parameters out of the vector, for the sake of convenience.
47 double u = uvw[0];
48 double v = uvw[1];
49
50 // We're only going to need the u and v partial derivatives.
51 // The w partial derivatives are not needed.
52 double* Du = Duvw;
53 double* Dv = Duvw + 3;
54
55 // Instead of a bunch of calls to the trig library,
56 // just call it once and store the results.
57 double cosu = cos(u);
58 double sinu = sin(u);
59 double cosv = cos(v);
60 double sinv = sin(v);
61
62 // Location of the point. This parametrization was taken from:
63 // http://mathworld.wolfram.com/BohemianDome.html
64 Pt[0] = this->A * cosu;
65 Pt[1] = this->A * sinu + this->B * cosv;
66 Pt[2] = this->C * sinv;
67
68 // The derivative with respect to u:
69 Du[0] = -this->A * sinu;
70 Du[1] = this->A * cosu;
71 Du[2] = 0.;
72
73 // The derivative with respect to v:
74 Dv[0] = 0.;
75 Dv[1] = -this->B * sinv;
76 Dv[2] = this->C * cosv;
77 }
78
79 //----------------------------------------------------------------------------//
EvaluateScalar(double *,double *,double *)80 double vtkParametricBohemianDome::EvaluateScalar(double*, double*, double*)
81 {
82 return 0;
83 }
84
85 //----------------------------------------------------------------------------//
PrintSelf(ostream & os,vtkIndent indent)86 void vtkParametricBohemianDome::PrintSelf(ostream& os, vtkIndent indent)
87 {
88 this->Superclass::PrintSelf(os, indent);
89 }
90