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

Apply LB weighting to the neighborhood connections of a surface. More...

#include <vtkvmtkPolyDataLaplaceBeltramiStencil.h>

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

Public Types

typedef vtkvmtkPolyDataManifoldStencil Superclass
Public Types inherited from vtkvmtkPolyDataManifoldStencil
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)
vtkvmtkPolyDataLaplaceBeltramiStencil * NewInstance () const
void Build () override
void BuildBoundaryWeights (vtkIdType boundaryPointId, vtkIdType boundaryNeighborPointId, double &boundaryWeight, double &boundaryNeighborWeight)
Public Member Functions inherited from vtkvmtkPolyDataManifoldStencil
vtkvmtkPolyDataManifoldStencil * NewInstance () const
virtual double GetArea ()
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 vtkvmtkPolyDataLaplaceBeltramiStencil * SafeDownCast (vtkObjectBase *o)
Static Public Member Functions inherited from vtkvmtkPolyDataManifoldStencil
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
 vtkvmtkPolyDataLaplaceBeltramiStencil ()
 ~vtkvmtkPolyDataLaplaceBeltramiStencil ()
Protected Member Functions inherited from vtkvmtkPolyDataManifoldStencil
 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 ()

Additional Inherited Members

Protected Attributes inherited from vtkvmtkPolyDataManifoldStencil
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

Apply LB weighting to the neighborhood connections of a surface.

vtkvmtkPolyDataLaplaceBeltramiStencil builds, for each mesh point, the classic cotangent-weight discrete Laplace-Beltrami stencil over its one-ring neighborhood: for every edge of the ring, the cotangent of the angle opposite that edge (in each of the (up to) two triangles sharing it) is accumulated as the weight of the corresponding neighbor (see vtkvmtkMath::Cotangent), and the total is stored (with sign flipped) in CenterWeight after area-normalization (ComputeArea / ScaleWithArea, overridden by subclasses to select finite-element or finite-volume normalization). Special handling (BuildBoundaryWeights) is applied when the point lies on an open mesh boundary, where the missing outer triangle is approximated using the boundary edge geometry. This is the base class for vtkvmtkPolyDataFELaplaceBeltramiStencil and vtkvmtkPolyDataFVFELaplaceBeltramiStencil, which only differ in how the normalizing area is computed; it is used, e.g., by vtkvmtkPolyDataMeanCurvature to estimate mean curvature.

See also
vtkvmtkPolyDataFELaplaceBeltramiStencil, vtkvmtkPolyDataFVFELaplaceBeltramiStencil, vtkvmtkPolyDataManifoldStencil, vtkvmtkPolyDataMeanCurvature

Definition at line 46 of file vtkvmtkPolyDataLaplaceBeltramiStencil.h.

Member Typedef Documentation

◆ Superclass

Constructor & Destructor Documentation

◆ vtkvmtkPolyDataLaplaceBeltramiStencil()

vtkvmtkPolyDataLaplaceBeltramiStencil::vtkvmtkPolyDataLaplaceBeltramiStencil ( )
protected

Definition at line 31 of file vtkvmtkPolyDataLaplaceBeltramiStencil.cxx.

32 {
33 this->NumberOfComponents = 1;
34 }
vtkIdType NumberOfComponents

◆ ~vtkvmtkPolyDataLaplaceBeltramiStencil()

vtkvmtkPolyDataLaplaceBeltramiStencil::~vtkvmtkPolyDataLaplaceBeltramiStencil ( )
inlineprotected

Definition at line 66 of file vtkvmtkPolyDataLaplaceBeltramiStencil.h.

66{};

Member Function Documentation

◆ IsTypeOf()

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

◆ IsA()

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

◆ SafeDownCast()

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

◆ NewInstanceInternal()

virtual vtkObjectBase * vtkvmtkPolyDataLaplaceBeltramiStencil::NewInstanceInternal ( ) const
protectedvirtual

◆ NewInstance()

vtkvmtkPolyDataLaplaceBeltramiStencil * vtkvmtkPolyDataLaplaceBeltramiStencil::NewInstance ( ) const

◆ Build()

void vtkvmtkPolyDataLaplaceBeltramiStencil::Build ( )
overridevirtual

Build the stencil.

Reimplemented from vtkvmtkPolyDataManifoldStencil.

Definition at line 81 of file vtkvmtkPolyDataLaplaceBeltramiStencil.cxx.

82 {
83 double point[3], point1[3], point2[3];
84 double boundaryWeight, boundaryNeighborWeight;
85 double cotangent;
86 vtkIdType j, firstId, lastId;
87
88 this->Superclass::Build();
89
90 vtkPolyData* pdata = vtkPolyData::SafeDownCast(this->DataSet);
91
92 if (!this->IsBoundary)
93 {
94 firstId = 0;
95 lastId = this->NPoints-1;
96 }
97 else
98 {
99 firstId = 1;
100 lastId = this->NPoints-3;
101 }
102
103 pdata->GetPoint(this->DataSetPointId,point);
104
105 for (j=0; j<this->NPoints; j++)
106 this->Weights[j] = 0.0;
107
108 for (j=firstId; j<=lastId; j++)
109 {
110 pdata->GetPoint(this->PointIds[j],point1);
111
112 pdata->GetPoint(this->PointIds[(j+1)%this->NPoints],point2);
113
114 cotangent = vtkvmtkMath::Cotangent(point,point2,point1);
115 this->Weights[j] += cotangent / 2.0;
116
117 cotangent = vtkvmtkMath::Cotangent(point,point1,point2);
118 this->Weights[(j+1)%this->NPoints] += cotangent / 2.0;
119 }
120
121 if (this->IsBoundary)
122 {
123 this->BuildBoundaryWeights(this->PointIds[0],this->PointIds[1],boundaryWeight,boundaryNeighborWeight);
124 this->Weights[0] += boundaryWeight;
125 this->Weights[1] += boundaryNeighborWeight;
126
127 this->BuildBoundaryWeights(this->PointIds[this->NPoints-1],this->PointIds[this->NPoints-2],boundaryWeight,boundaryNeighborWeight);
128 this->Weights[this->NPoints-1] += boundaryWeight;
129 this->Weights[this->NPoints-2] += boundaryNeighborWeight;
130 }
131
132 this->CenterWeight[0] = 0.0;
133 for (j=0; j<this->NPoints; j++)
134 {
135 this->CenterWeight[0] += this->Weights[j];
136 }
137
138 this->ComputeArea();
139 this->ScaleWithArea();
140 this->ChangeWeightSign();
141 }
static double Cotangent(double point0[3], double point1[3], double point2[3])
void BuildBoundaryWeights(vtkIdType boundaryPointId, vtkIdType boundaryNeighborPointId, double &boundaryWeight, double &boundaryNeighborWeight)
virtual void ScaleWithArea()=0
double * CenterWeight

◆ BuildBoundaryWeights()

void vtkvmtkPolyDataLaplaceBeltramiStencil::BuildBoundaryWeights ( vtkIdType boundaryPointId,
vtkIdType boundaryNeighborPointId,
double & boundaryWeight,
double & boundaryNeighborWeight )

Compute the pair of cotangent-like weights contributed by the single triangle formed by the center point (DataSetPointId), boundaryPointId and boundaryNeighborPointId, used by Build() to approximate the missing second triangle at an open mesh boundary edge. boundaryWeight and boundaryNeighborWeight are output parameters, filled in with the weight to add to boundaryPointId and boundaryNeighborPointId respectively. No-op if the stencil's center point is not on a boundary (IsBoundary is false).

Definition at line 36 of file vtkvmtkPolyDataLaplaceBeltramiStencil.cxx.

37 {
38 double point[3], point1[3], point2[3];
39 double vector1[3], vector2[3];
40 double triangleArea;
41
42 if (!this->IsBoundary)
43 return;
44
45 this->DataSet->GetPoint(this->DataSetPointId,point);
46 this->DataSet->GetPoint(boundaryPointId,point1);
47 this->DataSet->GetPoint(boundaryNeighborPointId,point2);
48
49 vector1[0] = point1[0] - point[0];
50 vector1[1] = point1[1] - point[1];
51 vector1[2] = point1[2] - point[2];
52
53 vector2[0] = point2[0] - point[0];
54 vector2[1] = point2[1] - point[1];
55 vector2[2] = point2[2] - point[2];
56
57 triangleArea = vtkvmtkMath::TriangleArea(point,point1,point2);
58
59 boundaryWeight = vtkMath::Distance2BetweenPoints(point,point2);
60 boundaryNeighborWeight = vtkMath::Dot(vector1,vector2);
61
62 if (triangleArea<VTK_VMTK_DOUBLE_TOL)
63 {
64 if (fabs(boundaryWeight)<VTK_VMTK_DOUBLE_TOL)
65 boundaryWeight = 0.0;
66 else
67 boundaryWeight = VTK_VMTK_LARGE_DOUBLE;
68
69 if (fabs(boundaryNeighborWeight)<VTK_VMTK_DOUBLE_TOL)
70 boundaryNeighborWeight = 0.0;
71 else
72 boundaryNeighborWeight = VTK_VMTK_LARGE_DOUBLE;
73 }
74 else
75 {
76 boundaryWeight /= 4.0 * triangleArea;
77 boundaryNeighborWeight /= 4.0 * triangleArea;
78 }
79 }
static double TriangleArea(double point0[3], double point1[3], double point2[3])
#define VTK_VMTK_DOUBLE_TOL
#define VTK_VMTK_LARGE_DOUBLE

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