Commit 51adcdcf authored by Andrew Maclean's avatar Andrew Maclean

ENH: VTK Parametric surfaces - modernised the code.

I created these classes on Feb 08, 2005 and they are showing their age.
The following changes will update them to be more VTK 6 compliant and
 easier to use in ParaView.

 Changes:
    1) Setting names for the scalar, normals and texture coordinate arrays.
        Thereby enabling easier usage in ParaView.
    2) Used vtkSmartPointer where appropriate.
    3) Removed BTX/ETX for the enum, in vtkParametricFunctionSource.h
    3) Prevent out of bounds errors by using vtkSetClampMacro where appropriate.
    4) Updated documentation, changing links and credits where appropriate.

Change-Id: I136e443d57ff4479843f48fc6eb8540475e8f8e2
Signed-off-by: Andrew Maclean's avatarAndrew Maclean <andrew.amaclean@gmail.com>
parent 7a5938f3
......@@ -23,8 +23,8 @@
// in the "VTK Technical Documents" section in the VTk.org web pages.
//
// .SECTION Thanks
// Andrew Maclean a.maclean@cas.edu.au for
// creating and contributing the class.
// Andrew Maclean andrew.amaclean@gmail.com for creating and contributing the
// class.
//
#ifndef __vtkParametricBoy_h
#define __vtkParametricBoy_h
......@@ -56,7 +56,7 @@ public:
// Description:
// Set/Get the scale factor for the z-coordinate.
// Default = 1/8, giving a nice shape.
// Default is 1/8, giving a nice shape.
vtkSetMacro(ZScale,double);
vtkGetMacro(ZScale,double);
......
......@@ -22,7 +22,7 @@
// in the "VTK Technical Documents" section in the VTk.org web pages.
//
// .SECTION Thanks
// Andrew Maclean a.maclean@cas.edu.au for creating and contributing the
// Andrew Maclean andrew.amaclean@gmail.com for creating and contributing the
// class.
//
#ifndef __vtkParametricConicSpiral_h
......@@ -59,20 +59,23 @@ public:
vtkGetMacro(A,double);
// Description:
// Set/Get the A function coefficient (see equation below).
// Default = 1.
// Set/Get the A function coefficient.
// See the definition in Parametric surfaces referred to above.
// Default is 1.
vtkSetMacro(B,double);
vtkGetMacro(B,double);
// Description:
// Set/Get the B function coefficient (see equation below).
// Default = 0.1.
// Set/Get the B function coefficient.
// See the definition in Parametric surfaces referred to above.
// Default is 0.1.
vtkSetMacro(C,double);
vtkGetMacro(C,double);
// Description:
// Set/Get the C function coefficient (see equation below).
// Default = 2.
// Set/Get the C function coefficient.
// See the definition in Parametric surfaces referred to above.
// Default is 2.
vtkSetMacro(N,double);
vtkGetMacro(N,double);
......
......@@ -23,8 +23,8 @@
// in the "VTK Technical Documents" section in the VTk.org web pages.
//
// .SECTION Thanks
// Andrew Maclean a.maclean@cas.edu.au for
// creating and contributing the class.
// Andrew Maclean andrew.amaclean@gmail.com for creating and contributing the
// class.
//
#ifndef __vtkParametricCrossCap_h
#define __vtkParametricCrossCap_h
......
......@@ -71,8 +71,8 @@ void vtkParametricDini::Evaluate(double uvw[3], double Pt[3], double Duvw[9])
double tv2 = tan(0.5*v);
if ( tv2 != 0 )
Dv[2] = this->A*(-sv+(0.5+0.5*tv2*tv2)/tv2);
else
Dv[2] = this->A*(-sv+(0.5+0.5*tv2*tv2)/0.0001); // Avoid division by zero.
else // Avoid division by zero at the singularity.
Dv[2] = this->A*(-sv+0.00005);
}
//----------------------------------------------------------------------------
......
......@@ -23,8 +23,8 @@
// in the "VTK Technical Documents" section in the VTk.org web pages.
//
// .SECTION Thanks
// Andrew Maclean a.maclean@cas.edu.au for
// creating and contributing the class.
// Andrew Maclean andrew.amaclean@gmail.com for creating and contributing the
// class.
//
#ifndef __vtkParametricDini_h
#define __vtkParametricDini_h
......@@ -56,13 +56,15 @@ public:
// Description:
// Set/Get the scale factor.
// Default = 1.
// See the definition in Parametric surfaces referred to above.
// Default is 1.
vtkSetMacro(A,double);
vtkGetMacro(A,double);
// Description:
// Set/Get the scale factor.
// Default = 0.2
// See the definition in Parametric surfaces referred to above.
// Default is 0.2
vtkSetMacro(B,double);
vtkGetMacro(B,double);
......
......@@ -26,7 +26,7 @@
// in the "VTK Technical Documents" section in the VTk.org web pages.
//
// .SECTION Thanks
// Andrew Maclean a.maclean@cas.edu.au for creating and contributing the
// Andrew Maclean andrew.amaclean@gmail.com for creating and contributing the
// class.
//
#ifndef __vtkParametricEllipsoid_h
......@@ -58,17 +58,17 @@ public:
virtual int GetDimension() {return 2;}
// Description:
// Set/Get the scaling factor for the x-axis. Default = 1.
// Set/Get the scaling factor for the x-axis. Default is 1.
vtkSetMacro(XRadius,double);
vtkGetMacro(XRadius,double);
// Description:
// Set/Get the scaling factor for the y-axis. Default = 1.
// Set/Get the scaling factor for the y-axis. Default is 1.
vtkSetMacro(YRadius,double);
vtkGetMacro(YRadius,double);
// Description:
// Set/Get the scaling factor for the z-axis. Default = 1.
// Set/Get the scaling factor for the z-axis. Default is 1.
vtkSetMacro(ZRadius,double);
vtkGetMacro(ZRadius,double);
......
......@@ -23,8 +23,8 @@
// in the "VTK Technical Documents" section in the VTk.org web pages.
//
// .SECTION Thanks
// Andrew Maclean a.maclean@cas.edu.au for
// creating and contributing the class.
// Andrew Maclean andrew.amaclean@gmail.com for creating and contributing the
// class.
//
#ifndef __vtkParametricEnneper_h
#define __vtkParametricEnneper_h
......
......@@ -30,7 +30,7 @@
// in the "VTK Technical Documents" section in the VTk.org web pages.
//
// .SECTION Thanks
// Andrew Maclean a.maclean@cas.edu.au for creating and contributing the
// Andrew Maclean andrew.amaclean@gmail.com for creating and contributing the
// class.
//
#ifndef __vtkParametricFigure8Klein_h
......@@ -57,7 +57,7 @@ public:
static vtkParametricFigure8Klein *New();
// Description:
// Set/Get the radius of the bottle.
// Set/Get the radius of the bottle. Default is 1.
vtkSetMacro(Radius,double);
vtkGetMacro(Radius,double);
......
......@@ -32,7 +32,7 @@
// This class has also methods for defining a range of parametric values (u,v,w).
//
// .SECTION Thanks
// Andrew Maclean a.maclean@cas.edu.au for creating and contributing the
// Andrew Maclean andrew.amaclean@gmail.com for creating and contributing the
// class.
//
// .SECTION See Also
......@@ -123,33 +123,48 @@ public:
// Description:
// Set/Get the flag which joins the first triangle strip to the last one.
vtkSetMacro(JoinU,int);
vtkSetClampMacro(JoinU,int,0,1);
vtkGetMacro(JoinU,int);
vtkBooleanMacro(JoinU,int);
// Description:
// Set/Get the flag which joins the the ends of the triangle strips.
vtkSetMacro(JoinV,int);
vtkGetMacro(JoinV,int);
vtkBooleanMacro(JoinV,int);
vtkSetClampMacro(JoinV, int, 0, 1);
vtkGetMacro(JoinV, int);
vtkBooleanMacro(JoinV, int);
// Description:
// Set/Get the flag which joins the the ends of the triangle strips.
vtkSetClampMacro(JoinW, int, 0, 1);
vtkGetMacro(JoinW, int);
vtkBooleanMacro(JoinW, int);
// Description:
// Set/Get the flag which joins the first triangle strip to
// the last one with a twist.
// JoinU must also be set if this is set. Used when building
// some non-orientable surfaces.
vtkSetMacro(TwistU,int);
// JoinU must also be set if this is set.
// Used when building some non-orientable surfaces.
vtkSetClampMacro(TwistU,int,0,1);
vtkGetMacro(TwistU,int);
vtkBooleanMacro(TwistU,int);
// Description:
// Set/Get the flag which joins the ends of the
// triangle strips with a twist.
// JoinV must also be set if this is set. Used when building
// some non-orientable surfaces.
vtkSetMacro(TwistV,int);
vtkGetMacro(TwistV,int);
vtkBooleanMacro(TwistV,int);
// JoinV must also be set if this is set.
// Used when building some non-orientable surfaces.
vtkSetClampMacro(TwistV, int, 0, 1);
vtkGetMacro(TwistV, int);
vtkBooleanMacro(TwistV, int);
// Description:
// Set/Get the flag which joins the ends of the
// triangle strips with a twist.
// JoinW must also be set if this is set.
// Used when building some non-orientable surfaces.
vtkSetClampMacro(TwistW, int, 0, 1);
vtkGetMacro(TwistW, int);
vtkBooleanMacro(TwistW, int);
// Description:
// Set/Get the flag which determines the ordering of the the
......@@ -159,7 +174,7 @@ public:
// lighting. If set, the ordering is clockwise, otherwise the
// ordering is anti-clockwise. Default is true (i.e. clockwise
// ordering).
vtkSetMacro(ClockwiseOrdering,int);
vtkSetClampMacro(ClockwiseOrdering,int,0,1);
vtkGetMacro(ClockwiseOrdering,int);
vtkBooleanMacro(ClockwiseOrdering,int);
......@@ -167,7 +182,7 @@ public:
// Set/Get the flag which determines whether derivatives are available
// from the parametric function (i.e., whether the Evaluate() method
// returns valid derivatives).
vtkSetMacro(DerivativesAvailable,int);
vtkSetClampMacro(DerivativesAvailable,int,0,1);
vtkGetMacro(DerivativesAvailable,int);
vtkBooleanMacro(DerivativesAvailable,int);
......
......@@ -30,7 +30,7 @@
// in the "VTK Technical Documents" section in the VTk.org web pages.
//
// .SECTION Thanks
// Andrew Maclean a.maclean@cas.edu.au for creating and contributing the
// Andrew Maclean andrew.amaclean@gmail.com for creating and contributing the
// class.
//
#ifndef __vtkParametricKlein_h
......
......@@ -21,7 +21,7 @@
// in the "VTK Technical Documents" section in the VTk.org web pages.
//
// .SECTION Thanks
// Andrew Maclean a.maclean@cas.edu.au for creating and contributing the
// Andrew Maclean andrew.amaclean@gmail.com for creating and contributing the
// class.
//
#ifndef __vtkParametricMobius_h
......@@ -48,7 +48,7 @@ public:
static vtkParametricMobius *New();
// Description:
// Set/Get the radius of the Mobius strip.
// Set/Get the radius of the Mobius strip. Default is 1.
vtkSetMacro(Radius,double);
vtkGetMacro(Radius,double);
......
......@@ -21,8 +21,8 @@
// in the "VTK Technical Documents" section in the VTk.org web pages.
//
// .SECTION Thanks
// Andrew Maclean a.maclean@cas.edu.au for
// creating and contributing the class.
// Andrew Maclean andrew.amaclean@gmail.com for creating and contributing the
// class.
//
#ifndef __vtkParametricRandomHills_h
#define __vtkParametricRandomHills_h
......
......@@ -21,8 +21,8 @@
// in the "VTK Technical Documents" section in the VTk.org web pages.
//
// .SECTION Thanks
// Andrew Maclean a.maclean@cas.edu.au for
// creating and contributing the class.
// Andrew Maclean andrew.amaclean@gmail.com for creating and contributing the
// class.
//
#ifndef __vtkParametricRoman_h
#define __vtkParametricRoman_h
......@@ -53,7 +53,7 @@ public:
static vtkParametricRoman *New();
// Description:
// Set/Get the radius.
// Set/Get the radius. Default is 1.
vtkSetMacro(Radius,double);
vtkGetMacro(Radius,double);
......
......@@ -23,14 +23,14 @@
// technical description "Parametric surfaces" in http://www.vtk.org/documents.php
// in the "VTK Technical Documents" section in the VTk.org web pages.
//
// Also see: http://astronomy.swin.edu.au/~pbourke/surfaces/
// Also see: http://paulbourke.net/geometry/superellipse/
//
// .SECTION Caveats
// Care needs to be taken specifying the bounds correctly. You may need to
// carefully adjust MinimumU, MinimumV, MaximumU, MaximumV.
//
// .SECTION Thanks
// Andrew Maclean a.maclean@cas.edu.au for creating and contributing the
// Andrew Maclean andrew.amaclean@gmail.com for creating and contributing the
// class.
//
#ifndef __vtkParametricSuperEllipsoid_h
......@@ -62,27 +62,27 @@ public:
virtual int GetDimension() {return 2;}
// Description:
// Set/Get the scaling factor for the x-axis. Default = 1.
// Set/Get the scaling factor for the x-axis. Default is 1.
vtkSetMacro(XRadius,double);
vtkGetMacro(XRadius,double);
// Description:
// Set/Get the scaling factor for the y-axis. Default = 1.
// Set/Get the scaling factor for the y-axis. Default is 1.
vtkSetMacro(YRadius,double);
vtkGetMacro(YRadius,double);
// Description:
// Set/Get the scaling factor for the z-axis. Default = 1.
// Set/Get the scaling factor for the z-axis. Default is 1.
vtkSetMacro(ZRadius,double);
vtkGetMacro(ZRadius,double);
// Description:
// Set/Get the "squareness" parameter in the z axis. Default = 1.
// Set/Get the "squareness" parameter in the z axis. Default is 1.
vtkSetMacro(N1,double);
vtkGetMacro(N1,double);
// Description:
// Set/Get the "squareness" parameter in the x-y plane. Default = 1.
// Set/Get the "squareness" parameter in the x-y plane. Default is 1.
vtkSetMacro(N2,double);
vtkGetMacro(N2,double);
......
......@@ -27,14 +27,14 @@
// technical description "Parametric surfaces" in http://www.vtk.org/documents.php
// in the "VTK Technical Documents" section in the VTk.org web pages.
//
// Also see: http://astronomy.swin.edu.au/~pbourke/surfaces/.
// Also see: http://paulbourke.net/geometry/torus/#super.
//
// .SECTION Caveats
// Care needs to be taken specifying the bounds correctly. You may need to
// carefully adjust MinimumU, MinimumV, MaximumU, MaximumV.
//
// .SECTION Thanks
// Andrew Maclean a.maclean@cas.edu.au for creating and contributing the
// Andrew Maclean andrew.amaclean@gmail.com for creating and contributing the
// class.
//
#ifndef __vtkParametricSuperToroid_h
......@@ -68,7 +68,7 @@ public:
// Description:
// Set/Get the radius from the center to the middle of the ring of the
// supertoroid. Default = 1.
// supertoroid. Default is 1.
vtkSetMacro(RingRadius,double);
vtkGetMacro(RingRadius,double);
......@@ -79,27 +79,27 @@ public:
vtkGetMacro(CrossSectionRadius,double);
// Description:
// Set/Get the scaling factor for the x-axis. Default = 1.
// Set/Get the scaling factor for the x-axis. Default is 1.
vtkSetMacro(XRadius,double);
vtkGetMacro(XRadius,double);
// Description:
// Set/Get the scaling factor for the y-axis. Default = 1.
// Set/Get the scaling factor for the y-axis. Default is 1.
vtkSetMacro(YRadius,double);
vtkGetMacro(YRadius,double);
// Description:
// Set/Get the scaling factor for the z-axis. Default = 1.
// Set/Get the scaling factor for the z-axis. Default is 1.
vtkSetMacro(ZRadius,double);
vtkGetMacro(ZRadius,double);
// Description:
// Set/Get the shape of the torus ring. Default = 1.
// Set/Get the shape of the torus ring. Default is 1.
vtkSetMacro(N1,double);
vtkGetMacro(N1,double);
// Description:
// Set/Get the shape of the cross section of the ring. Default = 1.
// Set/Get the shape of the cross section of the ring. Default is 1.
vtkSetMacro(N2,double);
vtkGetMacro(N2,double);
......
......@@ -21,8 +21,8 @@
// in the "VTK Technical Documents" section in the VTk.org web pages.
//
// .SECTION Thanks
// Andrew Maclean a.maclean@cas.edu.au for
// creating and contributing the class.
// Andrew Maclean andrew.amaclean@gmail.com for creating and contributing the
// class.
//
#ifndef __vtkParametricTorus_h
#define __vtkParametricTorus_h
......@@ -50,13 +50,12 @@ public:
// Description:
// Set/Get the radius from the center to the middle of the ring of the
// torus. The default value is 1.0.
// torus. Default is 1.0.
vtkSetMacro(RingRadius,double);
vtkGetMacro(RingRadius,double);
// Description:
// Set/Get the radius of the cross section of ring of the torus. The default value
// is 0.5.
// Set/Get the radius of the cross section of ring of the torus. Default is 0.5.
vtkSetMacro(CrossSectionRadius,double);
vtkGetMacro(CrossSectionRadius,double);
......
......@@ -25,6 +25,7 @@
#include "vtkPolyData.h"
#include "vtkInformation.h"
#include "vtkInformationVector.h"
#include "vtkSmartPointer.h"
#include <math.h>
#include <string>
......@@ -230,8 +231,8 @@ int vtkParametricFunctionSource::RequestData(vtkInformation *vtkNotUsed(info),
void vtkParametricFunctionSource::Produce1DOutput(vtkInformationVector *output)
{
vtkIdType numPts = this->UResolution + 1;
vtkCellArray *lines = vtkCellArray::New();
vtkPoints *pts = vtkPoints::New();
vtkSmartPointer<vtkCellArray> lines = vtkSmartPointer<vtkCellArray>::New();
vtkSmartPointer<vtkPoints> pts = vtkSmartPointer<vtkPoints>::New();
// Set the desired precision for the points in the output.
if(this->OutputPointsPrecision == vtkAlgorithm::DOUBLE_PRECISION)
......@@ -264,19 +265,18 @@ void vtkParametricFunctionSource::Produce1DOutput(vtkInformationVector *output)
(outInfo->Get( vtkDataObject::DATA_OBJECT() ));
outData->SetPoints(pts);
outData->SetLines(lines);
pts->Delete();
lines->Delete();
}
//----------------------------------------------------------------------------
void vtkParametricFunctionSource::Produce2DOutput(vtkInformationVector *output)
{
// Used to hold the surface
vtkPolyData * pd = vtkPolyData::New();
vtkSmartPointer<vtkPolyData> pd = vtkSmartPointer<vtkPolyData>::New();
// Adjust so the range this->MinimumU ... this->ParametricFunction->GetMaximumU(), this->MinimumV
// ... this->ParametricFunction->GetMaximumV() is included in the triangulation.
// Adjust so the ranges:
// this->MinimumU ... this->ParametricFunction->GetMaximumU(),
// this->MinimumV ... this->ParametricFunction->GetMaximumV()
// are included in the triangulation.
double MaxU = this->ParametricFunction->GetMaximumU() +
(this->ParametricFunction->GetMaximumU() - this->ParametricFunction->GetMinimumU()) /
(this->UResolution-1);
......@@ -288,22 +288,23 @@ void vtkParametricFunctionSource::Produce2DOutput(vtkInformationVector *output)
int totPts = PtsU * PtsV;
// Scalars associated with each point
vtkFloatArray * sval = vtkFloatArray::New();
sval->SetNumberOfTuples( totPts );
vtkSmartPointer<vtkFloatArray> sval = vtkSmartPointer<vtkFloatArray>::New();
sval->SetNumberOfTuples(totPts);
sval->SetName("Scalars");
// The normals to the surface
vtkFloatArray * nval = vtkFloatArray::New();
vtkSmartPointer<vtkFloatArray> nval = vtkSmartPointer<vtkFloatArray>::New();
nval->SetNumberOfComponents(3);
nval->SetNumberOfTuples(totPts);
nval->SetName("Normals");
// Texture coordinates
double tc[2];
vtkFloatArray *newTCoords;
newTCoords = vtkFloatArray::New();
vtkSmartPointer<vtkFloatArray> newTCoords = vtkSmartPointer<vtkFloatArray>::New();
newTCoords->SetNumberOfComponents(2);
newTCoords->Allocate(2*totPts);
newTCoords->SetName("Textures");
vtkPoints * points = vtkPoints::New();
vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
// Set the desired precision for the points in the output.
if(this->OutputPointsPrecision == vtkAlgorithm::DOUBLE_PRECISION)
......@@ -355,6 +356,7 @@ void vtkParametricFunctionSource::Produce2DOutput(vtkInformationVector *output)
uv[0] += uStep;
uv[1] = this->ParametricFunction->GetMinimumV() - vStep;
double tc[2];
if ( this->GenerateTextureCoordinates != 0 )
{
tc[0] = i/MaxI;
......@@ -495,7 +497,7 @@ void vtkParametricFunctionSource::Produce2DOutput(vtkInformationVector *output)
}
// Make the triangle strips
vtkCellArray * strips = vtkCellArray::New();
vtkSmartPointer<vtkCellArray> strips = vtkSmartPointer<vtkCellArray>::New();
// This is now a list of ID's defining the triangles.
this->MakeTriangleStrips ( strips, PtsU, PtsV );
......@@ -513,9 +515,9 @@ void vtkParametricFunctionSource::Produce2DOutput(vtkInformationVector *output)
}
pd->Modified();
vtkTriangleFilter * tri = vtkTriangleFilter::New();
vtkPolyDataNormals * norm = vtkPolyDataNormals::New();
if ( this->ParametricFunction->GetDerivativesAvailable() )
vtkSmartPointer<vtkTriangleFilter> tri = vtkSmartPointer<vtkTriangleFilter>::New();
vtkSmartPointer<vtkPolyDataNormals> norm = vtkSmartPointer<vtkPolyDataNormals>::New();
if (this->ParametricFunction->GetDerivativesAvailable())
{
//Generate polygons from the triangle strips
tri->SetInputData(pd);
......@@ -539,16 +541,6 @@ void vtkParametricFunctionSource::Produce2DOutput(vtkInformationVector *output)
{
outData->GetPointData()->SetTCoords( newTCoords );
}
// Were done, clean up.
points->Delete();
sval->Delete();
nval->Delete();
newTCoords->Delete();
strips->Delete();
pd->Delete();
tri->Delete();
norm->Delete();
}
/*
......
......@@ -19,8 +19,8 @@
// the resolution), and the mode to use to generate scalars.
//
// .SECTION Thanks
// Andrew Maclean a.maclean@cas.edu.au for creating and contributing the
// class.
// Andrew Maclean andrew.amaclean@gmail.com for creating and contributing
// the class.
//
// .SECTION See Also
// vtkParametricFunction
......@@ -65,21 +65,21 @@ public:
// Set/Get the number of subdivisions / tessellations in the u parametric
// direction. Note that the number of tessellant points in the u
// direction is the UResolution + 1.
vtkSetMacro(UResolution,int);
vtkSetClampMacro(UResolution,int,2,VTK_INT_MAX);
vtkGetMacro(UResolution,int);
// Description:
// Set/Get the number of subdivisions / tessellations in the v parametric
// direction. Note that the number of tessellant points in the v
// direction is the VResolution + 1.
vtkSetMacro(VResolution,int);
vtkSetClampMacro(VResolution,int,2,VTK_INT_MAX);
vtkGetMacro(VResolution,int);
// Description:
// Set/Get the number of subdivisions / tessellations in the w parametric
// direction. Note that the number of tessellant points in the w
// direction is the WResolution + 1.
vtkSetMacro(WResolution,int);
vtkSetClampMacro(WResolution,int,2,VTK_INT_MAX);
vtkGetMacro(WResolution,int);
// Description:
......@@ -89,56 +89,37 @@ public:
// whose parametric dimension is 2.
// Note that texturing may fail in some cases.
vtkBooleanMacro(GenerateTextureCoordinates,int);
vtkSetMacro(GenerateTextureCoordinates,int);
vtkSetClampMacro(GenerateTextureCoordinates,int,0,1);
vtkGetMacro(GenerateTextureCoordinates,int);
//BTX
// Description:
// Enumerate the supported scalar generation modes.
// <pre>
// SCALAR_NONE, (default) scalars are not generated.
// SCALAR_U, the scalar is set to the u-value.
// SCALAR_V, the scalar is set to the v-value.
// SCALAR_U0, the scalar is set to 1 if u = (u_max - u_min)/2 = u_avg, 0 otherwise.
// SCALAR_V0, the scalar is set to 1 if v = (v_max - v_min)/2 = v_avg, 0 otherwise.
// SCALAR_U0V0, the scalar is
// set to 1 if u == u_avg, 2 if v == v_avg, 3 if u = u_avg && v = v_avg, 0 otherwise.
// SCALAR_MODULUS, the scalar is set to (sqrt(u*u+v*v)), this is measured relative to (u_avg,v_avg).
// SCALAR_PHASE, the scalar is set to (atan2(v,u)) (in degrees, 0 to 360), this is measured relative to (u_avg,v_avg).
// SCALAR_QUADRANT, the scalar is set to 1, 2, 3 or 4
// depending upon the quadrant of the point (u,v).
// SCALAR_X, the scalar is set to the x-value.
// SCALAR_Y, the scalar is set to the y-value.
// SCALAR_Z, the scalar is set to the z-value.
// SCALAR_DISTANCE, the scalar is set to (sqrt(x*x+y*y+z*z)). I.e. distance from the origin.
// SCALAR_USER_DEFINED, the scalar is set to the value returned from EvaluateScalar().
// </pre>
// Enumerate the supported scalar generation modes.<br>
// SCALAR_NONE - Scalars are not generated (default).<br>
// SCALAR_U - The scalar is set to the u-value.<br>
// SCALAR_V - The scalar is set to the v-value.<br>
// SCALAR_U0 - The scalar is set to 1 if u = (u_max - u_min)/2 = u_avg, 0 otherwise.<br>
// SCALAR_V0 - The scalar is set to 1 if v = (v_max - v_min)/2 = v_avg, 0 otherwise.<br>
// SCALAR_U0V0 - The scalar is
// set to 1 if u == u_avg, 2 if v == v_avg, 3 if u = u_avg && v = v_avg, 0 otherwise.<br>
// SCALAR_MODULUS - The scalar is set to (sqrt(u*u+v*v)), this is measured relative to (u_avg,v_avg).<br>
// SCALAR_PHASE - The scalar is set to (atan2(v,u)) (in degrees, 0 to 360), this is measured relative to (u_avg,v_avg).<br>
// SCALAR_QUADRANT - The scalar is set to 1, 2, 3 or 4.<br>
// depending upon the quadrant of the point (u,v).<br>
// SCALAR_X - The scalar is set to the x-value.<br>
// SCALAR_Y - The scalar is set to the y-value.<br>
// SCALAR_Z - The scalar is set to the z-value.<br>
// SCALAR_DISTANCE - The scalar is set to (sqrt(x*x+y*y+z*z)). I.e. distance from the origin.<br>
// SCALAR_USER_DEFINED - The scalar is set to the value returned from EvaluateScalar().<br>
enum SCALAR_MODE { SCALAR_NONE = 0,
SCALAR_U, SCALAR_V,
SCALAR_U0, SCALAR_V0, SCALAR_U0V0,
SCALAR_MODULUS, SCALAR_PHASE, SCALAR_QUADRANT,
SCALAR_X, SCALAR_Y, SCALAR_Z, SCALAR_DISTANCE,
SCALAR_FUNCTION_DEFINED };
//ETX
// Description:
// Get/Set the mode used for the scalar data. The options are:
// SCALAR_NONE, (default) scalars are not generated.
// SCALAR_U, the scalar is set to the u-value.
// SCALAR_V, the scalar is set to the v-value.
// SCALAR_U0, the scalar is set to 1 if u = (u_max - u_min)/2 = u_avg, 0 otherwise.
// SCALAR_V0, the scalar is set to 1 if v = (v_max - v_min)/2 = v_avg, 0 otherwise.
// SCALAR_U0V0, the scalar is
// set to 1 if u == u_avg, 2 if v == v_avg, 3 if u = u_avg && v = v_avg, 0 otherwise.
// SCALAR_MODULUS, the scalar is set to (sqrt(u*u+v*v)), this is measured relative to (u_avg,v_avg).
// SCALAR_PHASE, the scalar is set to (atan2(v,u)) (in degrees, 0 to 360), this is measured relative to (u_avg,v_avg).
// SCALAR_QUADRANT, the scalar is set to 1, 2, 3 or 4
// depending upon the quadrant of the point (u,v).
// SCALAR_X, the scalar is set to the x-value.
// SCALAR_Y, the scalar is set to the y-value.
// SCALAR_Z, the scalar is set to the z-value.
// SCALAR_DISTANCE, the scalar is set to (sqrt(x*x+y*y+z*z)). I.e. distance from the origin.
// SCALAR_FUNCTION_DEFINED, the scalar is set to the value returned from EvaluateScalar().
// Get/Set the mode used for the scalar data.
// See SCALAR_MODE for a description of the types of scalars generated.
vtkSetClampMacro(ScalarMode, int, SCALAR_NONE, SCALAR_FUNCTION_DEFINED);
vtkGetMacro(ScalarMode, int);
void SetScalarModeToNone( void ) {this->SetScalarMode(SCALAR_NONE);}
......@@ -162,8 +143,8 @@ public:
// Description:
// Set/get the desired precision for the output points.
// vtkAlgorithm::SINGLE_PRECISION - Output single-precision floating point.
// vtkAlgorithm::DOUBLE_PRECISION - Output double-precision floating point.
// See the documentation for the vtkAlgorithm::Precision enum for an
// explanation of the available precision settings.
vtkSetMacro(OutputPointsPrecision,int);
vtkGetMacro(OutputPointsPrecision,int);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment