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

Method Merge

Common/DataModel/vtkPixelExtent.cxx:201–292  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

199
200//------------------------------------------------------------------------------
201void vtkPixelExtent::Merge(deque<vtkPixelExtent>& exts)
202{
203 size_t ne = exts.size();
204
205 // working in point space simplifies things because
206 // points overlap in adjacent extents while cells do not
207 deque<vtkPixelExtent> tmpExts(ne);
208 for (size_t t = 0; t < ne; ++t)
209 {
210 vtkPixelExtent ext(exts[t]);
211 ext.CellToNode();
212 tmpExts[t] = ext;
213 }
214
215 // one pass for each direction
216 for (int q = 0; q < 2; ++q)
217 {
218 int qq = 2 * q;
219 // consider each extent as a target to be merged
220 for (size_t t = 0; t < ne; ++t)
221 {
222 // if a merger occurs the merged extent is added
223 // as a new target with the constituents marked empty
224 // and the current pass is terminated early
225 bool nextPass = false;
226
227 // current target
228 vtkPixelExtent& ext0 = tmpExts[t];
229 if (ext0.Empty())
230 {
231 // was merged in preceding pass
232 continue;
233 }
234
235 for (size_t c = 0; c < ne; ++c)
236 {
237 if (c == t)
238 {
239 // don't attempt merge with self
240 continue;
241 }
242
243 // candidate
244 vtkPixelExtent& ext1 = tmpExts[c];
245 if (ext1.Empty())
246 {
247 // was merged in preceding pass
248 continue;
249 }
250
251 // must be same size and coordinate in merge dir
252 if ((ext0[qq] == ext1[qq]) && (ext0[qq + 1] == ext1[qq + 1]))
253 {
254 // must overlap overlap
255 vtkPixelExtent ext2(ext0);
256 ext2 &= ext1;
257 if (!ext2.Empty())
258 {

Callers

nothing calls this directly

Calls 7

CellToNodeMethod · 0.60
NodeToCellMethod · 0.60
sizeMethod · 0.45
EmptyMethod · 0.45
push_backMethod · 0.45
ClearMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected