VMTK
Loading...
Searching...
No Matches
vtkvmtkPolyDataManifoldStencil Class Referenceabstract

Serves as the base class for stencils applied to a manifold surface. More...

#include <vtkvmtkPolyDataManifoldStencil.h>

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

Public Types

typedef vtkvmtkStencil Superclass
Public Types inherited from vtkvmtkStencil
typedef vtkvmtkNeighborhood Superclass
Public Types inherited from vtkvmtkNeighborhood
typedef vtkvmtkDataSetItem Superclass
Public Types inherited from vtkvmtkDataSetItem
typedef vtkvmtkItem Superclass
Public Types inherited from vtkvmtkItem
typedef vtkObject Superclass

Public Member Functions

virtual int IsA (const char *type)
vtkvmtkPolyDataManifoldStencil * NewInstance () const
virtual double GetArea ()
virtual void Build () override
virtual void ComputeArea ()
virtual void ScaleWithArea ()=0
void DeepCopy (vtkvmtkPolyDataManifoldStencil *src)
virtual int GetUseExtendedNeighborhood ()
virtual void SetUseExtendedNeighborhood (int)
virtual void UseExtendedNeighborhoodOn ()
virtual void UseExtendedNeighborhoodOff ()
Public Member Functions inherited from vtkvmtkStencil
vtkvmtkStencil * NewInstance () const
vtkIdType GetNumberOfWeights ()
void ScaleWeights (double factor)
const double * GetCenterWeightTuple ()
virtual void DeepCopy (vtkvmtkItem *src) override
virtual void SetNumberOfComponents (vtkIdType)
virtual vtkIdType GetNumberOfComponents ()
double GetWeight (vtkIdType i)
void SetWeight (vtkIdType i, double weight)
double GetWeight (vtkIdType i, vtkIdType component)
void SetWeight (vtkIdType i, vtkIdType component, double weight)
double GetCenterWeight ()
void SetCenterWeight (double weight)
double GetCenterWeight (vtkIdType component)
void SetCenterWeight (vtkIdType component, double weightComponent)
virtual void SetWeightScaling (int)
virtual int GetWeightScaling ()
virtual void WeightScalingOn ()
virtual void WeightScalingOff ()
virtual void SetNegateWeights (int)
virtual int GetNegateWeights ()
virtual void NegateWeightsOn ()
virtual void NegateWeightsOff ()
Public Member Functions inherited from vtkvmtkNeighborhood
vtkvmtkNeighborhood * NewInstance () const
virtual bool GetIsBoundary ()
vtkIdType GetNumberOfPoints ()
vtkIdType GetPointId (vtkIdType i)
vtkIdType * GetPointer (vtkIdType i)
Public Member Functions inherited from vtkvmtkDataSetItem
vtkvmtkDataSetItem * NewInstance () const
void SetDataSet (vtkDataSet *dataSet)
vtkDataSet * GetDataSet ()
virtual void SetDataSetPointId (vtkIdType)
virtual vtkIdType GetDataSetPointId ()
virtual void SetReallocateOnBuild (int)
virtual int GetReallocateOnBuild ()
virtual void ReallocateOnBuildOn ()
virtual void ReallocateOnBuildOff ()
Public Member Functions inherited from vtkvmtkItem
vtkvmtkItem * NewInstance () const
virtual vtkIdType GetItemType ()=0

Static Public Member Functions

static int IsTypeOf (const char *type)
static vtkvmtkPolyDataManifoldStencil * SafeDownCast (vtkObjectBase *o)
Static Public Member Functions inherited from vtkvmtkStencil
static int IsTypeOf (const char *type)
static vtkvmtkStencil * SafeDownCast (vtkObjectBase *o)
Static Public Member Functions inherited from vtkvmtkNeighborhood
static int IsTypeOf (const char *type)
static vtkvmtkNeighborhood * SafeDownCast (vtkObjectBase *o)
Static Public Member Functions inherited from vtkvmtkDataSetItem
static int IsTypeOf (const char *type)
static vtkvmtkDataSetItem * SafeDownCast (vtkObjectBase *o)
Static Public Member Functions inherited from vtkvmtkItem
static int IsTypeOf (const char *type)
static vtkvmtkItem * SafeDownCast (vtkObjectBase *o)

Protected Member Functions

virtual vtkObjectBase * NewInstanceInternal () const
 vtkvmtkPolyDataManifoldStencil ()
 ~vtkvmtkPolyDataManifoldStencil ()
void ScaleWithAreaFactor (double factor)
Protected Member Functions inherited from vtkvmtkStencil
 vtkvmtkStencil ()
 ~vtkvmtkStencil ()
void ResizePointList (vtkIdType ptId, int size)
void ChangeWeightSign ()
Protected Member Functions inherited from vtkvmtkNeighborhood
 vtkvmtkNeighborhood ()
 ~vtkvmtkNeighborhood ()
void ResizePointList (vtkIdType ptId, int size)
Protected Member Functions inherited from vtkvmtkDataSetItem
 vtkvmtkDataSetItem ()
 ~vtkvmtkDataSetItem ()
Protected Member Functions inherited from vtkvmtkItem
 vtkvmtkItem ()
 ~vtkvmtkItem ()

Protected Attributes

double Area
int UseExtendedNeighborhood
Protected Attributes inherited from vtkvmtkStencil
vtkIdType NumberOfComponents
double * Weights
double * CenterWeight
int WeightScaling
int NegateWeights
Protected Attributes inherited from vtkvmtkNeighborhood
vtkIdType NPoints
vtkIdType * PointIds
bool IsBoundary
Protected Attributes inherited from vtkvmtkDataSetItem
vtkDataSet * DataSet
vtkIdType DataSetPointId
int ReallocateOnBuild

Detailed Description

Serves as the base class for stencils applied to a manifold surface.

vtkvmtkPolyDataManifoldStencil is the common base class for the discrete differential-operator stencils in this module (umbrella/Laplacian, Laplace-Beltrami, gradient, ...) that operate on a point of a manifold triangulated surface (vtkPolyData). Build() constructs the underlying one-ring neighborhood (vtkvmtkPolyDataManifoldNeighborhood, or vtkvmtkPolyDataManifoldExtendedNeighborhood when UseExtendedNeighborhood is on) for DataSetPointId and allocates the Weights / CenterWeight arrays (see vtkvmtkStencil) that subclasses fill in with operator-specific values; ComputeArea computes the barycentric mixed area of the one-ring (stored in Area, retrievable with GetArea) used by subclasses (via the protected ScaleWithAreaFactor helper, exposed as the pure virtual ScaleWithArea) to normalize their weights.

See also
vtkvmtkPolyDataManifoldNeighborhood, vtkvmtkPolyDataManifoldExtendedNeighborhood, vtkvmtkPolyDataLaplaceBeltramiStencil, vtkvmtkPolyDataGradientStencil, vtkvmtkPolyDataAreaWeightedUmbrellaStencil

Definition at line 45 of file vtkvmtkPolyDataManifoldStencil.h.

Member Typedef Documentation

◆ Superclass

Constructor & Destructor Documentation

◆ vtkvmtkPolyDataManifoldStencil()

vtkvmtkPolyDataManifoldStencil::vtkvmtkPolyDataManifoldStencil ( )
protected

◆ ~vtkvmtkPolyDataManifoldStencil()

vtkvmtkPolyDataManifoldStencil::~vtkvmtkPolyDataManifoldStencil ( )
inlineprotected

Definition at line 95 of file vtkvmtkPolyDataManifoldStencil.h.

95{};

Member Function Documentation

◆ IsTypeOf()

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

◆ IsA()

◆ SafeDownCast()

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

◆ NewInstanceInternal()

virtual vtkObjectBase * vtkvmtkPolyDataManifoldStencil::NewInstanceInternal ( ) const
protectedvirtual

◆ NewInstance()

vtkvmtkPolyDataManifoldStencil * vtkvmtkPolyDataManifoldStencil::NewInstance ( ) const

◆ GetArea()

virtual double vtkvmtkPolyDataManifoldStencil::GetArea ( )
virtual

Get the barycentric mixed area of the point's one-ring neighborhood, as computed by the most recent call to ComputeArea() (normally invoked internally by Build()).

◆ Build()

void vtkvmtkPolyDataManifoldStencil::Build ( )
overridevirtual

Build the stencil.

Implements vtkvmtkStencil.

Reimplemented in vtkvmtkPolyDataAreaWeightedUmbrellaStencil, vtkvmtkPolyDataGradientStencil, vtkvmtkPolyDataLaplaceBeltramiStencil, and vtkvmtkPolyDataUmbrellaStencil.

Definition at line 90 of file vtkvmtkPolyDataManifoldStencil.cxx.

91 {
92 if (this->PointIds && this->Weights && !this->ReallocateOnBuild)
93 {
94 return;
95 }
96
97 vtkIdType i;
98 vtkvmtkPolyDataManifoldNeighborhood *manifoldNeighborhood;
99
100 if (this->UseExtendedNeighborhood)
101 {
103 }
104 else
105 {
106 manifoldNeighborhood = vtkvmtkPolyDataManifoldNeighborhood::New();
107 }
108 manifoldNeighborhood->SetDataSet(this->DataSet);
109 manifoldNeighborhood->SetDataSetPointId(this->DataSetPointId);
110 manifoldNeighborhood->Build();
111
112 this->NPoints = manifoldNeighborhood->GetNumberOfPoints();
113 if (this->PointIds!=NULL)
114 {
115 delete[] this->PointIds;
116 this->PointIds = NULL;
117 }
118 this->PointIds = new vtkIdType[this->NPoints];
119 memcpy(this->PointIds,manifoldNeighborhood->GetPointer(0),this->NPoints*sizeof(vtkIdType));
120
121 this->IsBoundary = manifoldNeighborhood->GetIsBoundary();
122
123 if (this->Weights!=NULL)
124 {
125 delete[] this->Weights;
126 this->Weights = NULL;
127 }
128 this->Weights = new double[this->NumberOfComponents*this->NPoints];
129 for (i=0; i<this->NumberOfComponents*this->NPoints; i++)
130 {
131 this->Weights[i] = 0.0;
132 }
133 this->CenterWeight = new double[this->NumberOfComponents];
134 for (i=0; i<this->NumberOfComponents; i++)
135 {
136 this->CenterWeight[i] = 0.0;
137 }
138
139 manifoldNeighborhood->Delete();
140 }
virtual void SetDataSetPointId(vtkIdType)
void SetDataSet(vtkDataSet *dataSet)
vtkIdType * GetPointer(vtkIdType i)
virtual bool GetIsBoundary()
static vtkvmtkPolyDataManifoldExtendedNeighborhood * New()
static vtkvmtkPolyDataManifoldNeighborhood * New()
double * CenterWeight

◆ ComputeArea()

void vtkvmtkPolyDataManifoldStencil::ComputeArea ( )
virtual

Compute the barycentric mixed area of the point's one-ring neighborhood (sum of the incident triangle areas) and store it in Area. Called internally by Build(); subclasses that need a different area normalization (e.g. a proper Voronoi mixed area) override this method.

Definition at line 41 of file vtkvmtkPolyDataManifoldStencil.cxx.

42 {
43 double point[3], point1[3], point2[3];
44 vtkIdType j, numberOfTriangles;
45
46 if (this->DataSet==NULL)
47 {
48 vtkErrorMacro(<<"No DataSet specified.");
49 return;
50 }
51
52 this->DataSet->GetPoint(this->DataSetPointId,point);
53 this->Area = 0.0;
54
55 if (!this->IsBoundary)
56 {
57 numberOfTriangles = this->NPoints;
58 }
59 else
60 {
61 numberOfTriangles = this->NPoints-1;
62 }
63
64 for (j=0; j<numberOfTriangles; j++)
65 {
66 this->DataSet->GetPoint(this->PointIds[j],point1);
67 this->DataSet->GetPoint(this->PointIds[(j+1)%this->NPoints],point2);
68
69 this->Area += vtkvmtkMath::TriangleArea(point2,point,point1);
70 }
71 }
static double TriangleArea(double point0[3], double point1[3], double point2[3])

◆ ScaleWithArea()

virtual void vtkvmtkPolyDataManifoldStencil::ScaleWithArea ( )
pure virtual

Normalize the stencil's Weights/CenterWeight by the area computed by ComputeArea(), typically via the protected ScaleWithAreaFactor helper. Must be implemented by every concrete stencil subclass; called internally at the end of Build().

Implemented in vtkvmtkPolyDataAreaWeightedUmbrellaStencil, vtkvmtkPolyDataFELaplaceBeltramiStencil, vtkvmtkPolyDataFVFELaplaceBeltramiStencil, vtkvmtkPolyDataGradientStencil, and vtkvmtkPolyDataUmbrellaStencil.

◆ DeepCopy()

void vtkvmtkPolyDataManifoldStencil::DeepCopy ( vtkvmtkPolyDataManifoldStencil * src)

Deep copy the state (including Area) of src into this stencil, in addition to the base class state copied by vtkvmtkStencil::DeepCopy.

Definition at line 142 of file vtkvmtkPolyDataManifoldStencil.cxx.

143 {
144 this->Superclass::DeepCopy(src);
145 this->Area = src->Area;
146 }
virtual void DeepCopy(vtkvmtkItem *src) override

◆ GetUseExtendedNeighborhood()

virtual int vtkvmtkPolyDataManifoldStencil::GetUseExtendedNeighborhood ( )
virtual

Set/get whether Build() uses the extended (second-ring, see vtkvmtkPolyDataManifoldExtendedNeighborhood) rather than plain one-ring neighborhood to construct the stencil. Default: on.

◆ SetUseExtendedNeighborhood()

virtual void vtkvmtkPolyDataManifoldStencil::SetUseExtendedNeighborhood ( int )
virtual

Set/get whether Build() uses the extended (second-ring, see vtkvmtkPolyDataManifoldExtendedNeighborhood) rather than plain one-ring neighborhood to construct the stencil. Default: on.

◆ UseExtendedNeighborhoodOn()

virtual void vtkvmtkPolyDataManifoldStencil::UseExtendedNeighborhoodOn ( )
virtual

Set/get whether Build() uses the extended (second-ring, see vtkvmtkPolyDataManifoldExtendedNeighborhood) rather than plain one-ring neighborhood to construct the stencil. Default: on.

◆ UseExtendedNeighborhoodOff()

virtual void vtkvmtkPolyDataManifoldStencil::UseExtendedNeighborhoodOff ( )
virtual

Set/get whether Build() uses the extended (second-ring, see vtkvmtkPolyDataManifoldExtendedNeighborhood) rather than plain one-ring neighborhood to construct the stencil. Default: on.

◆ ScaleWithAreaFactor()

void vtkvmtkPolyDataManifoldStencil::ScaleWithAreaFactor ( double factor)
protected

Definition at line 73 of file vtkvmtkPolyDataManifoldStencil.cxx.

74 {
75 double scale;
76
77 if (this->Area<VTK_VMTK_DOUBLE_TOL)
78 {
79 scale = 2.0*VTK_VMTK_LARGE_DOUBLE;
80 }
81 else
82 {
83 scale = 1.0 / (this->Area * factor);
84 }
85
86 this->ScaleWeights(scale);
87 }
void ScaleWeights(double factor)
#define VTK_VMTK_DOUBLE_TOL
#define VTK_VMTK_LARGE_DOUBLE

Member Data Documentation

◆ Area

double vtkvmtkPolyDataManifoldStencil::Area
protected

Definition at line 99 of file vtkvmtkPolyDataManifoldStencil.h.

◆ UseExtendedNeighborhood

int vtkvmtkPolyDataManifoldStencil::UseExtendedNeighborhood
protected

Definition at line 101 of file vtkvmtkPolyDataManifoldStencil.h.


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