Skip to content

Commit

Permalink
Merge pull request #2565 from PDAL/native-icp-const
Browse files Browse the repository at this point in the history
Native ICP constness
  • Loading branch information
chambbj committed Jun 11, 2019
2 parents d668d6e + 186ba52 commit 89dda35
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
18 changes: 9 additions & 9 deletions pdal/EigenUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ namespace pdal
#pragma warning (push)
#pragma warning (disable: 4244)

void calculateBounds(PointView& view, BOX2D& output)
void calculateBounds(const PointView& view, BOX2D& output)
{
for (PointId idx = 0; idx < view.size(); idx++)
{
Expand All @@ -64,7 +64,7 @@ void calculateBounds(PointView& view, BOX2D& output)
}


void calculateBounds(PointView& view, BOX3D& output)
void calculateBounds(const PointView& view, BOX3D& output)
{
for (PointId idx = 0; idx < view.size(); idx++)
{
Expand All @@ -76,7 +76,7 @@ void calculateBounds(PointView& view, BOX3D& output)
}
}

PointViewPtr demeanPointView(PointView& view)
PointViewPtr demeanPointView(const PointView& view)
{
using namespace Eigen;
using namespace Dimension;
Expand All @@ -98,7 +98,7 @@ PointViewPtr demeanPointView(PointView& view)
return outView;
}

PointViewPtr demeanPointView(PointView& view, double* centroid)
PointViewPtr demeanPointView(const PointView& view, double* centroid)
{
using namespace Eigen;
using namespace Dimension;
Expand All @@ -117,7 +117,7 @@ PointViewPtr demeanPointView(PointView& view, double* centroid)
return outView;
}

PointViewPtr transform(PointView& view, double* matrix)
PointViewPtr transform(const PointView& view, double* matrix)
{
using namespace Dimension;

Expand Down Expand Up @@ -156,7 +156,7 @@ void transformInPlace(PointView& view, double* matrix)
}
}

Eigen::Vector3d computeCentroid(PointView& view,
Eigen::Vector3d computeCentroid(const PointView& view,
const std::vector<PointId>& ids)
{
using namespace Eigen;
Expand Down Expand Up @@ -185,7 +185,7 @@ Eigen::Vector3d computeCentroid(PointView& view,
return centroid;
}

Eigen::Matrix3d computeCovariance(PointView& view,
Eigen::Matrix3d computeCovariance(const PointView& view,
const std::vector<PointId>& ids)
{
using namespace Eigen;
Expand Down Expand Up @@ -214,7 +214,7 @@ Eigen::Matrix3d computeCovariance(PointView& view,
return A * A.transpose() / (ids.size()-1);
}

uint8_t computeRank(PointView& view, const std::vector<PointId>& ids,
uint8_t computeRank(const PointView& view, const std::vector<PointId>& ids,
double threshold)
{
using namespace Eigen;
Expand All @@ -227,7 +227,7 @@ uint8_t computeRank(PointView& view, const std::vector<PointId>& ids,
return static_cast<uint8_t>(svd.rank());
}

Eigen::MatrixXd extendedLocalMinimum(PointView& view, int rows, int cols,
Eigen::MatrixXd extendedLocalMinimum(const PointView& view, int rows, int cols,
double cell_size, BOX2D bounds)
{
using namespace Dimension;
Expand Down
20 changes: 10 additions & 10 deletions pdal/EigenUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ typedef std::shared_ptr<PointView> PointViewPtr;
method. Otherwise, an exception will be thrown.
\endverbatim
*/
PDAL_DLL void calculateBounds(PointView& view, BOX2D& box);
PDAL_DLL void calculateBounds(PointView& view, BOX3D& box);
PDAL_DLL void calculateBounds(const PointView& view, BOX2D& box);
PDAL_DLL void calculateBounds(const PointView& view, BOX3D& box);

PDAL_DLL PointViewPtr demeanPointView(PointView& view);
PDAL_DLL PointViewPtr demeanPointView(PointView& ,double* centroid);
PDAL_DLL PointViewPtr transform(PointView&, double* matrix);
PDAL_DLL PointViewPtr demeanPointView(const PointView& view);
PDAL_DLL PointViewPtr demeanPointView(const PointView& ,double* centroid);
PDAL_DLL PointViewPtr transform(const PointView&, double* matrix);
PDAL_DLL void transformInPlace(PointView&, double* matrix);

/**
Expand All @@ -90,7 +90,7 @@ PDAL_DLL void transformInPlace(PointView&, double* matrix);
\param ids a vector of PointIds specifying a subset of points.
\return the 3D centroid of the XYZ dimensions.
*/
PDAL_DLL Eigen::Vector3d computeCentroid(PointView& view,
PDAL_DLL Eigen::Vector3d computeCentroid(const PointView& view,
const std::vector<PointId>& ids);

/**
Expand All @@ -115,7 +115,7 @@ PDAL_DLL Eigen::Vector3d computeCentroid(PointView& view,
\param ids a vector of PointIds specifying a subset of points.
\return the covariance matrix of the XYZ dimensions.
*/
PDAL_DLL Eigen::Matrix3d computeCovariance(PointView& view,
PDAL_DLL Eigen::Matrix3d computeCovariance(const PointView& view,
const std::vector<PointId>& ids);

/**
Expand Down Expand Up @@ -147,8 +147,8 @@ PDAL_DLL Eigen::Matrix3d computeCovariance(PointView& view,
\param ids a vector of PointIds specifying a subset of points.
\return the estimated rank.
*/
PDAL_DLL uint8_t computeRank(PointView& view, const std::vector<PointId>& ids,
double threshold);
PDAL_DLL uint8_t computeRank(const PointView& view,
const std::vector<PointId>& ids, double threshold);

/**
Find local minimum elevations by extended local minimum.
Expand All @@ -168,7 +168,7 @@ PDAL_DLL uint8_t computeRank(PointView& view, const std::vector<PointId>& ids,
\param bounds the 2D bounds of the PointView.
\return the matrix of minimum Z values (ignoring low outliers).
*/
PDAL_DLL Eigen::MatrixXd extendedLocalMinimum(PointView& view, int rows,
PDAL_DLL Eigen::MatrixXd extendedLocalMinimum(const PointView& view, int rows,
int cols, double cell_size, BOX2D bounds);

/**
Expand Down
4 changes: 2 additions & 2 deletions pdal/KDIndex.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ bool KDIndex<2>::kdtree_get_bbox(BBOX& bb) const
else
{
BOX2D bounds;
calculateBounds(const_cast<PointView&>(m_buf), bounds);
calculateBounds(m_buf, bounds);

bb[0].low = bounds.minx;
bb[0].high = bounds.maxx;
Expand All @@ -471,7 +471,7 @@ bool KDIndex<3>::kdtree_get_bbox(BBOX& bb) const
else
{
BOX3D bounds;
calculateBounds(const_cast<PointView&>(m_buf), bounds);
calculateBounds(m_buf, bounds);

bb[0].low = bounds.minx;
bb[0].high = bounds.maxx;
Expand Down
4 changes: 2 additions & 2 deletions pdal/PointView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@ void PointView::setFieldInternal(Dimension::Id dim, PointId idx,

void PointView::calculateBounds(BOX2D& output) const
{
pdal::calculateBounds(const_cast<PointView&>(*this), output);
pdal::calculateBounds(*this, output);
}


void PointView::calculateBounds(BOX3D& output) const
{
pdal::calculateBounds(const_cast<PointView&>(*this), output);
pdal::calculateBounds(*this, output);
}


Expand Down

0 comments on commit 89dda35

Please sign in to comment.