MCPcopy Create free account
hub / github.com/Kitware/VTK / TransformCellInformation

Method TransformCellInformation

Filters/Geometry/vtkProjectSphereFilter.cxx:198–402  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

196
197//------------------------------------------------------------------------------
198void vtkProjectSphereFilter::TransformCellInformation(
199 vtkPointSet* input, vtkPointSet* output, vtkIdList* polePointIds)
200{
201 // a map from the old point to the newly created point for split cells
202 std::map<vtkIdType, vtkIdType> boundaryMap;
203
204 double TOLERANCE = .0001;
205 vtkNew<vtkPoints> tmpPoints;
206 tmpPoints->DeepCopy(output->GetPoints());
207 output->GetPoints()->Reset();
208 vtkNew<vtkMergePoints> locator;
209 locator->InitPointInsertion(
210 output->GetPoints(), output->GetBounds(), tmpPoints->GetNumberOfPoints());
211 double coord[3];
212 for (vtkIdType i = 0; i < tmpPoints->GetNumberOfPoints(); i++)
213 {
214 // creating a duplicate of the input point and inserting them in the locator
215 // is a bit annoying but required for building up the locator properly
216 // otherwise it won't know these points exist
217 tmpPoints->GetPoint(i, coord);
218 locator->InsertNextPoint(coord);
219 }
220
221 vtkIdType numberOfCells = input->GetNumberOfCells();
222 vtkCellArray* connectivity = nullptr;
223 vtkUnstructuredGrid* ugrid = vtkUnstructuredGrid::SafeDownCast(output);
224 vtkPolyData* poly = vtkPolyData::SafeDownCast(output);
225 if (ugrid)
226 {
227 ugrid->Allocate(numberOfCells);
228 connectivity = ugrid->GetCells();
229 }
230 else if (poly)
231 {
232 poly->AllocateEstimate(numberOfCells, 3);
233 connectivity = poly->GetPolys();
234 }
235 output->GetCellData()->CopyAllOn();
236 output->GetCellData()->CopyAllocate(input->GetCellData(), input->GetNumberOfCells());
237 vtkPointData* pointData = output->GetPointData();
238 pointData->CopyAllOn();
239 pointData->CopyAllocate(pointData, output->GetNumberOfPoints());
240
241 vtkNew<vtkIdList> cellPoints;
242 vtkNew<vtkIdList> skippedCells;
243 vtkIdType mostPointsInCell = 0;
244 for (vtkIdType cellId = 0; cellId < numberOfCells; cellId++)
245 {
246 if (this->CheckAbort())
247 {
248 break;
249 }
250 bool onLeftBoundary = false;
251 bool onRightBoundary = false;
252 bool leftSideInterior = false; // between SplitLongitude and SplitLongitude+90
253 bool rightSideInterior = false; // between SplitLongitude+270 and SplitLongitude+360
254 bool middleInterior = false; // between SplitLongitude+90 and SplitLongitude+270
255

Callers 1

RequestDataMethod · 0.95

Calls 15

SplitCellMethod · 0.95
TransformTensorsMethod · 0.95
AllocateEstimateMethod · 0.80
GetPolysMethod · 0.80
CheckAbortMethod · 0.80
IsIdMethod · 0.80
InsertNextIdMethod · 0.80
DeleteCellsMethod · 0.80
DeepCopyMethod · 0.45
GetPointsMethod · 0.45
ResetMethod · 0.45
InitPointInsertionMethod · 0.45

Tested by

no test coverage detected