VMTK
Loading...
Searching...
No Matches
vtkvmtkPolyDataPatchingFilter.cxx
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: VMTK
4 Module: $RCSfile: vtkvmtkPolyDataPatchingFilter.cxx,v $
5 Language: C++
6 Date: $Date: 2006/04/10 14:30:17 $
7 Version: $Revision: 1.11 $
8
9 Copyright (c) Luca Antiga, David Steinman. All rights reserved.
10 See LICENSE file for details.
11
12 Portions of this code are covered under the VTK copyright.
13 See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm
14 for details.
15
16 This software is distributed WITHOUT ANY WARRANTY; without even
17 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
18 PURPOSE. See the above copyright notices for more information.
19
20=========================================================================*/
21
23#include "vtkPolyData.h"
24#include "vtkPointData.h"
25#include "vtkCellData.h"
26#include "vtkTriangle.h"
27#include "vtkTriangleFilter.h"
28#include "vtkCellArray.h"
29#include "vtkCleanPolyData.h"
30#include "vtkClipPolyData.h"
31#include "vtkAppendPolyData.h"
32#include "vtkDoubleArray.h"
33#include "vtkIntArray.h"
34#include "vtkMath.h"
35#include "vtkPolyDataConnectivityFilter.h"
36#include "vtkInformation.h"
37#include "vtkInformationVector.h"
38#include "vtkObjectFactory.h"
39#include "vtkVersion.h"
40
42
43
45
47{
49 this->CircularMappingArrayName = NULL;
50 this->GroupIdsArrayName = NULL;
53 this->PatchAreaArrayName = NULL;
54 this->PatchSize[0] = this->PatchSize[1] = 0.0;
55 this->PatchOffsets[0] = this->PatchOffsets[1] = 0.0;
56 this->LongitudinalPatchBounds[0] = this->LongitudinalPatchBounds[1] = 0.0;
57 this->CircularPatchBounds[0] = this->CircularPatchBounds[1] = 0.0;
58 this->PatchedData = NULL;
59 this->CircularPatching = 1;
60 this->UseConnectivity = 1;
61}
62
64{
66 {
67 delete[] this->LongitudinalMappingArrayName;
69 }
70
72 {
73 delete[] this->CircularMappingArrayName;
74 this->CircularMappingArrayName = NULL;
75 }
76
78 {
81 }
82
84 {
85 delete[] this->CircularPatchNumberArrayName;
87 }
88
89 if (this->PatchAreaArrayName)
90 {
91 delete[] this->PatchAreaArrayName;
92 this->PatchAreaArrayName = NULL;
93 }
94
95 if (this->PatchedData)
96 {
97 this->PatchedData->Delete();
98 this->PatchedData = NULL;
99 }
100}
101
103 vtkInformation *vtkNotUsed(request),
104 vtkInformationVector **inputVector,
105 vtkInformationVector *outputVector)
106{
107 vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
108 vtkInformation *outInfo = outputVector->GetInformationObject(0);
109
110 vtkPolyData *input = vtkPolyData::SafeDownCast(
111 inInfo->Get(vtkDataObject::DATA_OBJECT()));
112 vtkPolyData *output = vtkPolyData::SafeDownCast(
113 outInfo->Get(vtkDataObject::DATA_OBJECT()));
114
116 {
117 vtkErrorMacro(<<"LongitudinalPatchNumberArrayName not set.");
118 return 1;
119 }
120
122 {
123 vtkErrorMacro(<<"CircularPatchNumberArrayName not set.");
124 return 1;
125 }
126
127 if (!this->PatchAreaArrayName)
128 {
129 vtkErrorMacro(<<"PatchAreaArrayName not set.");
130 return 1;
131 }
132
134 {
135 vtkErrorMacro(<<"LongitudinalMappingArrayName not set.");
136 return 1;
137 }
138
139 vtkDataArray* longitudinalMappingArray = input->GetPointData()->GetArray(this->LongitudinalMappingArrayName);
140
141 if (!longitudinalMappingArray)
142 {
143 vtkErrorMacro(<<"LongitudinalMappingArray with name specified does not exist.");
144 return 1;
145 }
146
147 vtkDataArray* circularMappingArray = NULL;
148 if (this->CircularPatching)
149 {
150
151 if (!this->CircularMappingArrayName)
152 {
153 vtkErrorMacro(<<"CircularMappingArrayName not set.");
154 return 1;
155 }
156
157 circularMappingArray = input->GetPointData()->GetArray(this->CircularMappingArrayName);
158
159 if (!circularMappingArray)
160 {
161 vtkErrorMacro(<<"CircularMappingArray with name specified does not exist.");
162 return 1;
163 }
164 }
165
166 if (!this->GroupIdsArrayName)
167 {
168 vtkErrorMacro(<<"GroupIdsArrayName not set.");
169 return 1;
170 }
171
172 vtkDataArray* groupIdsArray = input->GetPointData()->GetArray(this->GroupIdsArrayName);
173
174 if (!groupIdsArray)
175 {
176 vtkErrorMacro(<<"GroupIdsArray with name specified does not exist.");
177 return 1;
178 }
179
180 int numberOfInputPoints = input->GetNumberOfPoints();
181
182 double circumferentialActualPatchSize = this->PatchSize[1] * 2.0 * vtkMath::Pi();
183
184 char shiftedCircularMapping90ArrayName[] = "ShiftedCircularMapping90";
185 char shiftedCircularMapping180ArrayName[] = "ShiftedCircularMapping180";
186 char shiftedCircularMapping270ArrayName[] = "ShiftedCircularMapping270";
187
188 vtkDoubleArray* shiftedCircularMapping90Array = vtkDoubleArray::New();
189 shiftedCircularMapping90Array->SetName(shiftedCircularMapping90ArrayName);
190 shiftedCircularMapping90Array->SetNumberOfComponents(1);
191 shiftedCircularMapping90Array->SetNumberOfTuples(numberOfInputPoints);
192 vtkDoubleArray* shiftedCircularMapping180Array = vtkDoubleArray::New();
193 shiftedCircularMapping180Array->SetName(shiftedCircularMapping180ArrayName);
194 shiftedCircularMapping180Array->SetNumberOfComponents(1);
195 shiftedCircularMapping180Array->SetNumberOfTuples(numberOfInputPoints);
196 vtkDoubleArray* shiftedCircularMapping270Array = vtkDoubleArray::New();
197 shiftedCircularMapping270Array->SetName(shiftedCircularMapping270ArrayName);
198 shiftedCircularMapping270Array->SetNumberOfComponents(1);
199 shiftedCircularMapping270Array->SetNumberOfTuples(numberOfInputPoints);
200
201 int i;
202 if (this->CircularPatching)
203 {
204 for (i=0; i<numberOfInputPoints; i++)
205 {
206 double value = circularMappingArray->GetComponent(i,0);
207 double shiftedValue = value + 0.5 * vtkMath::Pi();
208 if (shiftedValue > vtkMath::Pi())
209 {
210 shiftedValue -= 2.0 * vtkMath::Pi();
211 }
212 shiftedCircularMapping90Array->SetValue(i,shiftedValue);
213 shiftedValue = value + vtkMath::Pi();
214 if (shiftedValue > vtkMath::Pi())
215 {
216 shiftedValue -= 2.0 * vtkMath::Pi();
217 }
218 shiftedCircularMapping180Array->SetValue(i,shiftedValue);
219 shiftedValue = value + 1.5 * vtkMath::Pi();
220 if (shiftedValue > vtkMath::Pi())
221 {
222 shiftedValue -= 2.0 * vtkMath::Pi();
223 }
224 shiftedCircularMapping270Array->SetValue(i,shiftedValue);
225 }
226 }
227 else
228 {
229 shiftedCircularMapping90Array->FillComponent(0,0.0);
230 shiftedCircularMapping180Array->FillComponent(0,0.0);
231 shiftedCircularMapping270Array->FillComponent(0,0.0);
232 }
233
234 input->GetPointData()->AddArray(shiftedCircularMapping90Array);
235 input->GetPointData()->AddArray(shiftedCircularMapping180Array);
236 input->GetPointData()->AddArray(shiftedCircularMapping270Array);
237
238 if (this->PatchedData)
239 {
240 this->PatchedData->Delete();
241 this->PatchedData = NULL;
242 }
243
244 this->PatchedData = vtkImageData::New();
245
246 vtkPointData* patchedDataPointData = this->PatchedData->GetPointData();
247 patchedDataPointData->CopyAllocate(input->GetPointData(),0);
248
249 vtkIntArray* patchedDataLongitudinalPatchNumberArray = vtkIntArray::New();
250 patchedDataLongitudinalPatchNumberArray->SetName(this->LongitudinalPatchNumberArrayName);
251 patchedDataLongitudinalPatchNumberArray->SetNumberOfComponents(1);
252
253 vtkIntArray* patchedDataCircularPatchNumberArray = vtkIntArray::New();
254 patchedDataCircularPatchNumberArray->SetName(this->CircularPatchNumberArrayName);
255 patchedDataCircularPatchNumberArray->SetNumberOfComponents(1);
256
257 vtkDoubleArray* patchedDataPatchAreaArray = vtkDoubleArray::New();
258 patchedDataPatchAreaArray->SetName(this->PatchAreaArrayName);
259 patchedDataPatchAreaArray->SetNumberOfComponents(1);
260
261 vtkAppendPolyData* patchAppendFilter = vtkAppendPolyData::New();
262
263 if (this->CircularPatchBounds[0] == 0.0 && this->CircularPatchBounds[1] == 0.0)
264 {
265 this->CircularPatchBounds[0] = - vtkMath::Pi();
266 this->CircularPatchBounds[1] = vtkMath::Pi();
267 }
268
269 int circularPatchStartIndex = 0;
270 int circularPatchEndIndex = 0;
271
272 if (this->CircularPatching)
273 {
274 circularPatchStartIndex = vtkMath::Floor((this->CircularPatchBounds[0] - this->PatchOffsets[1]) / circumferentialActualPatchSize);
275 if (circularPatchStartIndex*circumferentialActualPatchSize - this->PatchOffsets[1] < - vtkMath::Pi())
276 {
277 circularPatchStartIndex += 1;
278 }
279 circularPatchEndIndex = vtkMath::Floor((this->CircularPatchBounds[1] - this->PatchOffsets[1] - 1E-3 * circumferentialActualPatchSize) / circumferentialActualPatchSize);
280 }
281
282 int numberOfPreviousPatchDataLines = 0;
283 vtkIdList* groupIds = vtkIdList::New();
285 for (i=0; i<groupIds->GetNumberOfIds(); i++)
286 {
287 vtkIdType groupId = groupIds->GetId(i);
288 vtkPolyData* cylinder = vtkPolyData::New();
289 vtkvmtkPolyDataBranchUtilities::ExtractGroup(input,this->GroupIdsArrayName,groupId,true,cylinder);
290
291 longitudinalMappingArray = cylinder->GetPointData()->GetArray(this->LongitudinalMappingArrayName);
292 circularMappingArray = cylinder->GetPointData()->GetArray(this->CircularMappingArrayName);
293
294 cylinder->GetPointData()->SetActiveScalars(this->LongitudinalMappingArrayName);
295
296 vtkClipPolyData* longitudinalClipper0 = vtkClipPolyData::New();
297 longitudinalClipper0->SetInputData(cylinder);
298 longitudinalClipper0->GenerateClipScalarsOff();
299 longitudinalClipper0->InsideOutOff();
300
301 vtkClipPolyData* longitudinalClipper1 = vtkClipPolyData::New();
302 longitudinalClipper1->SetInputConnection(longitudinalClipper0->GetOutputPort());
303 longitudinalClipper1->GenerateClipScalarsOff();
304 longitudinalClipper1->InsideOutOn();
305
306 vtkClipPolyData* circularClipper0 = vtkClipPolyData::New();
307 circularClipper0->SetInputConnection(longitudinalClipper1->GetOutputPort());
308 circularClipper0->GenerateClipScalarsOff();
309 circularClipper0->InsideOutOff();
310
311 vtkClipPolyData* circularClipper1 = vtkClipPolyData::New();
312 circularClipper1->SetInputConnection(circularClipper0->GetOutputPort());
313 circularClipper1->GenerateClipScalarsOff();
314 circularClipper1->InsideOutOn();
315
316 vtkPolyDataConnectivityFilter* patchConnectivityFilter = vtkPolyDataConnectivityFilter::New();
317 patchConnectivityFilter->SetInputConnection(circularClipper1->GetOutputPort());
318 patchConnectivityFilter->SetExtractionModeToLargestRegion();
319
320 double longitudinalMappingRange[2];
321
322 longitudinalMappingArray->GetRange(longitudinalMappingRange,0);
323
324 double longitudinalCylinderPatchBounds[2];
325
326 if (this->LongitudinalPatchBounds[0] == 0.0 && this->LongitudinalPatchBounds[1] == 0.0)
327 {
328 longitudinalCylinderPatchBounds[0] = longitudinalMappingRange[0];
329 longitudinalCylinderPatchBounds[1] = longitudinalMappingRange[1];
330 }
331 else
332 {
333 longitudinalCylinderPatchBounds[0] = this->LongitudinalPatchBounds[0];
334 longitudinalCylinderPatchBounds[1] = this->LongitudinalPatchBounds[1];
335 }
336
337 int longitudinalPatchStartIndex = vtkMath::Floor((longitudinalCylinderPatchBounds[0] - this->PatchOffsets[0]) / this->PatchSize[0]);
338 int longitudinalPatchEndIndex = vtkMath::Floor((longitudinalCylinderPatchBounds[1] - this->PatchOffsets[0] - 1E-3 * this->PatchSize[0]) / this->PatchSize[0]);
339
340 int j, k;
341 for (j=longitudinalPatchStartIndex; j<=longitudinalPatchEndIndex; j++)
342 {
343 double longitudinalPatchStart = this->PatchOffsets[0] + j * this->PatchSize[0];
344 double longitudinalPatchEnd = this->PatchOffsets[0] + (j+1) * this->PatchSize[0];
345
346 longitudinalClipper0->SetValue(longitudinalPatchStart);
347 longitudinalClipper1->SetValue(longitudinalPatchEnd);
348 longitudinalClipper1->Update();
349
350 if (longitudinalClipper1->GetOutput()->GetNumberOfPoints() == 0)
351 {
352 continue;
353 }
354
355 for (k=circularPatchStartIndex; k<=circularPatchEndIndex; k++)
356 {
357 int patchId = k - circularPatchStartIndex + (j - longitudinalPatchStartIndex) * (circularPatchEndIndex-circularPatchStartIndex+1) + numberOfPreviousPatchDataLines * (circularPatchEndIndex-circularPatchStartIndex+1);
358 double circularPatchCenter = 0.0;
359 double shiftedCircularPatchCenter = 0.0;
360 char* patchShiftedCircularMappingArrayName = NULL;
361
362 if (this->CircularPatching)
363 {
364 double circularPatchStart = this->PatchOffsets[1] + k * circumferentialActualPatchSize;
365 double circularPatchEnd = this->PatchOffsets[1] + (k+1) * circumferentialActualPatchSize;
366
367 double pi = vtkMath::Pi();
368
369 if (circularPatchStart < -pi)
370 {
371 circularPatchStart += 2.0 * pi;
372 circularPatchEnd += 2.0 * pi;
373 }
374
375 circularPatchCenter = 0.5 * (circularPatchStart + circularPatchEnd);
376
377// if (circularPatchStart < pi && circularPatchEnd > pi)
378 if (circularPatchCenter <= - 0.75 * pi || circularPatchCenter >= 0.75 * pi)
379 {
380 patchShiftedCircularMappingArrayName = shiftedCircularMapping180ArrayName;
381 if (circularPatchCenter <= - 0.75 * pi)
382 {
383 circularPatchStart += pi;
384 circularPatchEnd += pi;
385 }
386 else if (circularPatchCenter >= 0.75 * pi)
387 {
388 circularPatchStart -= pi;
389 circularPatchEnd -= pi;
390 }
391 }
392// else if (circularPatchStart < 0.5 * pi && circularPatchEnd > 0.5 * pi)
393 else if (circularPatchCenter >= 0.25 * pi && circularPatchCenter < 0.75 * pi)
394 {
395 patchShiftedCircularMappingArrayName = shiftedCircularMapping270ArrayName;
396 circularPatchStart -= 0.5 * pi;
397 circularPatchEnd -= 0.5 * pi;
398 }
399// else if (circularPatchStart < -0.5 * pi && circularPatchEnd > -0.5 * pi)
400 else if (circularPatchCenter > -0.75 * pi && circularPatchCenter <= -0.25 * pi)
401 {
402 patchShiftedCircularMappingArrayName = shiftedCircularMapping90ArrayName;
403 circularPatchStart += 0.5 * pi;
404 circularPatchEnd += 0.5 * pi;
405 }
406 else
407 {
408 patchShiftedCircularMappingArrayName = this->CircularMappingArrayName;
409 }
410
411 longitudinalClipper1->GetOutput()->GetPointData()->SetActiveScalars(patchShiftedCircularMappingArrayName);
412
413 shiftedCircularPatchCenter = 0.5 * (circularPatchStart + circularPatchEnd);
414
415 circularClipper0->Modified();
416 circularClipper0->SetValue(circularPatchStart);
417 circularClipper1->SetValue(circularPatchEnd);
418 circularClipper1->Update();
419
420 if (circularClipper1->GetOutput()->GetNumberOfPoints() == 0)
421 {
422 continue;
423 }
424 }
425
426 vtkTriangleFilter* patchTriangleFilter = vtkTriangleFilter::New();
427
428 if (this->UseConnectivity)
429 {
430 if (this->CircularPatching)
431 {
432 patchConnectivityFilter->SetInputConnection(circularClipper1->GetOutputPort());
433 }
434 else
435 {
436 patchConnectivityFilter->SetInputConnection(longitudinalClipper1->GetOutputPort());
437 }
438 patchConnectivityFilter->Update();
439 patchTriangleFilter->SetInputConnection(patchConnectivityFilter->GetOutputPort());
440 }
441 else
442 {
443 if (this->CircularPatching)
444 {
445 patchTriangleFilter->SetInputConnection(circularClipper1->GetOutputPort());
446 }
447 else
448 {
449 patchTriangleFilter->SetInputConnection(longitudinalClipper1->GetOutputPort());
450 }
451 }
452
453 patchTriangleFilter->Update();
454
455 vtkPolyData* patch = vtkPolyData::New();
456 patch->DeepCopy(patchTriangleFilter->GetOutput());
457
458 patch->BuildCells();
459 int patchNumberOfCells = patch->GetNumberOfCells();
460
461 if (this->CircularPatching)
462 {
463 vtkDataArray* patchCircularMappingArray = patch->GetPointData()->GetArray(this->CircularMappingArrayName);
464 vtkDataArray* patchShiftedCircularMappingArray = patch->GetPointData()->GetArray(patchShiftedCircularMappingArrayName);
465
466 double angularOffset = circularPatchCenter - shiftedCircularPatchCenter;
467
468 vtkIdType patchNumberOfPoints = patch->GetNumberOfPoints();
469 vtkIdType pointId;
470 for (pointId=0; pointId<patchNumberOfPoints; pointId++)
471 {
472 double circularMappingValue = patchShiftedCircularMappingArray->GetTuple1(pointId);
473 circularMappingValue += angularOffset;
474 patchCircularMappingArray->SetTuple1(pointId,circularMappingValue);
475 }
476 }
477
478 vtkIntArray* longitudinalPatchNumberArray = vtkIntArray::New();
479 longitudinalPatchNumberArray->SetName(this->LongitudinalPatchNumberArrayName);
480 longitudinalPatchNumberArray->SetNumberOfComponents(1);
481 longitudinalPatchNumberArray->SetNumberOfTuples(patchNumberOfCells);
482
483 vtkIntArray* circularPatchNumberArray = vtkIntArray::New();
484 circularPatchNumberArray->SetName(this->CircularPatchNumberArrayName);
485 circularPatchNumberArray->SetNumberOfComponents(1);
486 circularPatchNumberArray->SetNumberOfTuples(patchNumberOfCells);
487
488 vtkDoubleArray* patchAreaArray = vtkDoubleArray::New();
489 patchAreaArray->SetName(this->PatchAreaArrayName);
490 patchAreaArray->SetNumberOfComponents(1);
491 patchAreaArray->SetNumberOfTuples(patchNumberOfCells);
492
493 double patchArea = 0.0;
494
495 vtkPointData* patchPointData = patch->GetPointData();
496
497 vtkCellData* patchCellData = vtkCellData::New();
498 patchCellData->CopyAllocate(patchPointData,patchNumberOfCells);
499
500 vtkCellData* patchedPatchCellData = patch->GetCellData();
501 patchedPatchCellData->CopyAllocate(patchCellData,patchNumberOfCells);
502
503 int cellId;
504 for (cellId=0; cellId < patchNumberOfCells; cellId++)
505 {
506 vtkTriangle* triangle = vtkTriangle::SafeDownCast(patch->GetCell(cellId));
507 if (!triangle)
508 {
509 continue;
510 }
511
512 double point0[3], point1[3], point2[3];
513 triangle->GetPoints()->GetPoint(0,point0);
514 triangle->GetPoints()->GetPoint(1,point1);
515 triangle->GetPoints()->GetPoint(2,point2);
516 patchArea += vtkTriangle::TriangleArea(point0,point1,point2);
517
518 double weights[3];
519 weights[1] = 1.0/3.0;
520 weights[2] = 1.0/3.0;
521 weights[0] = (1.0 - weights[1] - weights[2]);
522
523 patchCellData->InterpolatePoint(patchPointData,cellId,triangle->GetPointIds(),weights);
524 }
525
526 for (cellId = 0; cellId < patchNumberOfCells; cellId++)
527 {
528 longitudinalPatchNumberArray->SetValue(cellId,j);
529 circularPatchNumberArray->SetValue(cellId,k);
530 patchAreaArray->SetValue(cellId,patchArea);
531 }
532
533 patchedDataLongitudinalPatchNumberArray->InsertValue(patchId,j);
534 patchedDataCircularPatchNumberArray->InsertValue(patchId,k);
535 patchedDataPatchAreaArray->InsertValue(patchId,patchArea);
536
537 int numberOfArrays = patchCellData->GetNumberOfArrays();
538 int arrayId;
539 for (arrayId = 0; arrayId<numberOfArrays; arrayId++)
540 {
541 vtkDataArray* patchArray = patchCellData->GetArray(arrayId);
542 vtkDataArray* patchedArray = patchedPatchCellData->GetArray(patchArray->GetName());
543 vtkDataArray* patchedDataArray = patchedDataPointData->GetArray(arrayId);
544 if (!patchedArray)
545 {
546 continue;
547 }
548
549 int dataType = patchArray->GetDataType();
550 if (dataType != VTK_FLOAT && dataType != VTK_DOUBLE)
551 {
552 for (cellId = 0; cellId < patchNumberOfCells; cellId++)
553 {
554 patchedArray->InsertTuple(cellId,patchArray->GetTuple(cellId));
555 }
556 if (patchNumberOfCells > 0)
557 {
558 patchedDataArray->InsertTuple(patchId,patchArray->GetTuple(0));
559 }
560 continue;
561 }
562
563 double* integralTuple = new double[patchArray->GetNumberOfComponents()];
564 int componentId;
565 for (componentId = 0; componentId < patchArray->GetNumberOfComponents(); componentId++)
566 {
567 integralTuple[componentId] = 0.0;
568 }
569 for (cellId = 0; cellId < patchNumberOfCells; cellId++)
570 {
571 vtkTriangle* triangle = vtkTriangle::SafeDownCast(patch->GetCell(cellId));
572 if (!triangle)
573 {
574 continue;
575 }
576 double point0[3], point1[3], point2[3];
577 triangle->GetPoints()->GetPoint(0,point0);
578 triangle->GetPoints()->GetPoint(1,point1);
579 triangle->GetPoints()->GetPoint(2,point2);
580 double area = vtkTriangle::TriangleArea(point0,point1,point2);
581
582 for (componentId = 0; componentId < patchArray->GetNumberOfComponents(); componentId++)
583 {
584 integralTuple[componentId] += area * patchArray->GetComponent(cellId,componentId);
585 }
586 }
587 for (componentId = 0; componentId < patchArray->GetNumberOfComponents(); componentId++)
588 {
589 integralTuple[componentId] /= patchArea;
590 }
591 for (cellId = 0; cellId < patchNumberOfCells; cellId++)
592 {
593 patchedArray->InsertTuple(cellId,integralTuple);
594 }
595
596 patchedDataArray->InsertTuple(patchId,integralTuple);
597
598 delete[] integralTuple;
599 }
600
601 patch->GetCellData()->AddArray(longitudinalPatchNumberArray);
602 patch->GetCellData()->AddArray(circularPatchNumberArray);
603 patch->GetCellData()->AddArray(patchAreaArray);
604
605 patchAppendFilter->AddInputData(patch);
606
607 patch->Delete();
608 patchTriangleFilter->Delete();
609 patchCellData->Delete();
610 longitudinalPatchNumberArray->Delete();
611 circularPatchNumberArray->Delete();
612 patchAreaArray->Delete();
613 }
614 }
615
616 cylinder->Delete();
617
618 longitudinalClipper0->Delete();
619 longitudinalClipper1->Delete();
620 circularClipper0->Delete();
621 circularClipper1->Delete();
622 patchConnectivityFilter->Delete();
623
624 numberOfPreviousPatchDataLines += longitudinalPatchEndIndex - longitudinalPatchStartIndex + 1;
625 }
626 groupIds->Delete();
627
628 this->PatchedData->SetOrigin(0.0,0.0,0.0);
629 this->PatchedData->SetSpacing(circumferentialActualPatchSize,this->PatchSize[0],1.0);
630 this->PatchedData->SetExtent(0,circularPatchEndIndex-circularPatchStartIndex,0,numberOfPreviousPatchDataLines-1,0,0);
631
632 this->PatchedData->GetPointData()->AddArray(patchedDataLongitudinalPatchNumberArray);
633 this->PatchedData->GetPointData()->AddArray(patchedDataCircularPatchNumberArray);
634 this->PatchedData->GetPointData()->AddArray(patchedDataPatchAreaArray);
635
636 this->PatchedData->GetPointData()->RemoveArray(shiftedCircularMapping90ArrayName);
637 this->PatchedData->GetPointData()->RemoveArray(shiftedCircularMapping180ArrayName);
638 this->PatchedData->GetPointData()->RemoveArray(shiftedCircularMapping270ArrayName);
639
640 patchAppendFilter->Update();
641 output->DeepCopy(patchAppendFilter->GetOutput());
642
643 output->GetPointData()->RemoveArray(shiftedCircularMapping90ArrayName);
644 output->GetPointData()->RemoveArray(shiftedCircularMapping180ArrayName);
645 output->GetPointData()->RemoveArray(shiftedCircularMapping270ArrayName);
646 output->GetCellData()->RemoveArray(shiftedCircularMapping90ArrayName);
647 output->GetCellData()->RemoveArray(shiftedCircularMapping180ArrayName);
648 output->GetCellData()->RemoveArray(shiftedCircularMapping270ArrayName);
649
650 input->GetPointData()->RemoveArray(shiftedCircularMapping90ArrayName);
651 input->GetPointData()->RemoveArray(shiftedCircularMapping180ArrayName);
652 input->GetPointData()->RemoveArray(shiftedCircularMapping270ArrayName);
653
654 patchedDataLongitudinalPatchNumberArray->Delete();
655 patchedDataCircularPatchNumberArray->Delete();
656 patchedDataPatchAreaArray->Delete();
657
658 patchAppendFilter->Delete();
659
660 shiftedCircularMapping90Array->Delete();
661 shiftedCircularMapping180Array->Delete();
662 shiftedCircularMapping270Array->Delete();
663
664 return 1;
665}
static void ExtractGroup(vtkPolyData *surface, const char *groupIdsArrayName, vtkIdType groupId, bool cleanGroupSurface, vtkPolyData *groupSurface)
static void GetGroupsIdList(vtkPolyData *surface, const char *groupIdsArrayName, vtkIdList *groupIds)
Cut a branched, longitudinally/angularly mapped surface into a grid of quadrilateral patches,...
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
vtkStandardNewMacro(vtkvmtkPolyDataPatchingFilter)