MCPcopy Create free account
hub / github.com/LAStools/LAStools / coarsen

Method coarsen

LASzip/src/lasquadtree.cpp:409–428  ·  view source on GitHub ↗

returns the indices of parent and siblings for the specified cell index

Source from the content-addressed store, hash-verified

407
408// returns the indices of parent and siblings for the specified cell index
409BOOL LASquadtree::coarsen(const I32 cell_index, I32* coarser_cell_index, U32* num_cell_indices, I32** cell_indices)
410{
411 if (cell_index < 0) return FALSE;
412 U32 level = get_level((U32)cell_index);
413 if (level == 0) return FALSE;
414 U32 level_index = get_level_index((U32)cell_index, level);
415 level_index = level_index >> 2;
416 if (coarser_cell_index) (*coarser_cell_index) = get_cell_index(level_index, level-1);
417 if (num_cell_indices && cell_indices)
418 {
419 (*num_cell_indices) = 4;
420 (*cell_indices) = (I32*)coarser_indices;
421 level_index = level_index << 2;
422 (*cell_indices)[0] = get_cell_index(level_index + 0, level);
423 (*cell_indices)[1] = get_cell_index(level_index + 1, level);
424 (*cell_indices)[2] = get_cell_index(level_index + 2, level);
425 (*cell_indices)[3] = get_cell_index(level_index + 3, level);
426 }
427 return TRUE;
428}
429
430// returns the level index of the cell index at the specified level
431U32 LASquadtree::get_level_index(U32 cell_index, U32 level) const

Callers 1

completeMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected