File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ namespace seed
5858 bool ReadNextPoint (PointCI& point) override ;
5959
6060 private:
61+ osg::Vec3d _offsetFirstPoint;
6162 laszip_point* _pointRead;// current reading point
6263 laszip_POINTER _laszipReader;
6364 laszip_header* _laszipHeader;
@@ -164,15 +165,21 @@ namespace seed
164165 // init offset
165166 if (_currentPointId == 0 )
166167 {
168+ _offsetFirstPoint[0 ] = _pointRead->X * _laszipHeader->x_scale_factor ;
169+ _offsetFirstPoint[1 ] = _pointRead->Y * _laszipHeader->y_scale_factor ;
170+ _offsetFirstPoint[2 ] = _pointRead->Z * _laszipHeader->z_scale_factor ;
171+
167172 _offset[0 ] = _laszipHeader->x_offset ;
168173 _offset[1 ] = _laszipHeader->y_offset ;
169174 _offset[2 ] = _laszipHeader->z_offset ;
175+
176+ _offset += _offsetFirstPoint;
170177 }
171178
172179 // add scale to coords
173- pt.P [0 ] = _pointRead->X * _laszipHeader->x_scale_factor ;
174- pt.P [1 ] = _pointRead->Y * _laszipHeader->y_scale_factor ;
175- pt.P [2 ] = _pointRead->Z * _laszipHeader->z_scale_factor ;
180+ pt.P [0 ] = _pointRead->X * _laszipHeader->x_scale_factor - _offsetFirstPoint[ 0 ] ;
181+ pt.P [1 ] = _pointRead->Y * _laszipHeader->y_scale_factor - _offsetFirstPoint[ 1 ] ;
182+ pt.P [2 ] = _pointRead->Z * _laszipHeader->z_scale_factor - _offsetFirstPoint[ 2 ] ;
176183
177184 auto & rgb = _pointRead->rgb ;
178185 pt.C [0 ] = Color8Bits (rgb[0 ]);
You can’t perform that action at this time.
0 commit comments