Merge pull request #914 from LaurensVoerman/las_recenter
ReaderWriterLAS recenter bug fixed, final batch of points was missed in translating the center point.
This commit is contained in:
commit
d501def836
@ -214,6 +214,24 @@ class ReaderWriterLAS : public osgDB::ReaderWriter
|
|||||||
double mid_y = 0.5*(my.second + my.first);
|
double mid_y = 0.5*(my.second + my.first);
|
||||||
double mid_z = 0.5*(mz.second + mz.first);
|
double mid_z = 0.5*(mz.second + mz.first);
|
||||||
osg::Vec3 midVec(mid_x, mid_y, mid_z);
|
osg::Vec3 midVec(mid_x, mid_y, mid_z);
|
||||||
|
|
||||||
|
geometry->setUseDisplayList(true);
|
||||||
|
geometry->setUseVertexBufferObjects(true);
|
||||||
|
geometry->setVertexArray(vertices);
|
||||||
|
if (singleColor)
|
||||||
|
{
|
||||||
|
colours->resize(1);
|
||||||
|
geometry->setColorArray(colours, osg::Array::BIND_OVERALL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
geometry->setColorArray(colours, osg::Array::BIND_PER_VERTEX);
|
||||||
|
|
||||||
|
}
|
||||||
|
geometry->addPrimitiveSet(new osg::DrawArrays(GL_POINTS, 0, vertices->size()));
|
||||||
|
|
||||||
|
geode->addDrawable(geometry);
|
||||||
|
|
||||||
if (_recenter)
|
if (_recenter)
|
||||||
{
|
{
|
||||||
//Transform vertices to midpoint
|
//Transform vertices to midpoint
|
||||||
@ -239,24 +257,6 @@ class ReaderWriterLAS : public osgDB::ReaderWriter
|
|||||||
<< std::endl << std::endl;
|
<< std::endl << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
geometry->setUseDisplayList(true);
|
|
||||||
geometry->setUseVertexBufferObjects(true);
|
|
||||||
geometry->setVertexArray(vertices);
|
|
||||||
if (singleColor)
|
|
||||||
{
|
|
||||||
colours->resize(1);
|
|
||||||
geometry->setColorArray(colours, osg::Array::BIND_OVERALL);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
geometry->setColorArray(colours, osg::Array::BIND_PER_VERTEX);
|
|
||||||
|
|
||||||
}
|
|
||||||
geometry->addPrimitiveSet(new osg::DrawArrays(GL_POINTS, 0, vertices->size()));
|
|
||||||
|
|
||||||
geode->addDrawable(geometry);
|
|
||||||
|
|
||||||
|
|
||||||
// MatrixTransform with the mid-point translation
|
// MatrixTransform with the mid-point translation
|
||||||
|
|
||||||
osg::MatrixTransform *mt = new osg::MatrixTransform;
|
osg::MatrixTransform *mt = new osg::MatrixTransform;
|
||||||
|
Loading…
Reference in New Issue
Block a user