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

Method get_cell_bounding_box

src/lasquadtree.cpp:106–150  ·  view source on GitHub ↗

returns the bounding box of the cell that x & y fall into at the specified level

Source from the content-addressed store, hash-verified

104
105// returns the bounding box of the cell that x & y fall into at the specified level
106void LASquadtree::get_cell_bounding_box(const F64 x, const F64 y, U32 level, F32* min, F32* max) const
107{
108 volatile float cell_mid_x;
109 volatile float cell_mid_y;
110 float cell_min_x, cell_max_x;
111 float cell_min_y, cell_max_y;
112
113 cell_min_x = min_x;
114 cell_max_x = max_x;
115 cell_min_y = min_y;
116 cell_max_y = max_y;
117
118 while (level)
119 {
120 cell_mid_x = (cell_min_x + cell_max_x)/2;
121 cell_mid_y = (cell_min_y + cell_max_y)/2;
122 if (x < cell_mid_x)
123 {
124 cell_max_x = cell_mid_x;
125 }
126 else
127 {
128 cell_min_x = cell_mid_x;
129 }
130 if (y < cell_mid_y)
131 {
132 cell_max_y = cell_mid_y;
133 }
134 else
135 {
136 cell_min_y = cell_mid_y;
137 }
138 level--;
139 }
140 if (min)
141 {
142 min[0] = cell_min_x;
143 min[1] = cell_min_y;
144 }
145 if (max)
146 {
147 max[0] = cell_max_x;
148 max[1] = cell_max_y;
149 }
150}
151
152// returns the bounding box of the cell that x & y fall into
153void LASquadtree::get_cell_bounding_box(const F64 x, const F64 y, F32* min, F32* max) const

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected