File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ namespace seed
5858bool ReadNextPoint (PointCI& point) override ;
5959
6060private:
61+ osg::Vec3d _offsetFirstPoint;
6162laszip_point* _pointRead;// current reading point
6263laszip_POINTER _laszipReader;
6364laszip_header* _laszipHeader;
@@ -164,15 +165,21 @@ namespace seed
164165// init offset
165166if (_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
177184auto & rgb = _pointRead->rgb ;
178185pt.C [0 ] = Color8Bits (rgb[0 ]);
You can’t perform that action at this time.
0 commit comments