CppCheck : Add const reference and remove unused variable

This commit is contained in:
Magne Sjaastad
2017-09-07 21:24:06 +02:00
parent 6338166708
commit 228c8d1f87
2 changed files with 3 additions and 4 deletions

View File

@@ -452,12 +452,10 @@ std::pair<cvf::Vec3d, cvf::Vec3d> RigCellGeometryTools::getLineThroughBoundingBo
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RigCellGeometryTools::getLengthOfPolygonAlongLine(std::pair<cvf::Vec3d, cvf::Vec3d> line, std::vector<cvf::Vec3d> polygon)
double RigCellGeometryTools::getLengthOfPolygonAlongLine(const std::pair<cvf::Vec3d, cvf::Vec3d>& line, const std::vector<cvf::Vec3d>& polygon)
{
cvf::BoundingBox lineBoundingBox;
std::vector<cvf::Vec3d> pointsOnLine;
for (cvf::Vec3d polygonPoint : polygon)
{
cvf::Vec3d pointOnLine = cvf::GeometryTools::projectPointOnLine(line.first, line.second, polygonPoint, nullptr);
@@ -465,6 +463,7 @@ double RigCellGeometryTools::getLengthOfPolygonAlongLine(std::pair<cvf::Vec3d, c
}
double length = lineBoundingBox.extent().length();
return length;
}

View File

@@ -51,7 +51,7 @@ public:
static std::pair<cvf::Vec3d, cvf::Vec3d> getLineThroughBoundingBox(cvf::Vec3d lineDirection, cvf::BoundingBox polygonBBox, cvf::Vec3d pointOnLine);
static double getLengthOfPolygonAlongLine(std::pair<cvf::Vec3d, cvf::Vec3d> line, std::vector<cvf::Vec3d> polygon);
static double getLengthOfPolygonAlongLine(const std::pair<cvf::Vec3d, cvf::Vec3d>& line, const std::vector<cvf::Vec3d>& polygon);
private:
static std::vector<cvf::Vec3d> ajustPolygonToAvoidIntersectionsAtVertex(const std::vector<cvf::Vec3d>& polyLine,