KPConv-PyTorch/cpp_wrappers/cpp_utils/cloud/cloud.cpp

67 lines
962 B
C++
Raw Normal View History

2020-03-31 19:42:35 +00:00
//
//
// 0==========================0
// | Local feature test |
// 0==========================0
//
// version 1.0 :
// >
//
//---------------------------------------------------
//
// Cloud source :
// Define usefull Functions/Methods
//
//----------------------------------------------------
//
// Hugues THOMAS - 10/02/2017
//
#include "cloud.h"
// Getters
// *******
PointXYZ max_point(std::vector<PointXYZ> points)
{
// Initialize limits
PointXYZ maxP(points[0]);
// Loop over all points
for (auto p : points)
{
if (p.x > maxP.x)
maxP.x = p.x;
if (p.y > maxP.y)
maxP.y = p.y;
if (p.z > maxP.z)
maxP.z = p.z;
}
return maxP;
}
PointXYZ min_point(std::vector<PointXYZ> points)
{
// Initialize limits
PointXYZ minP(points[0]);
// Loop over all points
for (auto p : points)
{
if (p.x < minP.x)
minP.x = p.x;
if (p.y < minP.y)
minP.y = p.y;
if (p.z < minP.z)
minP.z = p.z;
}
return minP;
}