MCPcopy Create free account
hub / github.com/LASzip/LASzip / complete

Method complete

src/lasindex.cpp:84–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82}
83
84void LASindex::complete(U32 minimum_points, I32 maximum_intervals)
85{
86 LASMessage(LAS_VERBOSE, "before complete %u %d", minimum_points, maximum_intervals);
87 if (get_message_log_level() <= LAS_VERBOSE)
88 print();
89 if (minimum_points)
90 {
91 I32 hash1 = 0;
92 my_cell_hash cell_hash[2];
93 // insert all cells into hash1
94 interval->get_cells();
95 while (interval->has_cells())
96 {
97 cell_hash[hash1][interval->index] = interval->full;
98 }
99 while (cell_hash[hash1].size())
100 {
101 I32 hash2 = (hash1+1)%2;
102 cell_hash[hash2].clear();
103 // coarsen if a coarser cell will still have fewer than minimum_points (and points in all subcells)
104 BOOL coarsened = FALSE;
105 U32 i, full;
106 I32 coarser_index;
107 U32 num_indices;
108 U32 num_filled;
109 I32* indices;
110 my_cell_hash::iterator hash_element_inner;
111 my_cell_hash::iterator hash_element_outer = cell_hash[hash1].begin();
112 while (hash_element_outer != cell_hash[hash1].end())
113 {
114 if ((*hash_element_outer).second)
115 {
116 if (spatial->coarsen((*hash_element_outer).first, &coarser_index, &num_indices, &indices))
117 {
118 full = 0;
119 num_filled = 0;
120 for (i = 0; i < num_indices; i++)
121 {
122 if ((*hash_element_outer).first == indices[i])
123 {
124 hash_element_inner = hash_element_outer;
125 }
126 else
127 {
128 hash_element_inner = cell_hash[hash1].find(indices[i]);
129 }
130 if (hash_element_inner != cell_hash[hash1].end())
131 {
132 full += (*hash_element_inner).second;
133 (*hash_element_inner).second = 0;
134 num_filled++;
135 }
136 }
137 if ((full < minimum_points) && (num_filled == num_indices))
138 {
139 interval->merge_cells(num_indices, indices, coarser_index);
140 coarsened = TRUE;
141 cell_hash[hash2][coarser_index] = full;

Callers 1

Calls 8

LASMessageFunction · 0.85
get_cellsMethod · 0.80
has_cellsMethod · 0.80
coarsenMethod · 0.80
merge_cellsMethod · 0.80
manage_cellMethod · 0.80
get_number_cellsMethod · 0.80
merge_intervalsMethod · 0.45

Tested by

no test coverage detected