Commit 926ff90c authored by Andrew Maclean's avatar Andrew Maclean

ENH: - In the header files, I cleaned up the documentation, converting some...

ENH:   - In the header files, I cleaned up the documentation, converting some equations to LaTex and removing all the equations defining the surfaces. These equations defining the surfaces are now in a white paper along with some supplementary information. I'll put a reference to the white paper in the header files when a decision is made regarding where the white paper will go.  In the cxx files I have made the layout more VTK compliant.
parent 33dd0c97
......@@ -16,9 +16,10 @@
#include "vtkObjectFactory.h"
#include "vtkMath.h"
vtkCxxRevisionMacro(vtkParametricBoy, "1.1");
vtkCxxRevisionMacro(vtkParametricBoy, "1.2");
vtkStandardNewMacro(vtkParametricBoy);
//----------------------------------------------------------------------------
vtkParametricBoy::vtkParametricBoy()
{
// Preset triangulation parameters
......@@ -37,10 +38,12 @@ vtkParametricBoy::vtkParametricBoy()
this->ZScale = 0.125;
}
//----------------------------------------------------------------------------
vtkParametricBoy::~vtkParametricBoy()
{
}
//----------------------------------------------------------------------------
void vtkParametricBoy::Evaluate(double uvw[3], double Pt[3], double Duvw[9])
{
......@@ -95,11 +98,13 @@ void vtkParametricBoy::Evaluate(double uvw[3], double Pt[3], double Duvw[9])
3*Z*X*Y-3*Z2*X-Y3-3/2*Z*Y2-1/2*Z3)*sv;
}
//----------------------------------------------------------------------------
double vtkParametricBoy::EvaluateScalar(double *, double *, double *)
{
return 0;
}
//----------------------------------------------------------------------------
void vtkParametricBoy::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
......
......@@ -55,56 +55,12 @@ public:
vtkGetMacro(ZScale,double);
// Description:
// Boy's surface is a Model of the projective plane without singularities. Found
// by Werner Boy on assignment from David Hilbert.
// Boy's surface.
//
//
// A parametric representation of Boy's surface
// Define:
// - X(u,v) = cos(u)*sin(v)
// - Y(u,v) = sin(u)*sin(v)
// - Z(u,v) = cos(v)
//
// Let:
// - F(u,v) = 1.0/2.0*(2*X^2-Y^2-Z^2+2.0*Y*Z*(Y^2-Z^2)+Z*X*(X^2-Z^2)+X*Y*(Y^2-X^2))
// - G(u,v) = sqrt(3.0)/2.0*(Y^2-Z^2+(Z*X*(Z^2-X^2)+X*Y*(Y^2-X^2)))
// - H(u,v) = (X+Y+Z)*((X+Y+Z)^3+4.0*(Y-X)*(Z-Y)*(X-Z))
//
// Then
// - S(u,v) = (F(u,v),G(u,v),H(u,v)) defines the surface.
//
// where 0 <= u <= pi, 0 <= v <= pi
//
// The derivatives are given by:
// - d(F(u,v)/du = -1/2*X^4-Z^3*X+3*Y^2*X^2-3/2*Z*X^2*Y+3*Z*X*Y^2-
// 3*Y*X-1/2*Y^4+1/2*Z^3*Y
// - d(F(u,v)/dv = (3/2*Z^2*X^2+2*Z*X-1/2*Z^4)*cos(u)+
// (-2*Z*X^3+2*Z*X*Y^2+3*Z^2*Y^2-Z*Y-Z^4)*sin(u)+
// (-1/2*X^3+3/2*Z^2*X-Y^3+3*Z^2*Y+Z)*sin(v)
// - d(G(u,v)/du = -1/2*3^(1/2)*X^4+3*3^(1/2)*Y^2*X^2+3/2*3^(1/2)*Z*X^2*Y+
// 3^(1/2)*Y*X-1/2*3^(1/2)*Y^4-1/2*3^(1/2)*Z^3*Y
// - d(G(u,v)/dv = (-3/2*3^(1/2)*Z^2*X^2+1/2*3^(1/2)*Z^4)*cos(u)+
// (-2*3^(1/2)*Z*X^3+2*3^(1/2)*Z*Y^2*X+3^(1/2)*Z*Y)*sin(u)+
// (1/2*3^(1/2)*X^3-3/2*3^(1/2)*Z^2*X+3^(1/2)*Z)*sin(v)
// - d(H(u,v)/du = X^4+3/2*Z*X^3+3/2*Z^2*X^2+X^3*Y-3*X^2*Y^2+
// 3*Z*X^2*Y-Y^3*X-3/2*Z*Y^3-3/2*Z^2*Y^2-Z^3*Y
// - d(H(u,v)/dv = (1/2*Z*X^3+3/2*Z^3*X+Z^4)*cos(u)+(4*Z*X^3+3*Z*X^2*Y+
// 9/2*Z^2*X^2+9/2*Z^2*X*Y+3*Z^3*X+1/2*Z*Y^3+3*Z^2*Y^2+
// 3/2*Z^3*Y)*sin(u)+(-3/2*X^2*Y-3/2*Z*X^2-3/2*X*Y^2-
// 3*Z*X*Y-3*Z^2*X-Y^3-3/2*Z*Y^2-1/2*Z^3)*sin(v)
//
// Let Du = (dx/du, dy/du, dz/du)
//
// Let Dv = (dx/dv, dy/dv, dz/dv)
//
// Then the normal n = Du X Dv
//
// For the parametric representation, a good representation is found by
// scaling the x,y,z directions by (1,1,1/8).
//
// This function performs the mapping fn(u,v)->(x,y,x), returning it
// This function performs the mapping \f$ f(u,v) \rightarrow (x,y,x) \f$, returning it
// as Pt. It also returns the partial derivatives Du and Dv.
// \f$Pt = (x, y, z), Du = (dx/du, dy/du, dz/du), Dv = (dx/dv, dy/dv, dz/dv)\f$
// \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$.
void Evaluate(double uvw[3], double Pt[3], double Duvw[9]);
// Description:
......@@ -115,7 +71,7 @@ public:
// Pt, Duvw are obtained from Evaluate().
//
// This function is only called if the ScalarMode has the value
// vtkParametricTriangulator::FunctionDefined
// vtkParametricFunctionSource::SCALAR_FUNCTION_DEFINED
//
// If the user does not need to calculate a scalar, then the
// instantiated function should return zero.
......
......@@ -16,9 +16,10 @@
#include "vtkObjectFactory.h"
#include "vtkMath.h"
vtkCxxRevisionMacro(vtkParametricConicSpiral, "1.2");
vtkCxxRevisionMacro(vtkParametricConicSpiral, "1.3");
vtkStandardNewMacro(vtkParametricConicSpiral);
//----------------------------------------------------------------------------
vtkParametricConicSpiral::vtkParametricConicSpiral()
{
// Preset triangulation parameters
......@@ -34,22 +35,19 @@ vtkParametricConicSpiral::vtkParametricConicSpiral()
this->ClockwiseOrdering = 1;
this->DerivativesAvailable = 1;
// Nautilus
//this->A = 0.2;
//this->B = 0.1;
//this->C = 0;
//this->N = 2;
// Spiral
// Conic Spiral
this->A = 0.2;
this->B = 1;
this->C = 0.1;
this->N = 2;
}
//----------------------------------------------------------------------------
vtkParametricConicSpiral::~vtkParametricConicSpiral()
{
}
//----------------------------------------------------------------------------
void vtkParametricConicSpiral::Evaluate(double uvw[3], double Pt[3], double Duvw[9])
{
double u = uvw[0];
......@@ -78,11 +76,13 @@ void vtkParametricConicSpiral::Evaluate(double uvw[3], double Pt[3], double Duvw
Dv[2] = this->B*inv2pi-this->A*inv2pi*su;
}
//----------------------------------------------------------------------------
double vtkParametricConicSpiral::EvaluateScalar(double *, double *, double *)
{
return 0;
}
//----------------------------------------------------------------------------
void vtkParametricConicSpiral::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
......
......@@ -12,7 +12,7 @@
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkParametricConicSpiral - generate conic spiral surfaces that resemble sea-shells.
// .NAME vtkParametricConicSpiral - Generate conic spiral surfaces that resemble sea-shells.
// .SECTION Description
// vtkParametricConicSpiral generates conic spiral surfaces. These can resemble sea shells, or
// may look like a torus "eating" its own tail.
......@@ -71,32 +71,12 @@ public:
vtkGetMacro(N,double);
// Description:
// A parametric representation of a conic spiral surface (i.e., a toroid
// "eating" its own tail) is given by:
// <pre>
// Define:
// - X(u,v) = a*(1-v/(2*pi))*cos(n*v)*(1+cos(u))+c*cos(n*v)
// - Y(u,v) = a*(1-v/(2*pi))*sin(n*v)*(1+cos(u))+c*sin(n*v)
// - Z(u,v) = b*v/(2*pi)+a*(1-v/(2*pi))*sin(u)
// A conic spiral surface.
//
// Where: a=0.2,b=1,c=0.1,n=2,u=0..2*pi},v=0..2*pi
//
// Then
// - S(u,v) = (X(u,v),Y(u,v),Z(u,v)) defines the surface.
//
// The derivatives are given by:
// - d(X(u,v)/du = -a*(1-1/2*v/pi)*cos(n*v)*sin(u)
// - d(X(u,v)/dv = -1/2*a/pi*cos(n*v)*(1+cos(u))-a*(1-1/2*v/pi)*sin(n*v)*n*(1+cos(u))-c*sin(n*v)*n
// - d(Y(u,v)/du = -a*(1-1/2*v/pi)*sin(n*v)*sin(u)
// - d(Y(u,v)/dv = -1/2*a/Pi*sin(n*v)*(1+cos(u))+a*(1-1/2*v/pi)*cos(n*v)*n*(1+cos(u))+c*cos(n*v)*n
// - d(Z(u,v)/du = a*(1-1/2*v/pi)*cos(u)
// - d(Z(u,v)/dv = 1/2*b/pi-1/2*a/pi*sin(u)
//
// Let Du = (dy/du, dy/du, dy/du). Let Dv = (dx/dv, dy/dv, dz/dv). Then the normal n = Du X Dv.
// </pre>
// This function performs the mapping fn(u,v)->(x,y,x), returning it
// This function performs the mapping \f$ f(u,v) \rightarrow (x,y,x) \f$, returning it
// as Pt. It also returns the partial derivatives Du and Dv.
// Pt = (x, y, z), Du = (dx/du, dy/du, dz/du), Dv = (dx/dv, dy/dv, dz/dv)
// \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$.
void Evaluate(double uvw[3], double Pt[3], double Duvw[9]);
// Description:
......@@ -107,7 +87,7 @@ public:
// Pt, Duvw are obtained from Evaluate().
//
// This function is only called if the ScalarMode has the value
// vtkParametricFunctionSource::FunctionDefined.
// vtkParametricFunctionSource::SCALAR_FUNCTION_DEFINED
//
// If the user does not need to calculate a scalar, then the
// instantiated function should return zero.
......
......@@ -16,9 +16,10 @@
#include "vtkObjectFactory.h"
#include "vtkMath.h"
vtkCxxRevisionMacro(vtkParametricCrossCap, "1.1");
vtkCxxRevisionMacro(vtkParametricCrossCap, "1.2");
vtkStandardNewMacro(vtkParametricCrossCap);
//----------------------------------------------------------------------------
vtkParametricCrossCap::vtkParametricCrossCap()
{
// Preset triangulation parameters
......@@ -35,10 +36,12 @@ vtkParametricCrossCap::vtkParametricCrossCap()
this->DerivativesAvailable = 1;
}
//----------------------------------------------------------------------------
vtkParametricCrossCap::~vtkParametricCrossCap()
{
}
//----------------------------------------------------------------------------
void vtkParametricCrossCap::Evaluate(double uvw[3], double Pt[3], double Duvw[9])
{
......@@ -68,11 +71,13 @@ void vtkParametricCrossCap::Evaluate(double uvw[3], double Pt[3], double Duvw[9]
Dv[2] = -2 * cv * sv * (1 + cu * cu);
}
//----------------------------------------------------------------------------
double vtkParametricCrossCap::EvaluateScalar(double *, double *, double *)
{
return 0;
}
//----------------------------------------------------------------------------
void vtkParametricCrossCap::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
......
......@@ -48,33 +48,12 @@ public:
virtual int GetDimension() {return 2;}
// Description:
// A cross-cap is a self intersecting single-sided surface.
// A cross-cap.
//
// The parametric form of the equations for a cross cap are:
// - x = cos(u) * sin(2*v)
// - y = sin(u) * sin(2*v)
// - z = cos(v) * cos(v) - cos(u) * cos(u) * sin(v) * sin(v)
//
// for: 0 <= u <= PI and 0 <= v <= PI
//
// Derivatives are:
// - d(x(u,v))/du = -sin(u) * sin(2*v) = -y
// - d(x(u,v))/dv = 2 * cos(u) * cos(2*v)
// - d(y(u,v))/du = cos(u) * sin(2*v) = x
// - d(y(u,v))/dv = 2 * sin(u) * cos(2*v)
// - d(z(u,v))/du = 2 * cos(u) * sin(u) * sin(v) * sin(v)
// - d(z(u,v))/dv = -2 * cos(v) * sin(v) * (1 + cos(u) * cos(u))
//
// Let Du = (dx/du, dy/du, dz/du)
//
// Let Dv = (dx/dv, dy/dv, dz/dv)
//
// Then the normal n = Du X Dv
//
//
// This function performs the mapping fn(u,v)->(x,y,x), returning it
// This function performs the mapping \f$ f(u,v) \rightarrow (x,y,x) \f$, returning it
// as Pt. It also returns the partial derivatives Du and Dv.
// Pt = (x, y, z), Du = (dx/du, dy/du, dz/du), Dv = (dx/dv, dy/dv, dz/dv)
// \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$.
void Evaluate(double uvw[3], double Pt[3], double Duvw[9]);
// Description:
......@@ -85,7 +64,7 @@ public:
// Pt, Duvw are obtained from Evaluate().
//
// This function is only called if the ScalarMode has the value
// vtkParametricTriangulator::userDefined
// vtkParametricFunctionSource::SCALAR_FUNCTION_DEFINED
//
// If the user does not need to calculate a scalar, then the
// instantiated function should return zero.
......
......@@ -16,9 +16,10 @@
#include "vtkObjectFactory.h"
#include "vtkMath.h"
vtkCxxRevisionMacro(vtkParametricDini, "1.1");
vtkCxxRevisionMacro(vtkParametricDini, "1.2");
vtkStandardNewMacro(vtkParametricDini);
//----------------------------------------------------------------------------
vtkParametricDini::vtkParametricDini()
{
// Preset triangulation parameters
......@@ -38,10 +39,12 @@ vtkParametricDini::vtkParametricDini()
this->B = 0.2;
}
//----------------------------------------------------------------------------
vtkParametricDini::~vtkParametricDini()
{
}
//----------------------------------------------------------------------------
void vtkParametricDini::Evaluate(double uvw[3], double Pt[3], double Duvw[9])
{
......@@ -73,11 +76,13 @@ void vtkParametricDini::Evaluate(double uvw[3], double Pt[3], double Duvw[9])
Dv[2] = this->A*(-sv+(0.5+0.5*tv2*tv2)/0.0001); // Avoid division by zero.
}
//----------------------------------------------------------------------------
double vtkParametricDini::EvaluateScalar(double *, double *, double *)
{
return 0;
}
//----------------------------------------------------------------------------
void vtkParametricDini::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
......
......@@ -61,37 +61,12 @@ public:
vtkGetMacro(B,double);
// Description:
// Dini's surface is an example of a surface that posesses
// constant negative Gaussian curvature.
// Dini's surface.
//
// A parametric representation of Dini's surface
// Define:
// - X(u,v) = a*cos(u)*sin(v)
// - Y(u,v) = a*sin(u)*sin(v)
// - Z(u,v) = a*(cos(v)+log(tan((v/2))))+b*u
//
// Then
// - S(u,v) = (X(u,v),Y(u,v),Z(u,v)) defines the surface.
//
// The derivatives are given by:
// - d(X(u,v)/du = -Y(u,v)
// - d(X(u,v)/dv = a*cos(u)*cos(v)
// - d(Y(u,v)/du = X(u,v)
// - d(Y(u,v)/dv = a*sin(u)*cos(v)
// - d(Z(u,v)/du = b
// - d(Z(u,v)/dv = a*(-sin(v)+(1/2+1/2*tan(1/2*v)^2)/tan(1/2*v))
//
// Let Du = (dy/du, dy/du, dy/du)
//
// Let Dv = (dx/dv, dy/dv, dz/dv)
//
// Then the normal n = Du X Dv
//
// Warning: This function may fail if tan(1/2*v) = 0;
//
// This function performs the mapping fn(u,v)->(x,y,x), returning it
// This function performs the mapping \f$ f(u,v) \rightarrow (x,y,x) \f$, returning it
// as Pt. It also returns the partial derivatives Du and Dv.
// Pt = (x, y, z), Du = (dx/du, dy/du, dz/du), Dv = (dx/dv, dy/dv, dz/dv)
// \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$.
void Evaluate(double uvw[3], double Pt[3], double Duvw[9]);
// Description:
......@@ -102,7 +77,7 @@ public:
// Pt, Duvw are obtained from Evaluate().
//
// This function is only called if the ScalarMode has the value
// vtkParametricTriangulator::userDefined
// vtkParametricFunctionSource::SCALAR_FUNCTION_DEFINED
//
// If the user does not need to calculate a scalar, then the
// instantiated function should return zero.
......
......@@ -17,9 +17,10 @@
#include "vtkMath.h"
#include <math.h>
vtkCxxRevisionMacro(vtkParametricEllipsoid, "1.1");
vtkCxxRevisionMacro(vtkParametricEllipsoid, "1.2");
vtkStandardNewMacro(vtkParametricEllipsoid);
//----------------------------------------------------------------------------
vtkParametricEllipsoid::vtkParametricEllipsoid() :
XRadius(1)
, YRadius(1)
......@@ -39,10 +40,12 @@ vtkParametricEllipsoid::vtkParametricEllipsoid() :
this->DerivativesAvailable = 1;
}
//----------------------------------------------------------------------------
vtkParametricEllipsoid::~vtkParametricEllipsoid()
{
}
//----------------------------------------------------------------------------
void vtkParametricEllipsoid::Evaluate(double uvw[3], double Pt[3], double Duvw[9])
{
double u = uvw[0];
......@@ -75,11 +78,13 @@ void vtkParametricEllipsoid::Evaluate(double uvw[3], double Pt[3], double Duvw[9
}
//----------------------------------------------------------------------------
double vtkParametricEllipsoid::EvaluateScalar(double*, double*, double*)
{
return 0;
}
//----------------------------------------------------------------------------
void vtkParametricEllipsoid::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
......
......@@ -12,9 +12,9 @@
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkParametricEllipsoid - generate a ellipsoid
// .NAME vtkParametricEllipsoid - Generate an ellipsoid.
// .SECTION Description
// vtkParametricEllipsoid generates a ellipsoid.
// vtkParametricEllipsoid generates an ellipsoid.
// If all the radii are the same, we have a sphere.
// An oblate spheroid occurs if RadiusX = RadiusY > RadiusZ.
// Here the Z-axis forms the symmetry axis. To a first
......@@ -68,32 +68,12 @@ public:
vtkGetMacro(ZRadius,double);
// Description:
// The parametric equations for a ellipsoid are:
// <pre>
// - x = rx*sin(v)*cos(u)
// - y = ry*sin(v)*sin(u)
// - z = rz*cos(v)
//
// where:
// - 0 <= u < pi, 0 <= v < pi/2
// - rx, ry, rx are scaling factors
// ( 0 < rx, ry, rz < infinity )
//
// Derivatives:
// - dx/du = -rx*sin(v)*sin(u);
// - dy/du = ry*sin(v)*cos(u);
// - dz/du = 0;
// - dx/dv = rx*cos(v)*cos(u);
// - dy/dv = ry*cos(v)*sin(u);
// - dz/dv = -rz*sin(v);
// </pre>
// Let Du = (dx/du, dy/du, dz/du). Let Dv = (dx/dv, dy/dv, dz/dv). Then the normal n = Du X Dv.
//
// Note that rx, ry, and rz are the scale factors for each axis.
// An ellipsoid.
//
// This function performs the mapping fn(u,v)->(x,y,x), returning it
// This function performs the mapping \f$ f(u,v) \rightarrow (x,y,x) \f$, returning it
// as Pt. It also returns the partial derivatives Du and Dv.
// Pt = (x, y, z), Du = (dx/du, dy/du, dz/du), Dv = (dx/dv, dy/dv, dz/dv)
// \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$.
void Evaluate(double uvw[3], double Pt[3], double Duvw[9]);
// Description:
......@@ -104,7 +84,7 @@ public:
// Pt, Duvw are obtained from Evaluate().
//
// This function is only called if the ScalarMode has the value
// vtkParametricFunction::userDefined
// vtkParametricFunctionSource::SCALAR_FUNCTION_DEFINED
//
// If the user does not need to calculate a scalar, then the
// instantiated function should return zero.
......
......@@ -16,9 +16,10 @@
#include "vtkObjectFactory.h"
#include "vtkMath.h"
vtkCxxRevisionMacro(vtkParametricEnneper, "1.1");
vtkCxxRevisionMacro(vtkParametricEnneper, "1.2");
vtkStandardNewMacro(vtkParametricEnneper);
//----------------------------------------------------------------------------
vtkParametricEnneper::vtkParametricEnneper()
{
// Preset triangulation parameters
......@@ -36,10 +37,12 @@ vtkParametricEnneper::vtkParametricEnneper()
}
//----------------------------------------------------------------------------
vtkParametricEnneper::~vtkParametricEnneper()
{
}
//----------------------------------------------------------------------------
void vtkParametricEnneper::Evaluate(double uvw[3], double Pt[3], double Duvw[9])
{
......@@ -62,11 +65,13 @@ void vtkParametricEnneper::Evaluate(double uvw[3], double Pt[3], double Duvw[9])
Dv[2] = -2*v;
}
//----------------------------------------------------------------------------
double vtkParametricEnneper::EvaluateScalar(double *, double *, double *)
{
return 0;
}
//----------------------------------------------------------------------------
void vtkParametricEnneper::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
......
......@@ -48,45 +48,12 @@ public:
virtual int GetDimension() {return 2;}
// Description:
// Enneper's surface is an example of a self-intersecting minimal
// surface. Enneper's surface is a well-known minimal surface. Though
// it has a fairly uncomplicated parameterization , it is somewhat
// hard to visualize because of its self-intersections. The plot suggests
// the self-intersections exhibited by the surface, but the plot range
// has been kept small enough that the structure of the surface's center
// is also visible.
// Enneper's surface.
//
// Note that the self-intersection curves are subsets of the planes
// y = 0 and x = 0. The surface is a special case of the more general Enneper's
// surface of degree n. These surfaces tend to be even more complicated and
// difficult to visualize.
//
// A parametric representation of Enneper's surface
// Define:
// - X(u,v) = u-u^3/3+u*v^2
// - Y(u,v) = v-v^3/3+v*u^2
// - Z(u,v) = u^2-v^2
//
// Then
// - S(u,v) = (X(u,v),Y(u,v),Z(u,v)) defines the surface.
//
// The derivatives are given by:
// - d(X(u,v)/du = 1-u^2+v^2
// - d(X(u,v)/dv = 2*u*v
// - d(Y(u,v)/du = 2*u*v
// - d(Y(u,v)/dv = 1-v^2+u^2
// - d(Z(u,v)/du = 2*u
// - d(Z(u,v)/dv = -2*v
//
// Let Du = (dy/du, dy/du, dy/du)
//
// Let Dv = (dx/dv, dy/dv, dz/dv)
//
// Then the normal n = Du X Dv
//
// This function performs the mapping fn(u,v)->(x,y,x), returning it
// This function performs the mapping \f$ f(u,v) \rightarrow (x,y,x) \f$, returning it
// as Pt. It also returns the partial derivatives Du and Dv.
// Pt = (x, y, z), Du = (dx/du, dy/du, dz/du), Dv = (dx/dv, dy/dv, dz/dv)
// \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$.
void Evaluate(double uvw[3], double Pt[3], double Duvw[9]);
// Description:
......@@ -97,7 +64,7 @@ public:
// Pt, Duvw are obtained from Evaluate().
//
// This function is only called if the ScalarMode has the value
// vtkParametricTriangulator::userDefined
// vtkParametricFunctionSource::SCALAR_FUNCTION_DEFINED
//
// If the user does not need to calculate a scalar, then the
// instantiated function should return zero.
......
......@@ -16,9 +16,10 @@
#include "vtkObjectFactory.h"
#include "vtkMath.h"
vtkCxxRevisionMacro(vtkParametricFigure8Klein, "1.2");
vtkCxxRevisionMacro(vtkParametricFigure8Klein, "1.3");
vtkStandardNewMacro(vtkParametricFigure8Klein);
//----------------------------------------------------------------------------
vtkParametricFigure8Klein::vtkParametricFigure8Klein()
{
// Preset triangulation parameters
......@@ -36,10 +37,12 @@ vtkParametricFigure8Klein::vtkParametricFigure8Klein()
this->Radius = 1;
}
//----------------------------------------------------------------------------
vtkParametricFigure8Klein::~vtkParametricFigure8Klein()
{
}
//----------------------------------------------------------------------------
void vtkParametricFigure8Klein::Evaluate(double uvw[3], double Pt[3], double Duvw[9])
{
double u = uvw[0];
......@@ -71,11 +74,13 @@ void vtkParametricFigure8Klein::Evaluate(double uvw[3], double Pt[3], double Duv
Dv[2] = su2 * cv / 2 + cu2 * c2v;
}
//----------------------------------------------------------------------------
double vtkParametricFigure8Klein::EvaluateScalar(double*, double*, double*)
{
return 0;
}
//----------------------------------------------------------------------------
void vtkParametricFigure8Klein::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
......
......@@ -12,16 +12,16 @@
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkParametricFigure8Klein - generate a figure-8 Klein bottle
// .NAME vtkParametricFigure8Klein - Generate a figure-8 Klein bottle.
// .SECTION Description
// vtkParametricFigure8Klein generates a figure-8 Klein bottle. A Klein bottle
// is a closed surface with no interior and only one surface. It is
// unrealisable in 3 dimensions without intersecting surfaces. It can be
// realised in 4 dimensions by considering the map G:R^2->R^4 given by:
// realised in 4 dimensions by considering the map \f$ F:R^2 \roghtarrow R^4 \f$ given by:
//
// - G(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$ 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$
//
// This representation of the immersion in R^3 is formed by taking two Mobius
// This representation of the immersion in \f$ R^3 \f$ is formed by taking two Mobius
// strips and joining them along their boundaries, this is the so called
// "Figure-8 Klein Bottle"
......@@ -61,41 +61,12 @@ public:
virtual int GetDimension() {return 2;}
// Description:
// A Klein bottle is a closed surface with no interior and only one
// surface. It is unrealisable in 3 dimensions without intersecting
// surfaces. It can be realised in 4 dimensions by considering the map
// G:R^2->R^4 given by:
// <pre>
// - G(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))
// </pre>
// This representation of the immersion in R^3 is formed by taking two
// Mobius strips and joining them along their boundaries, this the so
// called "Figure-8 Klein Bottle"
//
// The parametric form of the equations for a Klein bottle are:
// <pre>
// - -PI <= u <= PI, -PI <= v <= PI
// - x(u,v) = cos(u)*(a + sin(v)*cos(u/2) - sin(2*v)*sin(u/2)/2)
// - y(u,v) = sin(u)*(a + sin(v)*cos(u/2) - sin(2*v)*sin(u/2)/2)
// - z(u,v) = sin(u/2)*sin(v) + cos(u/2)*sin(2*v)/2
// </pre>
// A Figure-8 Klein bottle.
//
// Derivatives are:
// <pre>
// - d(x(u,v))/du = -Y(u,v)-cos(u)*(2*sin(v)*sin(u/2)+sin(2*v)*cos(u/2))/4
// - d(x(u,v))/dv = cos(u)*(cos(v)*cos(u/2)-cos(2*v)*sin(u/2))
// - d(y(u,v))/du = X(u,v)-sin(u)*(2*sin(v)*sin(u/2)+sin(2*v)*cos(u/2))/4
// - d(y(u,v))/dv = sin(u)*(cos(v)*cos(u/2)-cos(2*v)*sin(u/2))
// - d(z(u,v))/du = cos(u/2)*sin(v)/2-sin(u/2)*sin(2*v)/4
// - d(z(u,v))/dv = sin(u/2)*cos(v)/2+cos(u/2)*cos(2*v)
// </pre>
//
// Let Du = (dx/du, dy/du, dz/du), and let Dv = (dx/dv, dy/dv, dz/dv). Then
// the normal n is Du X Dv.
//
// This function performs the mapping fn(u,v)->(x,y,x), returning it as
// Pt. It also returns the partial derivatives Du and Dv. Pt = (x, y, z),
// Du = (dx/du, dy/du, dz/du), Dv = (dx/dv, dy/dv, dz/dv)
// This function performs the mapping \f$ f(u,v) \rightarrow (x,y,x) \f$, returning it
// as Pt. It also returns the partial derivatives Du and Dv.
// \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$.
virtual void Evaluate(double uvw[3], double Pt[3], double Duvw[9]);
// Description:
......@@ -106,7 +77,7 @@ public:
// Pt, Duvw are obtained from Evaluate().
//
// This function is only called if the ScalarMode has the value
// vtkParametricTriangulator::userDefined
// vtkParametricFunctionSource::SCALAR_FUNCTION_DEFINED
//
// If the user does not need to calculate a scalar, then the
// instantiated function should return zero.
......
......@@ -14,8 +14,9 @@
=========================================================================*/
#include "vtkParametricFunction.h"
vtkCxxRevisionMacro(vtkParametricFunction, "1.1");
vtkCxxRevisionMacro(vtkParametricFunction, "1.2");
//----------------------------------------------------------------------------
vtkParametricFunction::vtkParametricFunction() :
MinimumU(0.0)
, MaximumU(1.0)
......@@ -35,11 +36,13 @@ vtkParametricFunction::vtkParametricFunction() :
}
//----------------------------------------------------------------------------
vtkParametricFunction::~vtkParametricFunction()
{
}
//----------------------------------------------------------------------------
void vtkParametricFunction::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
......
......@@ -43,8 +43,8 @@
// vtkParametricKlein vtkParametricMobius vtkParametricRoman
//
// Implementations of derived classes implementing orientable surfaces:
// vtkParametricConicSpiral vtkParametricDini vtkParametricEnneper
// vtkParametricRandomHills vtkParametricSuperEllipsoid
// vtkParametricConicSpiral vtkParametricDini vtkParametricEllipsoid
// vtkParametricEnneper vtkParametricRandomHills vtkParametricSuperEllipsoid
// vtkParametricSuperToroid vtkParametricTorus
//
#ifndef __vtkParametricFunction_h
......@@ -63,19 +63,21 @@ public:
// then the (u,v,w) parameters and associated information (e.g., derivates)
// have meaning. For example, if the dimension of the function is one, then
// u[0] and Duvw[0...2] have meaning.
// This is a pure virtual function that must be instantiated in
// a derived class.
virtual int GetDimension() = 0;
// Description:
// Calculate Evaluate(uvw)->(Pt,Duvw).
// Performs the mapping (uvw)->(Pt,Duvw).
// This is a pure virtual function that must be instantiated in
// a derived class.
//
// uvw are the parameters, with u corresponding to uvw[0],
// v to uvw[1] and w to uvw[2] respectively. Pt is the returned Cartesian point,
// Duvw are the derivatives of this point with respect to u, v and w.