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

Method EPToctree

LASlib/src/lascopc.cpp:119–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117}
118
119EPToctree::EPToctree(const LASheader& header)
120{
121 if (header.vlr_copc_info)
122 {
123 xmin = header.vlr_copc_info->center_x - header.vlr_copc_info->halfsize;
124 ymin = header.vlr_copc_info->center_y - header.vlr_copc_info->halfsize;
125 zmin = header.vlr_copc_info->center_z - header.vlr_copc_info->halfsize;
126 xmax = header.vlr_copc_info->center_x + header.vlr_copc_info->halfsize;
127 ymax = header.vlr_copc_info->center_y + header.vlr_copc_info->halfsize;
128 zmax = header.vlr_copc_info->center_z + header.vlr_copc_info->halfsize;
129 point_spacing = header.vlr_copc_info->spacing;
130 max_depth = 0;
131 grid_size = 0;
132 }
133 else
134 {
135 F64 center_x = (header.min_x + header.max_x)/2;
136 F64 center_y = (header.min_y + header.max_y)/2;
137 F64 center_z = (header.min_z + header.max_z)/2;
138 F64 halfsize = MAX3(header.max_x - header.min_x, header.max_y - header.min_y, header.max_z - header.min_z)/2;
139
140 xmin = center_x - halfsize;
141 ymin = center_y - halfsize;
142 zmin = center_z - halfsize;
143 xmax = center_x + halfsize;
144 ymax = center_y + halfsize;
145 zmax = center_z + halfsize;
146 point_spacing = 0;
147 max_depth = 0;
148 grid_size = 0;
149 }
150
151 if (header.vlr_copc_info && header.vlr_copc_entries)
152 {
153 registry.reserve(header.number_of_copc_entries);
154
155 U64 ni = 0;
156 U64 nf = 0;
157 for (U32 i = 0 ; i < header.number_of_copc_entries ; i++)
158 {
159 if (header.vlr_copc_entries[i].point_count > 0)
160 {
161 ni = nf;
162 nf = ni + header.vlr_copc_entries[i].point_count-1;
163 EPToctant octant(header.vlr_copc_entries[i], xmin, ymin, zmin, xmax, ymax, zmax, ni, nf);
164 registry[(EPTkey)octant] = octant;
165 if (octant.d > max_depth) max_depth = octant.d;
166 nf++;
167 }
168 else
169 {
170 // Octants with 0 point must be added to be able to reccurse the octree
171 EPToctant octant(header.vlr_copc_entries[i], xmin, ymin, zmin, xmax, ymax, zmax, 0, 0);
172 registry[(EPTkey)octant] = octant;
173 }
174 }
175 }
176}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected