VMTK
Loading...
Searching...
No Matches
vtkvmtkPolyDataMeanCurvature Class Reference

Compute the mean curvature and mean curvature normals of surface point neighborhoods with a particular stencil applied. More...

#include <vtkvmtkPolyDataMeanCurvature.h>

Inheritance diagram for vtkvmtkPolyDataMeanCurvature:
[legend]
Collaboration diagram for vtkvmtkPolyDataMeanCurvature:
[legend]

Public Types

typedef vtkPolyDataAlgorithm Superclass

Public Member Functions

virtual int IsA (const char *type)
vtkvmtkPolyDataMeanCurvature * NewInstance () const
void PrintSelf (std::ostream &os, vtkIndent indent) override
virtual void SetStencilType (int)
virtual int GetStencilType ()
void SetStencilTypeToUmbrellaStencil ()
void SetStencilTypeToAreaWeightedUmbrellaStencil ()
void SetStencilTypeToFELaplaceBeltramiStencil ()
void SetStencilTypeToFVFELaplaceBeltramiStencil ()
virtual void SetMeanCurvatureScalarsArrayName (const char *)
virtual char * GetMeanCurvatureScalarsArrayName ()
virtual void SetMeanCurvatureNormalsArrayName (const char *)
virtual char * GetMeanCurvatureNormalsArrayName ()
virtual void SetComputeMeanCurvatureScalars (int)
virtual int GetComputeMeanCurvatureScalars ()
virtual void ComputeMeanCurvatureScalarsOn ()
virtual void ComputeMeanCurvatureScalarsOff ()
virtual void SetComputeMeanCurvatureNormals (int)
virtual int GetComputeMeanCurvatureNormals ()
virtual void ComputeMeanCurvatureNormalsOn ()
virtual void ComputeMeanCurvatureNormalsOff ()

Static Public Member Functions

static vtkvmtkPolyDataMeanCurvature * New ()
static int IsTypeOf (const char *type)
static vtkvmtkPolyDataMeanCurvature * SafeDownCast (vtkObjectBase *o)

Protected Member Functions

virtual vtkObjectBase * NewInstanceInternal () const
 vtkvmtkPolyDataMeanCurvature ()
 ~vtkvmtkPolyDataMeanCurvature ()
virtual int RequestData (vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
void ComputePointMeanCurvatureVector (vtkPolyData *input, vtkIdType pointId, double *meanCurvatureVector)
void ReleaseStencils ()

Protected Attributes

char * MeanCurvatureScalarsArrayName
char * MeanCurvatureNormalsArrayName
int StencilType
vtkvmtkStencils * Stencils
int ComputeMeanCurvatureScalars
int ComputeMeanCurvatureNormals

Detailed Description

Compute the mean curvature and mean curvature normals of surface point neighborhoods with a particular stencil applied.

vtkvmtkPolyDataMeanCurvature estimates the discrete mean curvature (and/or the mean curvature normal vector) at every point of an input surface using the mean-curvature-normal identity H*n = 0.5 * L(x), where L is a discrete Laplace-Beltrami operator built as a stencil (vtkvmtkStencils, selected by StencilType) over each point's neighborhood. For every point, the stencil weights are applied to the neighbor and center point coordinates (ComputePointMeanCurvatureVector) to obtain the mean curvature normal vector; its norm is written, when ComputeMeanCurvatureScalars is on, to the point data scalar array named MeanCurvatureScalarsArrayName, and the normalized vector is written, when ComputeMeanCurvatureNormals is on, to the point data vector array named MeanCurvatureNormalsArrayName.

See also
vtkvmtkStencils, vtkvmtkPolyDataLaplaceBeltramiStencil, vtkvmtkPolyDataAreaWeightedUmbrellaStencil

Definition at line 45 of file vtkvmtkPolyDataMeanCurvature.h.

Member Typedef Documentation

◆ Superclass

typedef vtkPolyDataAlgorithm vtkvmtkPolyDataMeanCurvature::Superclass

Definition at line 50 of file vtkvmtkPolyDataMeanCurvature.h.

Constructor & Destructor Documentation

◆ vtkvmtkPolyDataMeanCurvature()

◆ ~vtkvmtkPolyDataMeanCurvature()

vtkvmtkPolyDataMeanCurvature::~vtkvmtkPolyDataMeanCurvature ( )
protected

Definition at line 48 of file vtkvmtkPolyDataMeanCurvature.cxx.

Member Function Documentation

◆ New()

vtkvmtkPolyDataMeanCurvature * vtkvmtkPolyDataMeanCurvature::New ( )
static

◆ IsTypeOf()

int vtkvmtkPolyDataMeanCurvature::IsTypeOf ( const char * type)
static

◆ IsA()

virtual int vtkvmtkPolyDataMeanCurvature::IsA ( const char * type)
virtual

◆ SafeDownCast()

vtkvmtkPolyDataMeanCurvature * vtkvmtkPolyDataMeanCurvature::SafeDownCast ( vtkObjectBase * o)
static

◆ NewInstanceInternal()

virtual vtkObjectBase * vtkvmtkPolyDataMeanCurvature::NewInstanceInternal ( ) const
protectedvirtual

◆ NewInstance()

vtkvmtkPolyDataMeanCurvature * vtkvmtkPolyDataMeanCurvature::NewInstance ( ) const

◆ PrintSelf()

void vtkvmtkPolyDataMeanCurvature::PrintSelf ( std::ostream & os,
vtkIndent indent )
override

Definition at line 191 of file vtkvmtkPolyDataMeanCurvature.cxx.

192{
193 this->Superclass::PrintSelf(os,indent);
194}

◆ SetStencilType()

virtual void vtkvmtkPolyDataMeanCurvature::SetStencilType ( int )
virtual

Set/get the stencil type used to build the discrete Laplace-Beltrami operator at each point: VTK_VMTK_UMBRELLA_STENCIL (uniform-weight umbrella operator), VTK_VMTK_AREA_WEIGHTED_UMBRELLA_STENCIL, VTK_VMTK_FE_LAPLACE_BELTRAMI_STENCIL (cotangent weights with finite-element area normalization, the default), or VTK_VMTK_FVFE_LAPLACE_BELTRAMI_STENCIL (cotangent weights with finite-volume/Voronoi area normalization). See vtkvmtkStencils for the corresponding stencil classes.

◆ GetStencilType()

virtual int vtkvmtkPolyDataMeanCurvature::GetStencilType ( )
virtual

Set/get the stencil type used to build the discrete Laplace-Beltrami operator at each point: VTK_VMTK_UMBRELLA_STENCIL (uniform-weight umbrella operator), VTK_VMTK_AREA_WEIGHTED_UMBRELLA_STENCIL, VTK_VMTK_FE_LAPLACE_BELTRAMI_STENCIL (cotangent weights with finite-element area normalization, the default), or VTK_VMTK_FVFE_LAPLACE_BELTRAMI_STENCIL (cotangent weights with finite-volume/Voronoi area normalization). See vtkvmtkStencils for the corresponding stencil classes.

◆ SetStencilTypeToUmbrellaStencil()

void vtkvmtkPolyDataMeanCurvature::SetStencilTypeToUmbrellaStencil ( )
inline

Set/get the stencil type used to build the discrete Laplace-Beltrami operator at each point: VTK_VMTK_UMBRELLA_STENCIL (uniform-weight umbrella operator), VTK_VMTK_AREA_WEIGHTED_UMBRELLA_STENCIL, VTK_VMTK_FE_LAPLACE_BELTRAMI_STENCIL (cotangent weights with finite-element area normalization, the default), or VTK_VMTK_FVFE_LAPLACE_BELTRAMI_STENCIL (cotangent weights with finite-volume/Voronoi area normalization). See vtkvmtkStencils for the corresponding stencil classes.

Definition at line 64 of file vtkvmtkPolyDataMeanCurvature.h.

virtual void SetStencilType(int)
@ VTK_VMTK_UMBRELLA_STENCIL

◆ SetStencilTypeToAreaWeightedUmbrellaStencil()

void vtkvmtkPolyDataMeanCurvature::SetStencilTypeToAreaWeightedUmbrellaStencil ( )
inline

Set/get the stencil type used to build the discrete Laplace-Beltrami operator at each point: VTK_VMTK_UMBRELLA_STENCIL (uniform-weight umbrella operator), VTK_VMTK_AREA_WEIGHTED_UMBRELLA_STENCIL, VTK_VMTK_FE_LAPLACE_BELTRAMI_STENCIL (cotangent weights with finite-element area normalization, the default), or VTK_VMTK_FVFE_LAPLACE_BELTRAMI_STENCIL (cotangent weights with finite-volume/Voronoi area normalization). See vtkvmtkStencils for the corresponding stencil classes.

Definition at line 66 of file vtkvmtkPolyDataMeanCurvature.h.

◆ SetStencilTypeToFELaplaceBeltramiStencil()

void vtkvmtkPolyDataMeanCurvature::SetStencilTypeToFELaplaceBeltramiStencil ( )
inline

Set/get the stencil type used to build the discrete Laplace-Beltrami operator at each point: VTK_VMTK_UMBRELLA_STENCIL (uniform-weight umbrella operator), VTK_VMTK_AREA_WEIGHTED_UMBRELLA_STENCIL, VTK_VMTK_FE_LAPLACE_BELTRAMI_STENCIL (cotangent weights with finite-element area normalization, the default), or VTK_VMTK_FVFE_LAPLACE_BELTRAMI_STENCIL (cotangent weights with finite-volume/Voronoi area normalization). See vtkvmtkStencils for the corresponding stencil classes.

Definition at line 68 of file vtkvmtkPolyDataMeanCurvature.h.

◆ SetStencilTypeToFVFELaplaceBeltramiStencil()

void vtkvmtkPolyDataMeanCurvature::SetStencilTypeToFVFELaplaceBeltramiStencil ( )
inline

Set/get the stencil type used to build the discrete Laplace-Beltrami operator at each point: VTK_VMTK_UMBRELLA_STENCIL (uniform-weight umbrella operator), VTK_VMTK_AREA_WEIGHTED_UMBRELLA_STENCIL, VTK_VMTK_FE_LAPLACE_BELTRAMI_STENCIL (cotangent weights with finite-element area normalization, the default), or VTK_VMTK_FVFE_LAPLACE_BELTRAMI_STENCIL (cotangent weights with finite-volume/Voronoi area normalization). See vtkvmtkStencils for the corresponding stencil classes.

Definition at line 70 of file vtkvmtkPolyDataMeanCurvature.h.

◆ SetMeanCurvatureScalarsArrayName()

virtual void vtkvmtkPolyDataMeanCurvature::SetMeanCurvatureScalarsArrayName ( const char * )
virtual

Set/get the name of the point data scalar array where the mean curvature magnitude is stored on the output. Required whenever ComputeMeanCurvatureScalars is on.

◆ GetMeanCurvatureScalarsArrayName()

virtual char * vtkvmtkPolyDataMeanCurvature::GetMeanCurvatureScalarsArrayName ( )
virtual

Set/get the name of the point data scalar array where the mean curvature magnitude is stored on the output. Required whenever ComputeMeanCurvatureScalars is on.

◆ SetMeanCurvatureNormalsArrayName()

virtual void vtkvmtkPolyDataMeanCurvature::SetMeanCurvatureNormalsArrayName ( const char * )
virtual

Set/get the name of the point data vector array where the (unit) mean curvature normal is stored on the output. Required whenever ComputeMeanCurvatureNormals is on.

◆ GetMeanCurvatureNormalsArrayName()

virtual char * vtkvmtkPolyDataMeanCurvature::GetMeanCurvatureNormalsArrayName ( )
virtual

Set/get the name of the point data vector array where the (unit) mean curvature normal is stored on the output. Required whenever ComputeMeanCurvatureNormals is on.

◆ SetComputeMeanCurvatureScalars()

virtual void vtkvmtkPolyDataMeanCurvature::SetComputeMeanCurvatureScalars ( int )
virtual

Toggle computation of the mean curvature scalar (magnitude of the mean curvature normal) at each point, written to MeanCurvatureScalarsArrayName. Default: off.

◆ GetComputeMeanCurvatureScalars()

virtual int vtkvmtkPolyDataMeanCurvature::GetComputeMeanCurvatureScalars ( )
virtual

Toggle computation of the mean curvature scalar (magnitude of the mean curvature normal) at each point, written to MeanCurvatureScalarsArrayName. Default: off.

◆ ComputeMeanCurvatureScalarsOn()

virtual void vtkvmtkPolyDataMeanCurvature::ComputeMeanCurvatureScalarsOn ( )
virtual

Toggle computation of the mean curvature scalar (magnitude of the mean curvature normal) at each point, written to MeanCurvatureScalarsArrayName. Default: off.

◆ ComputeMeanCurvatureScalarsOff()

virtual void vtkvmtkPolyDataMeanCurvature::ComputeMeanCurvatureScalarsOff ( )
virtual

Toggle computation of the mean curvature scalar (magnitude of the mean curvature normal) at each point, written to MeanCurvatureScalarsArrayName. Default: off.

◆ SetComputeMeanCurvatureNormals()

virtual void vtkvmtkPolyDataMeanCurvature::SetComputeMeanCurvatureNormals ( int )
virtual

Toggle computation of the (unit) mean curvature normal vector at each point, written to MeanCurvatureNormalsArrayName. Default: off.

◆ GetComputeMeanCurvatureNormals()

virtual int vtkvmtkPolyDataMeanCurvature::GetComputeMeanCurvatureNormals ( )
virtual

Toggle computation of the (unit) mean curvature normal vector at each point, written to MeanCurvatureNormalsArrayName. Default: off.

◆ ComputeMeanCurvatureNormalsOn()

virtual void vtkvmtkPolyDataMeanCurvature::ComputeMeanCurvatureNormalsOn ( )
virtual

Toggle computation of the (unit) mean curvature normal vector at each point, written to MeanCurvatureNormalsArrayName. Default: off.

◆ ComputeMeanCurvatureNormalsOff()

virtual void vtkvmtkPolyDataMeanCurvature::ComputeMeanCurvatureNormalsOff ( )
virtual

Toggle computation of the (unit) mean curvature normal vector at each point, written to MeanCurvatureNormalsArrayName. Default: off.

◆ RequestData()

int vtkvmtkPolyDataMeanCurvature::RequestData ( vtkInformation * ,
vtkInformationVector ** ,
vtkInformationVector *  )
overrideprotectedvirtual

Definition at line 95 of file vtkvmtkPolyDataMeanCurvature.cxx.

99{
100 vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
101 vtkInformation *outInfo = outputVector->GetInformationObject(0);
102
103 vtkPolyData *input = vtkPolyData::SafeDownCast(
104 inInfo->Get(vtkDataObject::DATA_OBJECT()));
105 vtkPolyData *output = vtkPolyData::SafeDownCast(
106 outInfo->Get(vtkDataObject::DATA_OBJECT()));
107
108 vtkIdType pointId, numberOfPoints;
109 double meanCurvatureVector[3], meanCurvature;
110 vtkDoubleArray* meanCurvatureScalarsArray = NULL;
111 vtkDoubleArray* meanCurvatureNormalsArray = NULL;
112
114 {
115 vtkErrorMacro(<< "No mean curvature scalars array name specified!");
116 return 1;
117 }
118
120 {
121 vtkErrorMacro(<< "No mean curvature vectors array name specified!");
122 return 1;
123 }
124
126 this->Stencils->SetItemType(this->StencilType);
127 this->Stencils->SetDataSet(input);
128 this->Stencils->Build();
129
131 {
132 meanCurvatureScalarsArray = vtkDoubleArray::New();
133 meanCurvatureScalarsArray->SetName(this->MeanCurvatureScalarsArrayName);
134 meanCurvatureScalarsArray->SetNumberOfTuples(input->GetNumberOfPoints());
135 meanCurvatureScalarsArray->FillComponent(0,0.0);
136 meanCurvatureScalarsArray->Register(this);
137 meanCurvatureScalarsArray->Delete();
138 }
139
141 {
142 meanCurvatureNormalsArray = vtkDoubleArray::New();
143 meanCurvatureNormalsArray->SetName(this->MeanCurvatureNormalsArrayName);
144 meanCurvatureNormalsArray->SetNumberOfComponents(3);
145 meanCurvatureNormalsArray->SetNumberOfTuples(input->GetNumberOfPoints());
146 meanCurvatureNormalsArray->FillComponent(0,0.0);
147 meanCurvatureNormalsArray->FillComponent(1,0.0);
148 meanCurvatureNormalsArray->FillComponent(2,0.0);
149 meanCurvatureNormalsArray->Register(this);
150 meanCurvatureNormalsArray->Delete();
151 }
152
153 numberOfPoints = input->GetNumberOfPoints();
154
155 for (pointId=0; pointId<numberOfPoints; pointId++)
156 {
157 this->ComputePointMeanCurvatureVector(input,pointId,meanCurvatureVector);
158
160 {
161 meanCurvature = vtkMath::Norm(meanCurvatureVector);
162 meanCurvatureScalarsArray->SetComponent(pointId,0,meanCurvature);
163 }
164
166 {
167 vtkMath::Normalize(meanCurvatureVector);
168 meanCurvatureNormalsArray->SetTuple(pointId,meanCurvatureVector);
169 }
170 }
171
172 output->CopyStructure(input);
173 output->GetPointData()->PassData(input->GetPointData());
174 output->GetCellData()->PassData(input->GetCellData());
175
177 {
178 output->GetPointData()->AddArray(meanCurvatureScalarsArray);
179 output->GetPointData()->SetActiveScalars(this->MeanCurvatureScalarsArrayName);
180 }
181
183 {
184 output->GetPointData()->AddArray(meanCurvatureNormalsArray);
185 output->GetPointData()->SetActiveNormals(this->MeanCurvatureNormalsArrayName);
186 }
187
188 return 1;
189}
void ComputePointMeanCurvatureVector(vtkPolyData *input, vtkIdType pointId, double *meanCurvatureVector)
static vtkvmtkStencils * New()

◆ ComputePointMeanCurvatureVector()

void vtkvmtkPolyDataMeanCurvature::ComputePointMeanCurvatureVector ( vtkPolyData * input,
vtkIdType pointId,
double * meanCurvatureVector )
protected

Definition at line 62 of file vtkvmtkPolyDataMeanCurvature.cxx.

63{
64 double point[3], stencilPoint[3];
65 vtkIdType j;
66 vtkvmtkStencil* stencil;
67
68 meanCurvatureVector[0] = 0.0;
69 meanCurvatureVector[1] = 0.0;
70 meanCurvatureVector[2] = 0.0;
71
72 input->GetPoint(pointId,point);
73
74 stencil = this->Stencils->GetStencil(pointId);
75
76 for (j=0; j<stencil->GetNumberOfPoints(); j++)
77 {
78 input->GetPoint(stencil->GetPointId(j),stencilPoint);
79
80 meanCurvatureVector[0] += stencil->GetWeight(j) * stencilPoint[0];
81 meanCurvatureVector[1] += stencil->GetWeight(j) * stencilPoint[1];
82 meanCurvatureVector[2] += stencil->GetWeight(j) * stencilPoint[2];
83 }
84
85 meanCurvatureVector[0] += stencil->GetCenterWeight() * point[0];
86 meanCurvatureVector[1] += stencil->GetCenterWeight() * point[1];
87 meanCurvatureVector[2] += stencil->GetCenterWeight() * point[2];
88
89 meanCurvatureVector[0] *= 0.5;
90 meanCurvatureVector[1] *= 0.5;
91 meanCurvatureVector[2] *= 0.5;
92
93}
vtkIdType GetPointId(vtkIdType i)
double GetCenterWeight()
double GetWeight(vtkIdType i)

◆ ReleaseStencils()

void vtkvmtkPolyDataMeanCurvature::ReleaseStencils ( )
protected

Definition at line 53 of file vtkvmtkPolyDataMeanCurvature.cxx.

54{
55 if (this->Stencils)
56 {
57 this->Stencils->UnRegister(this);
58 this->Stencils = NULL;
59 }
60}

Member Data Documentation

◆ MeanCurvatureScalarsArrayName

char* vtkvmtkPolyDataMeanCurvature::MeanCurvatureScalarsArrayName
protected

Definition at line 121 of file vtkvmtkPolyDataMeanCurvature.h.

◆ MeanCurvatureNormalsArrayName

char* vtkvmtkPolyDataMeanCurvature::MeanCurvatureNormalsArrayName
protected

Definition at line 122 of file vtkvmtkPolyDataMeanCurvature.h.

◆ StencilType

int vtkvmtkPolyDataMeanCurvature::StencilType
protected

Definition at line 123 of file vtkvmtkPolyDataMeanCurvature.h.

◆ Stencils

vtkvmtkStencils* vtkvmtkPolyDataMeanCurvature::Stencils
protected

Definition at line 124 of file vtkvmtkPolyDataMeanCurvature.h.

◆ ComputeMeanCurvatureScalars

int vtkvmtkPolyDataMeanCurvature::ComputeMeanCurvatureScalars
protected

Definition at line 126 of file vtkvmtkPolyDataMeanCurvature.h.

◆ ComputeMeanCurvatureNormals

int vtkvmtkPolyDataMeanCurvature::ComputeMeanCurvatureNormals
protected

Definition at line 127 of file vtkvmtkPolyDataMeanCurvature.h.


The documentation for this class was generated from the following files: