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

Method ComputeBeginAndEnd

Common/DataModel/vtkExtractStructuredGridHelper.cxx:262–309  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

260}
261
262VTK_ABI_NAMESPACE_BEGIN
263//------------------------------------------------------------------------------
264void vtkExtractStructuredGridHelper::ComputeBeginAndEnd(
265 int inExt[6], int voi[6], int begin[3], int end[3])
266{
267 vtkBoundingBox inExtB(inExt[0], inExt[1], inExt[2], inExt[3], inExt[4], inExt[5]);
268 vtkBoundingBox uExtB(voi[0], voi[1], voi[2], voi[3], voi[4], voi[5]);
269 std::fill(begin, begin + 3, 0);
270 std::fill(end, end + 3, -1);
271
272 int uExt[6];
273 if (uExtB.IntersectBox(inExtB))
274 {
275
276 for (int i = 0; i < 6; ++i)
277 {
278 uExt[i] = roundToInt(uExtB.GetBound(i));
279 }
280
281 // Find the first and last indices in the map that are
282 // within data extents. These are the extents of the
283 // output data.
284 for (int dim = 0; dim < 3; ++dim)
285 {
286 for (int idx = 0; idx < this->GetSize(dim); ++idx)
287 {
288 int extVal = this->GetMappedExtentValueFromIndex(dim, idx);
289 if (extVal >= uExt[2 * dim] && extVal <= uExt[2 * dim + 1])
290 {
291 begin[dim] = idx;
292 break;
293 }
294 } // END for all indices with
295
296 for (int idx = this->GetSize(dim) - 1; idx >= 0; --idx)
297 {
298 int extVal = this->GetMappedExtentValueFromIndex(dim, idx);
299 if (extVal <= uExt[2 * dim + 1] && extVal >= uExt[2 * dim])
300 {
301 end[dim] = idx;
302 break;
303 }
304 } // END for all indices
305
306 } // END for all dimensions
307
308 } // END if box intersects
309}
310
311//------------------------------------------------------------------------------
312void vtkExtractStructuredGridHelper::CopyPointsAndPointData(int inExt[6], int outExt[6],

Callers

nothing calls this directly

Calls 6

GetSizeMethod · 0.95
roundToIntFunction · 0.85
GetBoundMethod · 0.80
fillFunction · 0.50
IntersectBoxMethod · 0.45

Tested by

no test coverage detected