1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // File : VTKViewer_GeometryFilter.cxx
24 // Author : Michael ZORIN
27 #include "VTKViewer_GeometryFilter.h"
28 #include "VTKViewer_ConvexTool.h"
29 #include "VTKViewer_ArcBuilder.h"
31 #include <vtkSmartPointer.h>
32 #include <vtkCellArray.h>
33 #include <vtkCellData.h>
34 #include <vtkGenericCell.h>
35 #include <vtkHexagonalPrism.h>
36 #include <vtkHexahedron.h>
37 #include <vtkInformation.h>
38 #include <vtkInformationVector.h>
39 #include <vtkMergePoints.h>
40 #include <vtkObjectFactory.h>
41 #include <vtkPointData.h>
42 #include <vtkPolyData.h>
43 #include <vtkPolygon.h>
44 #include <vtkPyramid.h>
45 #include <vtkStructuredGrid.h>
47 #include <vtkUnsignedCharArray.h>
48 #include <vtkUnstructuredGrid.h>
58 #include "utilities.h"
66 #define VTK_XVERSION (VTK_MAJOR_VERSION*10000+VTK_MINOR_VERSION*100+VTK_BUILD_VERSION)
69 //#define USE_ROBUST_TRIANGULATION
71 ///////////////////////////////////////////////////////////////////////////////////////////////
72 // VSR 26/10/2012: fix of regression (issue 21924) - increased memory consumption
73 // for displaying of 3d elements, introduced by fix for issue 20314.
75 // The macro SHOW_COINCIDING_3D_PAL20314, when defined, allows correct visualization of
76 // coincident 3d elements but causes substantial increasing of memory consumption, as all 3d
77 // elements are always shown, even if they are totally covered by surrounding faces.
78 // If this macro is not defined (commented), the behaviour is defined by another macro -
79 // SHOW_COINCIDING_3D_PAL21924, as follows:
80 // - If SHOW_COINCIDING_3D_PAL21924 is defined, an alternative solution for computing
81 // visibility of 3d elements is used; this solution allows to fix problem with visibility
82 // of coinciding 3d elements in most cases (though some cases might not work), while not
83 // causing significant increasing of memory consumption.
84 // - If SHOW_COINCIDING_3D_PAL21924 is not defined (commented), coinciding 3d elements are
85 // not shown at all (this corresponds to the state before issue 20314 fixing).
86 ///////////////////////////////////////////////////////////////////////////////////////////////
87 //#define SHOW_COINCIDING_3D_PAL20314
88 #ifndef SHOW_COINCIDING_3D_PAL20314
89 #define SHOW_COINCIDING_3D_PAL21924
91 ///////////////////////////////////////////////////////////////////////////////////////////////
93 vtkStandardNewMacro(VTKViewer_GeometryFilter);
95 VTKViewer_GeometryFilter
96 ::VTKViewer_GeometryFilter():
99 myAppendCoincident3D(0),
100 myIsWireframeMode(0),
106 VTKViewer_GeometryFilter
107 ::~VTKViewer_GeometryFilter()
112 VTKViewer_GeometryFilter
114 vtkInformation *request,
115 vtkInformationVector **inputVector,
116 vtkInformationVector *outputVector)
118 // get the info objects
119 vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
120 vtkInformation *outInfo = outputVector->GetInformationObject(0);
122 // get the input and ouptut
123 vtkDataSet *input = vtkDataSet::SafeDownCast(
124 inInfo->Get(vtkDataObject::DATA_OBJECT()));
125 vtkPolyData *output = vtkPolyData::SafeDownCast(
126 outInfo->Get(vtkDataObject::DATA_OBJECT()));
128 vtkIdType numCells=input->GetNumberOfCells();
135 if (input->GetDataObjectType() == VTK_UNSTRUCTURED_GRID){
136 return this->UnstructuredGridExecute(input, output, outInfo);
138 return Superclass::RequestData(request,inputVector,outputVector);
145 VTKViewer_GeometryFilter
146 ::UnstructuredGridExecute(
147 vtkDataSet *dataSetInput,
149 vtkInformation *outInfo)
152 vtkUnstructuredGrid *input= (vtkUnstructuredGrid *)dataSetInput;
153 vtkCellArray *Connectivity = input->GetCells();
155 if ( Connectivity == NULL )
157 vtkDebugMacro(<<"Nothing to extract");
166 vtkPoints *p = input->GetPoints();
167 vtkIdType numCells=input->GetNumberOfCells();
168 vtkPointData *pd = input->GetPointData();
169 vtkCellData *cd = input->GetCellData();
170 vtkPointData *outputPD = output->GetPointData();
172 VTKViewer_OrderedTriangulator anOrderedTriangulator;
173 VTKViewer_DelaunayTriangulator aDelaunayTriangulator;
175 vtkCellData *outputCD = output->GetCellData();
176 vtkGenericCell *cell = vtkGenericCell::New();
178 vtkIdList *cellIds = vtkIdList::New();
179 vtkIdList *faceIds = vtkIdList::New();
180 vtkIdList *cellIdsTmp = vtkIdList::New();
181 vtkIdList *faceIdsTmp = vtkIdList::New();
185 int faceId, *faceVerts, numFacePts;
187 vtkIdType PixelConvert[4];
188 // Change the type from int to vtkIdType in order to avoid compilation errors while using VTK
189 // from ParaView-3.4.0 compiled on 64-bit Debian platform with VTK_USE_64BIT_IDS = ON
190 vtkIdType aNewPts[VTK_CELL_SIZE];
192 unsigned char updateLevel = (unsigned char)(GetUpdateGhostLevel());
193 unsigned char *cellGhostLevels = 0;
200 vtkDebugMacro(<<"Executing geometry filter for unstructured grid input");
202 vtkDataArray* temp = 0;
205 temp = cd->GetArray("vtkGhostLevels");
207 if ( (!temp) || (temp->GetDataType() != VTK_UNSIGNED_CHAR)
208 || (temp->GetNumberOfComponents() != 1))
210 vtkDebugMacro("No appropriate ghost levels field available.");
214 cellGhostLevels = ((vtkUnsignedCharArray*)temp)->GetPointer(0);
217 // Determine nature of what we have to do
218 if ( (!this->CellClipping) && (!this->PointClipping) &&
219 (!this->ExtentClipping) )
227 cellVis = new char[numCells];
230 // Issue 0020115: [CEA 308] Quadratic elements visualization
231 // Fix of remark described in note 0005222 - SIGSEGV
232 vtkPoints* outputPoints = vtkPoints::New();
233 outputPoints->DeepCopy(input->GetPoints());
234 output->SetPoints(outputPoints);
235 outputPoints->Delete();
237 outputPD->PassData(pd);
239 outputCD->CopyAllocate(cd,numCells,numCells/2);
241 output->Allocate(numCells/4+1,numCells);
243 // Loop over the cells determining what's visible
246 for (cellId=0, Connectivity->InitTraversal();
247 Connectivity->GetNextCell(npts,pts);
251 if ( ( this->CellClipping && cellId < this->CellMinimum ) ||
252 cellId > this->CellMaximum )
258 for (i=0; i < npts; i++)
260 x = p->GetPoint(pts[i]);
261 if ( ( ( ( this->PointClipping && (pts[i] < this->PointMinimum ) ) ||
262 pts[i] > this->PointMaximum) ) ||
263 ( this->ExtentClipping &&
264 ( x[0] < this->Extent[0] || x[0] > this->Extent[1] ||
265 x[1] < this->Extent[2] || x[1] > this->Extent[3] ||
266 x[2] < this->Extent[4] || x[2] > this->Extent[5] )) )
270 }//point/extent clipping
272 }//if point clipping needs checking
274 }//if not all visible
276 // Loop over all cells now that visibility is known
277 // (Have to compute visibility first for 3D cell boundarys)
278 int progressInterval = numCells/20 + 1;
279 TMapOfVectorId aDimension2VTK2ObjIds;
281 myVTK2ObjIds.clear();
282 myVTK2ObjIds.reserve(numCells);
284 for (cellId=0, Connectivity->InitTraversal();
285 Connectivity->GetNextCell(npts,pts);
288 //Progress and abort method support
289 if ( !(cellId % progressInterval) )
291 vtkDebugMacro(<<"Process cell #" << cellId);
292 this->UpdateProgress ((float)cellId/numCells);
295 // Handle ghost cells here. Another option was used cellVis array.
296 if (cellGhostLevels && cellGhostLevels[cellId] > updateLevel)
297 { // Do not create surfaces in outer ghost cells.
301 if (allVisible || cellVis[cellId]) //now if visible extract geometry
303 //special code for nonlinear cells - rarely occurs, so right now it
305 vtkIdType aCellType = input->GetCellType(cellId);
312 case VTK_POLY_VERTEX:
313 newCellId = output->InsertNextCell(aCellType,npts,pts);
315 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
317 outputCD->CopyData(cd,cellId,newCellId);
322 newCellId = output->InsertNextCell(aCellType,npts,pts);
324 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
325 outputCD->CopyData(cd,cellId,newCellId);
331 newCellId = output->InsertNextCell(aCellType,npts,pts);
333 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
334 outputCD->CopyData(cd,cellId,newCellId);
337 case VTK_TRIANGLE_STRIP:
338 newCellId = output->InsertNextCell(aCellType,npts,pts);
340 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
341 outputCD->CopyData(cd,cellId,newCellId);
345 newCellId = output->InsertNextCell(aCellType,npts,pts);
347 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
348 outputCD->CopyData(cd,cellId,newCellId);
351 case VTK_CONVEX_POINT_SET: {
352 bool anIsOk = anOrderedTriangulator.Execute(input,
357 GetAppendCoincident3D(),
363 aDimension2VTK2ObjIds,
366 aDelaunayTriangulator.Execute(input,
371 GetAppendCoincident3D(),
377 aDimension2VTK2ObjIds,
383 #ifdef SHOW_COINCIDING_3D_PAL21924
385 for (int ai=0; ai<npts; ai++)
386 faceIdsTmp->InsertNextId(pts[ai]);
387 input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
389 for (faceId = 0; faceId < 4; faceId++)
392 faceVerts = vtkTetra::GetFaceArray(faceId);
393 faceIds->InsertNextId(pts[faceVerts[0]]);
394 faceIds->InsertNextId(pts[faceVerts[1]]);
395 faceIds->InsertNextId(pts[faceVerts[2]]);
396 aCellType = VTK_TRIANGLE;
398 input->GetCellNeighbors(cellId, faceIds, cellIds);
399 #ifdef SHOW_COINCIDING_3D_PAL21924
401 for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
402 if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
404 bool process = nbNeighbors <= 0;
406 bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
408 if ( process || myShowInside ||
409 (!allVisible && !cellVis[cellIds->GetId(0)]) )
411 for ( i=0; i < numFacePts; i++)
412 aNewPts[i] = pts[faceVerts[i]];
413 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
415 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
416 outputCD->CopyData(cd,cellId,newCellId);
422 #ifdef SHOW_COINCIDING_3D_PAL21924
424 for (int ai=0; ai<npts; ai++)
425 faceIdsTmp->InsertNextId(pts[ai]);
426 input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
428 for (faceId = 0; faceId < 6; faceId++)
431 faceVerts = vtkVoxel::GetFaceArray(faceId);
432 faceIds->InsertNextId(pts[faceVerts[0]]);
433 faceIds->InsertNextId(pts[faceVerts[1]]);
434 faceIds->InsertNextId(pts[faceVerts[2]]);
435 faceIds->InsertNextId(pts[faceVerts[3]]);
436 aCellType = VTK_QUAD;
438 input->GetCellNeighbors(cellId, faceIds, cellIds);
439 #ifdef SHOW_COINCIDING_3D_PAL21924
441 for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
442 if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
444 bool process = nbNeighbors <= 0;
446 bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
448 if ( process || myShowInside ||
449 (!allVisible && !cellVis[cellIds->GetId(0)]) )
451 for ( i=0; i < numFacePts; i++)
452 aNewPts[i] = pts[faceVerts[PixelConvert[i]]];
453 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
455 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
456 outputCD->CopyData(cd,cellId,newCellId);
461 case VTK_HEXAHEDRON: {
462 #ifdef SHOW_COINCIDING_3D_PAL21924
464 for (int ai=0; ai<npts; ai++)
465 faceIdsTmp->InsertNextId(pts[ai]);
466 input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
468 for (faceId = 0; faceId < 6; faceId++)
471 faceVerts = vtkHexahedron::GetFaceArray(faceId);
472 faceIds->InsertNextId(pts[faceVerts[0]]);
473 faceIds->InsertNextId(pts[faceVerts[1]]);
474 faceIds->InsertNextId(pts[faceVerts[2]]);
475 faceIds->InsertNextId(pts[faceVerts[3]]);
476 aCellType = VTK_QUAD;
478 input->GetCellNeighbors(cellId, faceIds, cellIds);
479 #ifdef SHOW_COINCIDING_3D_PAL21924
481 for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
482 if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
484 bool process = nbNeighbors <= 0;
486 bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
488 if ( process || myShowInside ||
489 (!allVisible && !cellVis[cellIds->GetId(0)]) )
491 for ( i=0; i < numFacePts; i++)
492 aNewPts[i] = pts[faceVerts[i]];
493 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
495 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
496 outputCD->CopyData(cd,cellId,newCellId);
502 #ifdef SHOW_COINCIDING_3D_PAL21924
504 for (int ai=0; ai<npts; ai++)
505 faceIdsTmp->InsertNextId(pts[ai]);
506 input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
508 for (faceId = 0; faceId < 5; faceId++)
511 faceVerts = vtkWedge::GetFaceArray(faceId);
512 faceIds->InsertNextId(pts[faceVerts[0]]);
513 faceIds->InsertNextId(pts[faceVerts[1]]);
514 faceIds->InsertNextId(pts[faceVerts[2]]);
515 aCellType = VTK_TRIANGLE;
517 if (faceVerts[3] >= 0)
519 faceIds->InsertNextId(pts[faceVerts[3]]);
520 aCellType = VTK_QUAD;
524 input->GetCellNeighbors(cellId, faceIds, cellIds);
525 #ifdef SHOW_COINCIDING_3D_PAL21924
527 for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
528 if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
530 bool process = nbNeighbors <= 0;
532 bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
534 if ( process || myShowInside ||
535 (!allVisible && !cellVis[cellIds->GetId(0)]) )
537 for ( i=0; i < numFacePts; i++)
538 aNewPts[i] = pts[faceVerts[i]];
539 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
541 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
542 outputCD->CopyData(cd,cellId,newCellId);
547 case VTK_HEXAGONAL_PRISM: {
548 #ifdef SHOW_COINCIDING_3D_PAL21924
550 for (int ai=0; ai<npts; ai++)
551 faceIdsTmp->InsertNextId(pts[ai]);
552 input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
554 for (faceId = 0; faceId < 8; faceId++)
556 faceVerts = vtkHexagonalPrism::GetFaceArray(faceId);
558 faceIds->InsertNextId(pts[faceVerts[0]]);
559 faceIds->InsertNextId(pts[faceVerts[1]]);
560 faceIds->InsertNextId(pts[faceVerts[2]]);
561 faceIds->InsertNextId(pts[faceVerts[3]]);
562 aCellType = VTK_QUAD;
564 if (faceVerts[5] >= 0)
566 faceIds->InsertNextId(pts[faceVerts[4]]);
567 faceIds->InsertNextId(pts[faceVerts[5]]);
568 aCellType = VTK_POLYGON;
571 input->GetCellNeighbors(cellId, faceIds, cellIds);
572 #ifdef SHOW_COINCIDING_3D_PAL21924
574 for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
575 if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
577 bool process = nbNeighbors <= 0;
579 bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
581 if ( process || myShowInside ||
582 (!allVisible && !cellVis[cellIds->GetId(0)]) )
584 for ( i=0; i < numFacePts; i++)
585 aNewPts[i] = pts[faceVerts[i]];
586 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
588 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
589 outputCD->CopyData(cd,cellId,newCellId);
595 #ifdef SHOW_COINCIDING_3D_PAL21924
597 for (int ai=0; ai<npts; ai++)
598 faceIdsTmp->InsertNextId(pts[ai]);
599 input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
601 for (faceId = 0; faceId < 5; faceId++)
604 faceVerts = vtkPyramid::GetFaceArray(faceId);
605 faceIds->InsertNextId(pts[faceVerts[0]]);
606 faceIds->InsertNextId(pts[faceVerts[1]]);
607 faceIds->InsertNextId(pts[faceVerts[2]]);
608 aCellType = VTK_TRIANGLE;
610 if (faceVerts[3] >= 0)
612 faceIds->InsertNextId(pts[faceVerts[3]]);
613 aCellType = VTK_QUAD;
616 input->GetCellNeighbors(cellId, faceIds, cellIds);
617 #ifdef SHOW_COINCIDING_3D_PAL21924
619 for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
620 if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
622 bool process = nbNeighbors <= 0;
624 bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
626 if ( process || myShowInside ||
627 (!allVisible && !cellVis[cellIds->GetId(0)]) )
629 for ( i=0; i < numFacePts; i++)
630 aNewPts[i] = pts[faceVerts[i]];
631 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
633 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
634 outputCD->CopyData(cd,cellId,newCellId);
640 #if VTK_XVERSION > 50700
643 //MESSAGE("VTK_POLYHEDRON geometry filter");
644 vtkIdType nFaces = 0;
645 vtkIdType* ptIds = 0;
647 input->GetFaceStream(cellId, nFaces, ptIds);
648 #ifdef SHOW_COINCIDING_3D_PAL21924
650 for (int ai=0; ai<npts; ai++)
651 faceIdsTmp->InsertNextId(pts[ai]);
652 input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
654 for (faceId = 0; faceId < nFaces; faceId++)
657 numFacePts = ptIds[idp];
658 //MESSAGE("numFacePts="<< numFacePts);
660 for (i = 0; i < numFacePts; i++)
662 //MESSAGE("ptIds[" << idp + i << "]=" << ptIds[idp + i]);
663 faceIds->InsertNextId(ptIds[idp + i]);
669 aCellType = VTK_TRIANGLE;
672 aCellType = VTK_QUAD;
675 aCellType = VTK_POLYGON;
678 // TODO understand and fix display of several polyhedrons
679 input->GetCellNeighbors(cellId, faceIds, cellIds);
680 #ifdef SHOW_COINCIDING_3D_PAL21924
682 for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
683 if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
685 bool process = nbNeighbors <= 0;
687 bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
689 if (process || myShowInside
690 || (!allVisible && !cellVis[cellIds->GetId(0)]))
692 for (i = 0; i < numFacePts; i++)
693 aNewPts[i] = ptIds[pt0 + i];
694 newCellId = output->InsertNextCell(aCellType, numFacePts, aNewPts);
696 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
697 outputCD->CopyData(cd, cellId, newCellId);
704 case VTK_QUADRATIC_EDGE:
705 case VTK_QUADRATIC_TRIANGLE:
706 case VTK_QUADRATIC_QUAD:
707 case VTK_BIQUADRATIC_QUAD:
708 case VTK_QUADRATIC_TETRA:
709 case VTK_QUADRATIC_HEXAHEDRON:
710 case VTK_TRIQUADRATIC_HEXAHEDRON:
711 case VTK_QUADRATIC_WEDGE:
712 case VTK_QUADRATIC_PYRAMID:
713 if(!myIsWireframeMode) {
714 input->GetCell(cellId,cell);
715 vtkIdList *lpts = vtkIdList::New();
716 vtkPoints *coords = vtkPoints::New();
717 vtkIdList *cellIds = vtkIdList::New();
720 if ( cell->GetCellDimension() == 1 ) {
721 vtkIdType arcResult = -1;
723 arcResult = Build1DArc(cellId, input, output, pts, myMaxArcAngle);
724 newCellId = arcResult;
727 if(!myIsBuildArc || arcResult == -1 ) {
728 aCellType = VTK_LINE;
730 cell->Triangulate(0,lpts,coords);
731 for (i=0; i < lpts->GetNumberOfIds(); i+=2) {
732 aNewPts[0] = lpts->GetId(i);
733 aNewPts[1] = lpts->GetId(i+1);
734 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
736 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
737 outputCD->CopyData(cd,cellId,newCellId);
742 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
743 outputCD->CopyData(cd,cellId,newCellId);
746 else if ( cell->GetCellDimension() == 2 ) {
748 aCellType = VTK_TRIANGLE;
750 cell->Triangulate(0,lpts,coords);
751 for (i=0; i < lpts->GetNumberOfIds(); i+=3) {
752 aNewPts[0] = lpts->GetId(i);
753 aNewPts[1] = lpts->GetId(i+1);
754 aNewPts[2] = lpts->GetId(i+2);
755 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
757 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
758 outputCD->CopyData(cd,cellId,newCellId);
762 BuildArcedPolygon(cellId,input,output,aDimension2VTK2ObjIds,true);
765 else //3D nonlinear cell
767 #ifdef SHOW_COINCIDING_3D_PAL21924
771 case VTK_QUADRATIC_TETRA: npts1 = 4; break;
772 case VTK_QUADRATIC_HEXAHEDRON: npts1 = 8; break;
773 case VTK_TRIQUADRATIC_HEXAHEDRON: npts1 = 8; break;
774 case VTK_QUADRATIC_WEDGE: npts1 = 6; break;
775 case VTK_QUADRATIC_PYRAMID: npts1 = 5; break;
778 for (int ai=0; ai<npts; ai++)
779 faceIdsTmp->InsertNextId(pts[ai]);
780 input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
783 aCellType = VTK_TRIANGLE;
785 for (int j=0; j < cell->GetNumberOfFaces(); j++){
786 vtkCell *face = cell->GetFace(j);
787 input->GetCellNeighbors(cellId, face->PointIds, cellIds);
788 #ifdef SHOW_COINCIDING_3D_PAL21924
790 for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
791 if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
793 bool process = nbNeighbors <= 0;
795 bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
797 if ( process || myShowInside ) {
798 face->Triangulate(0,lpts,coords);
799 for (i=0; i < lpts->GetNumberOfIds(); i+=3) {
800 aNewPts[0] = lpts->GetId(i);
801 aNewPts[1] = lpts->GetId(i+1);
802 aNewPts[2] = lpts->GetId(i+2);
803 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
805 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
806 outputCD->CopyData(cd,cellId,newCellId);
810 } //3d nonlinear cell
815 } else { // wireframe
817 case VTK_QUADRATIC_EDGE: {
818 vtkIdType arcResult =-1;
820 arcResult = Build1DArc(cellId, input, output, pts,myMaxArcAngle);
821 newCellId = arcResult;
823 if(!myIsBuildArc || arcResult == -1) {
824 aCellType = VTK_POLY_LINE;
831 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
835 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
837 outputCD->CopyData(cd,cellId,newCellId);
840 case VTK_QUADRATIC_TRIANGLE: {
842 aCellType = VTK_POLYGON;
852 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
854 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
856 outputCD->CopyData(cd,cellId,newCellId);
859 BuildArcedPolygon(cellId,input,output,aDimension2VTK2ObjIds);
862 case VTK_BIQUADRATIC_QUAD:
863 case VTK_QUADRATIC_QUAD: {
865 aCellType = VTK_POLYGON;
877 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
879 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
881 outputCD->CopyData(cd,cellId,newCellId);
884 BuildArcedPolygon(cellId,input,output,aDimension2VTK2ObjIds);
887 case VTK_QUADRATIC_TETRA: {
888 aCellType = VTK_POLYGON;
891 //---------------------------------------------------------------
899 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
901 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
903 outputCD->CopyData(cd,cellId,newCellId);
905 //---------------------------------------------------------------
913 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
915 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
917 outputCD->CopyData(cd,cellId,newCellId);
919 //---------------------------------------------------------------
927 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
929 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
931 outputCD->CopyData(cd,cellId,newCellId);
933 //---------------------------------------------------------------
941 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
943 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
945 outputCD->CopyData(cd,cellId,newCellId);
949 case VTK_QUADRATIC_WEDGE: {
950 aCellType = VTK_POLYGON;
952 //---------------------------------------------------------------
960 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
962 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
963 outputCD->CopyData(cd,cellId,newCellId);
965 //---------------------------------------------------------------
970 aNewPts[3] = pts[10];
972 aNewPts[5] = pts[11];
973 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
975 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
976 outputCD->CopyData(cd,cellId,newCellId);
978 //---------------------------------------------------------------
984 aNewPts[3] = pts[14];
986 aNewPts[5] = pts[11];
988 aNewPts[7] = pts[12];
989 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
991 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
992 outputCD->CopyData(cd,cellId,newCellId);
994 //---------------------------------------------------------------
997 aNewPts[1] = pts[13];
999 aNewPts[3] = pts[10];
1000 aNewPts[4] = pts[5];
1001 aNewPts[5] = pts[14];
1002 aNewPts[6] = pts[2];
1003 aNewPts[7] = pts[7];
1004 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
1006 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
1007 outputCD->CopyData(cd,cellId,newCellId);
1009 //---------------------------------------------------------------
1011 aNewPts[0] = pts[0];
1012 aNewPts[1] = pts[12];
1013 aNewPts[2] = pts[3];
1014 aNewPts[3] = pts[9];
1015 aNewPts[4] = pts[4];
1016 aNewPts[5] = pts[13];
1017 aNewPts[6] = pts[1];
1018 aNewPts[7] = pts[6];
1019 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
1021 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
1022 outputCD->CopyData(cd,cellId,newCellId);
1025 case VTK_TRIQUADRATIC_HEXAHEDRON:
1026 case VTK_QUADRATIC_HEXAHEDRON: {
1027 aCellType = VTK_POLYGON;
1030 //---------------------------------------------------------------
1031 aNewPts[0] = pts[0];
1032 aNewPts[1] = pts[8];
1033 aNewPts[2] = pts[1];
1034 aNewPts[3] = pts[17];
1035 aNewPts[4] = pts[5];
1036 aNewPts[5] = pts[12];
1037 aNewPts[6] = pts[4];
1038 aNewPts[7] = pts[16];
1040 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
1042 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
1044 outputCD->CopyData(cd,cellId,newCellId);
1046 //---------------------------------------------------------------
1047 aNewPts[0] = pts[1];
1048 aNewPts[1] = pts[9];
1049 aNewPts[2] = pts[2];
1050 aNewPts[3] = pts[18];
1051 aNewPts[4] = pts[6];
1052 aNewPts[5] = pts[13];
1053 aNewPts[6] = pts[5];
1054 aNewPts[7] = pts[17];
1056 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
1058 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
1060 outputCD->CopyData(cd,cellId,newCellId);
1062 //---------------------------------------------------------------
1063 aNewPts[0] = pts[2];
1064 aNewPts[1] = pts[10];
1065 aNewPts[2] = pts[3];
1066 aNewPts[3] = pts[19];
1067 aNewPts[4] = pts[7];
1068 aNewPts[5] = pts[14];
1069 aNewPts[6] = pts[6];
1070 aNewPts[7] = pts[18];
1072 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
1074 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
1076 outputCD->CopyData(cd,cellId,newCellId);
1078 //---------------------------------------------------------------
1079 aNewPts[0] = pts[3];
1080 aNewPts[1] = pts[11];
1081 aNewPts[2] = pts[0];
1082 aNewPts[3] = pts[16];
1083 aNewPts[4] = pts[4];
1084 aNewPts[5] = pts[15];
1085 aNewPts[6] = pts[7];
1086 aNewPts[7] = pts[19];
1088 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
1090 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
1092 outputCD->CopyData(cd,cellId,newCellId);
1094 //---------------------------------------------------------------
1095 aNewPts[0] = pts[0];
1096 aNewPts[1] = pts[8];
1097 aNewPts[2] = pts[1];
1098 aNewPts[3] = pts[9];
1099 aNewPts[4] = pts[2];
1100 aNewPts[5] = pts[10];
1101 aNewPts[6] = pts[3];
1102 aNewPts[7] = pts[11];
1104 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
1106 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
1108 outputCD->CopyData(cd,cellId,newCellId);
1110 //---------------------------------------------------------------
1111 aNewPts[0] = pts[4];
1112 aNewPts[1] = pts[12];
1113 aNewPts[2] = pts[5];
1114 aNewPts[3] = pts[13];
1115 aNewPts[4] = pts[6];
1116 aNewPts[5] = pts[14];
1117 aNewPts[6] = pts[7];
1118 aNewPts[7] = pts[15];
1120 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
1122 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
1124 outputCD->CopyData(cd,cellId,newCellId);
1128 case VTK_QUADRATIC_PYRAMID: {
1129 aCellType = VTK_POLYGON;
1132 //---------------------------------------------------------------
1133 aNewPts[0] = pts[0];
1134 aNewPts[1] = pts[8];
1135 aNewPts[2] = pts[3];
1136 aNewPts[3] = pts[12];
1137 aNewPts[4] = pts[4];
1138 aNewPts[5] = pts[9];
1140 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
1142 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
1144 outputCD->CopyData(cd,cellId,newCellId);
1146 //---------------------------------------------------------------
1147 aNewPts[0] = pts[0];
1148 aNewPts[1] = pts[9];
1149 aNewPts[2] = pts[4];
1150 aNewPts[3] = pts[10];
1151 aNewPts[4] = pts[1];
1152 aNewPts[5] = pts[5];
1154 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
1156 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
1158 outputCD->CopyData(cd,cellId,newCellId);
1160 //---------------------------------------------------------------
1161 aNewPts[0] = pts[1];
1162 aNewPts[1] = pts[10];
1163 aNewPts[2] = pts[4];
1164 aNewPts[3] = pts[11];
1165 aNewPts[4] = pts[2];
1166 aNewPts[5] = pts[6];
1168 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
1170 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
1172 outputCD->CopyData(cd,cellId,newCellId);
1174 //---------------------------------------------------------------
1175 aNewPts[0] = pts[2];
1176 aNewPts[1] = pts[11];
1177 aNewPts[2] = pts[4];
1178 aNewPts[3] = pts[12];
1179 aNewPts[4] = pts[3];
1180 aNewPts[5] = pts[7];
1182 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
1184 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
1186 outputCD->CopyData(cd,cellId,newCellId);
1188 //---------------------------------------------------------------
1190 aNewPts[0] = pts[0];
1191 aNewPts[1] = pts[5];
1192 aNewPts[2] = pts[1];
1193 aNewPts[3] = pts[6];
1194 aNewPts[4] = pts[2];
1195 aNewPts[5] = pts[7];
1196 aNewPts[6] = pts[3];
1197 aNewPts[7] = pts[8];
1199 newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
1201 InsertId( cellId, aCellType, myVTK2ObjIds, aDimension2VTK2ObjIds );
1203 outputCD->CopyData(cd,cellId,newCellId);
1206 } // case VTK_QUADRATIC_PYRAMID:
1216 vtkDebugMacro(<<"Extracted " << input->GetNumberOfPoints() << " points,"
1217 << output->GetNumberOfCells() << " cells.");
1223 cellIdsTmp->Delete();
1224 faceIdsTmp->Delete();
1231 // to sort myVTK2ObjIds vector by cell dimension (ascending)
1232 if( myStoreMapping && !aDimension2VTK2ObjIds.empty() )
1234 myVTK2ObjIds.clear();
1235 for( vtkIdType aDimension = 0; aDimension <= 2; aDimension++ )
1237 TMapOfVectorId::const_iterator anIter = aDimension2VTK2ObjIds.find( aDimension );
1238 if( anIter != aDimension2VTK2ObjIds.end() )
1240 const TVectorId& aCellIds = anIter->second;
1241 TVectorId::const_iterator anIdIter, anIdIterEnd = aCellIds.end();
1242 for( anIdIter = aCellIds.begin(); anIdIter != anIdIterEnd; anIdIter++ )
1244 const vtkIdType aCellId = *anIdIter;
1245 myVTK2ObjIds.push_back( aCellId );
1255 VTKViewer_GeometryFilter
1256 ::InsertId( const vtkIdType theCellId,
1257 const vtkIdType theCellType,
1258 TVectorId& theVTK2ObjIds,
1259 TMapOfVectorId& theDimension2VTK2ObjIds )
1261 theVTK2ObjIds.push_back( theCellId );
1264 switch( theCellType )
1267 case VTK_POLY_VERTEX:
1275 case VTK_TRIANGLE_STRIP:
1283 TVectorId& aCellIds = theDimension2VTK2ObjIds[ aDimension ];
1284 aCellIds.push_back( theCellId );
1288 VTKViewer_GeometryFilter
1289 ::SetInside(int theShowInside)
1291 if(myShowInside == theShowInside)
1294 myShowInside = theShowInside;
1299 VTKViewer_GeometryFilter
1302 return myShowInside;
1307 VTKViewer_GeometryFilter
1308 ::SetWireframeMode(int theIsWireframeMode)
1310 if(myIsWireframeMode == theIsWireframeMode)
1313 myIsWireframeMode = theIsWireframeMode;
1318 VTKViewer_GeometryFilter
1319 ::GetWireframeMode()
1321 return myIsWireframeMode;
1326 VTKViewer_GeometryFilter
1327 ::SetStoreMapping(int theStoreMapping)
1329 if(myStoreMapping == theStoreMapping)
1332 myStoreMapping = theStoreMapping;
1337 VTKViewer_GeometryFilter
1340 return myStoreMapping;
1344 vtkIdType VTKViewer_GeometryFilter::GetElemObjId( int theVtkID )
1346 if( theVtkID < 0 || theVtkID >= (int)myVTK2ObjIds.size() )
1348 return myVTK2ObjIds[theVtkID];
1352 void VTKViewer_GeometryFilter::BuildArcedPolygon(vtkIdType cellId,
1353 vtkUnstructuredGrid* input,
1354 vtkPolyData *output,
1355 TMapOfVectorId& theDimension2VTK2ObjIds,
1357 vtkIdType aCellType = VTK_POLYGON;
1358 vtkIdType *aNewPoints = NULL;
1359 vtkIdType aNbPoints = 0;
1360 vtkIdType newCellId;
1362 //Input and output cell data
1363 vtkCellData *cd = input->GetCellData();
1364 vtkCellData *outputCD = output->GetCellData();
1366 //Input and output scalars on point data
1367 vtkDataArray* inputScalars = input->GetPointData()->GetScalars();
1368 vtkDataArray* outputScalars = output->GetPointData()->GetScalars();
1370 std::vector<vtkPoints*> aCollection;
1371 std::vector< std::vector<double> > aScalarCollection;
1373 vtkCell* aCell = input->GetCell(cellId);
1374 switch(aCell->GetCellType()) {
1375 case VTK_QUADRATIC_TRIANGLE:
1377 //Get All points from input cell
1378 Pnt P0 = CreatePnt( aCell, inputScalars, 0 );
1379 Pnt P1 = CreatePnt( aCell, inputScalars, 1 );
1380 Pnt P2 = CreatePnt( aCell, inputScalars, 2 );
1381 Pnt P3 = CreatePnt( aCell, inputScalars, 3 );
1382 Pnt P4 = CreatePnt( aCell, inputScalars, 4 );
1383 Pnt P5 = CreatePnt( aCell, inputScalars, 5 );
1385 VTKViewer_ArcBuilder aBuilder1(P0,P3,P1,myMaxArcAngle); //Build arc using 0, 3 and 1 points
1387 cout << "Quadrangle arc 1 " << ( aBuilder1.GetStatus() == VTKViewer_ArcBuilder::Arc_Done ? "" : "NOT " ) << "done !!!" << endl;
1390 VTKViewer_ArcBuilder aBuilder2(P1,P4,P2,myMaxArcAngle); //Build arc using 1, 4 and 2 points
1392 cout << "Quadrangle arc 2 " << ( aBuilder2.GetStatus() == VTKViewer_ArcBuilder::Arc_Done ? "" : "NOT " ) << "done !!!" << endl;
1395 VTKViewer_ArcBuilder aBuilder3(P2,P5,P0,myMaxArcAngle); //Build arc using 2, 5 and 0 points
1397 cout << "Quadrangle arc 3 " << ( aBuilder3.GetStatus() == VTKViewer_ArcBuilder::Arc_Done ? "" : "NOT " ) << "done !!!" << endl;
1400 aCollection.push_back(aBuilder1.GetPoints());
1401 aCollection.push_back(aBuilder2.GetPoints());
1402 aCollection.push_back(aBuilder3.GetPoints());
1404 aScalarCollection.push_back(aBuilder1.GetScalarValues());
1405 aScalarCollection.push_back(aBuilder2.GetScalarValues());
1406 aScalarCollection.push_back(aBuilder3.GetScalarValues());
1409 case VTK_BIQUADRATIC_QUAD:
1410 case VTK_QUADRATIC_QUAD:
1412 //Get All points from input cell
1413 Pnt P0 = CreatePnt( aCell, inputScalars, 0 );
1414 Pnt P1 = CreatePnt( aCell, inputScalars, 1 );
1415 Pnt P2 = CreatePnt( aCell, inputScalars, 2 );
1416 Pnt P3 = CreatePnt( aCell, inputScalars, 3 );
1417 Pnt P4 = CreatePnt( aCell, inputScalars, 4 );
1418 Pnt P5 = CreatePnt( aCell, inputScalars, 5 );
1419 Pnt P6 = CreatePnt( aCell, inputScalars, 6 );
1420 Pnt P7 = CreatePnt( aCell, inputScalars, 7 );
1422 VTKViewer_ArcBuilder aBuilder1(P0,P4,P1,myMaxArcAngle); //Build arc using 0, 4 and 1 points
1424 cout << "Quadrangle arc 1 " << ( aBuilder1.GetStatus() == VTKViewer_ArcBuilder::Arc_Done ? "" : "NOT " ) << "done !!!" << endl;
1427 VTKViewer_ArcBuilder aBuilder2(P1,P5,P2,myMaxArcAngle); //Build arc using 1, 5 and 2 points
1429 cout << "Quadrangle arc 2 " << ( aBuilder2.GetStatus() == VTKViewer_ArcBuilder::Arc_Done ? "" : "NOT " ) << "done !!!" << endl;
1432 VTKViewer_ArcBuilder aBuilder3(P2,P6,P3,myMaxArcAngle); //Build arc using 2, 6 and 3 points
1434 cout << "Quadrangle arc 3 " << ( aBuilder3.GetStatus() == VTKViewer_ArcBuilder::Arc_Done ? "" : "NOT " ) << "done !!!" << endl;
1437 VTKViewer_ArcBuilder aBuilder4(P3,P7,P0,myMaxArcAngle); //Build arc using 3, 7 and 0 points
1439 cout << "Quadrangle arc 4 " << ( aBuilder4.GetStatus() == VTKViewer_ArcBuilder::Arc_Done ? "" : "NOT " ) << "done !!!" << endl;
1442 aCollection.push_back(aBuilder1.GetPoints());
1443 aCollection.push_back(aBuilder2.GetPoints());
1444 aCollection.push_back(aBuilder3.GetPoints());
1445 aCollection.push_back(aBuilder4.GetPoints());
1447 aScalarCollection.push_back(aBuilder1.GetScalarValues());
1448 aScalarCollection.push_back(aBuilder2.GetScalarValues());
1449 aScalarCollection.push_back(aBuilder3.GetScalarValues());
1450 aScalarCollection.push_back(aBuilder4.GetScalarValues());
1453 default: //Unsupported cell type
1458 const vtkIdType numFacePts = 3;
1459 vtkIdList *pts = vtkIdList::New();
1460 vtkPoints *coords = vtkPoints::New();
1461 aCellType = VTK_TRIANGLE;
1462 vtkIdType aNewPts[numFacePts];
1463 vtkIdType aTriangleId;
1465 vtkPolygon *aPlg = vtkPolygon::New();
1466 std::map<int, double> aPntId2ScalarValue;
1467 aNbPoints = MergevtkPoints(aCollection, aScalarCollection, aPlg->GetPoints(), aPntId2ScalarValue, aNewPoints);
1468 aPlg->GetPointIds()->SetNumberOfIds(aNbPoints);
1470 for(vtkIdType i = 0; i < aNbPoints;i++) {
1471 aPlg->GetPointIds()->SetId(i, aNewPoints[i]);
1474 aPlg->Triangulate(0,pts,coords);
1476 for (vtkIdType i=0; i < pts->GetNumberOfIds(); i+=3) {
1477 aNewPts[0] = output->GetPoints()->InsertNextPoint(coords->GetPoint(i));
1478 aNewPts[1] = output->GetPoints()->InsertNextPoint(coords->GetPoint(i+1));
1479 aNewPts[2] = output->GetPoints()->InsertNextPoint(coords->GetPoint(i+2));
1482 outputScalars->InsertNextTuple1(aPntId2ScalarValue[pts->GetId(i)]);
1483 outputScalars->InsertNextTuple1(aPntId2ScalarValue[pts->GetId(i+1)]);
1484 outputScalars->InsertNextTuple1(aPntId2ScalarValue[pts->GetId(i+2)]);
1487 aTriangleId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
1490 InsertId( cellId, aCellType, myVTK2ObjIds, theDimension2VTK2ObjIds );
1491 outputCD->CopyData(cd,cellId,aTriangleId);
1498 std::map<int, double> aPntId2ScalarValue;
1499 aNbPoints = MergevtkPoints(aCollection, aScalarCollection, output->GetPoints(), aPntId2ScalarValue, aNewPoints);
1501 for(vtkIdType i = 0; i < aNbPoints; i++)
1502 outputScalars->InsertNextTuple1(aPntId2ScalarValue[aNewPoints[i]]);
1503 newCellId = output->InsertNextCell(aCellType,aNbPoints,aNewPoints);
1504 outputCD->CopyData(cd,cellId,newCellId);
1507 InsertId( cellId, aCellType, myVTK2ObjIds, theDimension2VTK2ObjIds );
1511 delete [] aNewPoints;
1515 void VTKViewer_GeometryFilter::SetQuadraticArcMode(bool theFlag)
1517 if(myIsBuildArc != theFlag) {
1518 myIsBuildArc = theFlag;
1522 bool VTKViewer_GeometryFilter::GetQuadraticArcMode() const
1524 return myIsBuildArc;
1527 void VTKViewer_GeometryFilter::SetQuadraticArcAngle(double theMaxAngle)
1529 if(myMaxArcAngle != theMaxAngle) {
1530 myMaxArcAngle = theMaxAngle;
1535 double VTKViewer_GeometryFilter:: GetQuadraticArcAngle() const
1537 return myMaxArcAngle;
1540 int VTKViewer_GeometryFilter::GetAppendCoincident3D() const {
1541 // VSR 26/10/2012: see description of SHOW_COINCIDING_3D_PAL20314
1542 // in the top of this file
1543 #ifdef SHOW_COINCIDING_3D_PAL20314
1544 return myAppendCoincident3D;
1550 void VTKViewer_GeometryFilter::SetAppendCoincident3D(int theFlag) {
1551 if(myAppendCoincident3D != theFlag){
1552 myAppendCoincident3D = theFlag;