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

Wraps the surfmesh surface mesh generator by Gordan Stuhne; may not be working. More...

#include <vtkvmtkSurfMeshWrapper.h>

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

Public Types

typedef vtkPolyDataAlgorithm Superclass

Public Member Functions

virtual int IsA (const char *type)
vtkvmtkSurfMeshWrapper * NewInstance () const
void PrintSelf (std::ostream &os, vtkIndent indent) override
virtual void SetNodeSpacing (double)
virtual double GetNodeSpacing ()

Static Public Member Functions

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

Protected Member Functions

virtual vtkObjectBase * NewInstanceInternal () const
 vtkvmtkSurfMeshWrapper ()
 ~vtkvmtkSurfMeshWrapper ()
virtual int RequestData (vtkInformation *, vtkInformationVector **, vtkInformationVector *) override

Protected Attributes

double NodeSpacing

Detailed Description

Wraps the surfmesh surface mesh generator by Gordan Stuhne; may not be working.

Intended to remesh the input surface to an approximately uniform triangle edge length of NodeSpacing using the third-party "surfmesh" mesh generator by Gordan Stuhne. See vtkvmtkPolyDataSurfaceRemeshing for an actively used alternative surface remeshing filter.

See also
vtkvmtkPolyDataSurfaceRemeshing

Definition at line 35 of file vtkvmtkSurfMeshWrapper.h.

Member Typedef Documentation

◆ Superclass

typedef vtkPolyDataAlgorithm vtkvmtkSurfMeshWrapper::Superclass

Definition at line 39 of file vtkvmtkSurfMeshWrapper.h.

Constructor & Destructor Documentation

◆ vtkvmtkSurfMeshWrapper()

vtkvmtkSurfMeshWrapper::vtkvmtkSurfMeshWrapper ( )
protected

Definition at line 34 of file vtkvmtkSurfMeshWrapper.cxx.

35{
36 this->NodeSpacing = 0.1;
37}

◆ ~vtkvmtkSurfMeshWrapper()

vtkvmtkSurfMeshWrapper::~vtkvmtkSurfMeshWrapper ( )
protected

Definition at line 39 of file vtkvmtkSurfMeshWrapper.cxx.

40{
41}

Member Function Documentation

◆ New()

vtkvmtkSurfMeshWrapper * vtkvmtkSurfMeshWrapper::New ( )
static

◆ IsTypeOf()

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

◆ IsA()

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

◆ SafeDownCast()

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

◆ NewInstanceInternal()

virtual vtkObjectBase * vtkvmtkSurfMeshWrapper::NewInstanceInternal ( ) const
protectedvirtual

◆ NewInstance()

vtkvmtkSurfMeshWrapper * vtkvmtkSurfMeshWrapper::NewInstance ( ) const

◆ PrintSelf()

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

Definition at line 143 of file vtkvmtkSurfMeshWrapper.cxx.

144{
145 this->Superclass::PrintSelf(os,indent);
146}

◆ SetNodeSpacing()

virtual void vtkvmtkSurfMeshWrapper::SetNodeSpacing ( double )
virtual

Set/Get the target (approximately uniform) triangle edge length of the remeshed output.

◆ GetNodeSpacing()

virtual double vtkvmtkSurfMeshWrapper::GetNodeSpacing ( )
virtual

Set/Get the target (approximately uniform) triangle edge length of the remeshed output.

◆ RequestData()

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

Definition at line 61 of file vtkvmtkSurfMeshWrapper.cxx.

65{
66 vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
67 vtkInformation *outInfo = outputVector->GetInformationObject(0);
68
69 vtkPolyData *input = vtkPolyData::SafeDownCast(
70 inInfo->Get(vtkDataObject::DATA_OBJECT()));
71 vtkPolyData *output = vtkPolyData::SafeDownCast(
72 outInfo->Get(vtkDataObject::DATA_OBJECT()));
73
74 Remesh *nb = new Remesh(this->NodeSpacing);
75
76 int numberOfInputPoints = input->GetNumberOfPoints();
77 nb->SetNumberOfPoints(numberOfInputPoints);
78
79 double point[3];
80 real xpos[3];
81 int i;
82 for (i=0; i<numberOfInputPoints; i++)
83 {
84 input->GetPoint(i,point);
85 xpos[0] = static_cast<real>(point[0]);
86 xpos[1] = static_cast<real>(point[1]);
87 xpos[2] = static_cast<real>(point[2]);
88 nb->AddPoint(i,xpos[0],xpos[1],xpos[2]);
89 }
90
91 input->BuildCells();
92 int numberOfInputCells = input->GetNumberOfCells();
93 vtkIdType npts, *pts;
94 for (i=0; i<numberOfInputCells; i++)
95 {
96 if (input->GetCellType(i) != VTK_TRIANGLE)
97 {
98 continue;
99 }
100 input->GetCellPoints(i,npts,pts);
101 nb->AddTriangle(pts[0],pts[1],pts[2]);
102 }
103
104 try
105 {
106 nb->Run2D();
107 }
108 catch(Error *e)
109 {
110 e->Print(std::cerr);
111 }
112
113 nb->IterateOnOutput(false);
114
115 vtkPoints* outputPoints = vtkPoints::New();
116 vtkCellArray* outputCellArray = vtkCellArray::New();
117
118 while (nb->NextNode(xpos)!=-1)
119 {
120 point[0] = static_cast<double>(xpos[0]);
121 point[1] = static_cast<double>(xpos[1]);
122 point[2] = static_cast<double>(xpos[2]);
123 outputPoints->InsertNextPoint(point);
124 }
125
126 int icorn[3];
127 while (nb->NextCell(icorn))
128 {
129 outputCellArray->InsertNextCell(3,icorn);
130 }
131
132 output->SetPoints(outputPoints);
133 output->SetPolys(outputCellArray);
134
135 outputPoints->Delete();
136 outputCellArray->Delete();
137
138 delete nb;
139
140 return 1;
141}

Member Data Documentation

◆ NodeSpacing

double vtkvmtkSurfMeshWrapper::NodeSpacing
protected

Definition at line 56 of file vtkvmtkSurfMeshWrapper.h.


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