资源简介
该代码实现了点云读取,点云重心计算,八叉树,邻域搜索等基本功能,通过opengl实现点云可视化,对于初学者来说是一个较为基础的参考
代码片段和文件信息
#include “Neighborhood.h“
//local
#include “PointCloud.h“
#include “Matrix.h“
//system
#include
#include
using namespace CCLib;
Neighbourhood::Neighbourhood(PointCloud* associatedCloud)
: structuresValidity(DEPRECATED)
m_associatedCloud(associatedCloud)
{
assert(m_associatedCloud);
}
void Neighbourhood::reset()
{
structuresValidity = DEPRECATED;
}
const CCVector3* Neighbourhood::getGravityCenter()
{
if (!(structuresValidity & GRAVITY_CENTER))
computeGravityCenter();
return ((structuresValidity & GRAVITY_CENTER) ? &theGravityCenter : 0);
}
void Neighbourhood::setGravityCenter(const CCVector3& G)
{
theGravityCenter = G;
structuresValidity |= GRAVITY_CENTER;
}
const float* Neighbourhood::getLSQPlane()
{
if (!(structuresValidity & LSQ_PLANE))
computeLeastSquareBestFittingPlane();
return ((structuresValidity & LSQ_PLANE) ? theLSQPlaneEquation : 0);
}
void Neighbourhood::setLSQPlane(const float eq[4]
const CCVector3& X
const CCVector3& Y
const CCVector3& N)
{
memcpy(theLSQPlaneEquation eq sizeof(float) * 4);
theLSQPlaneVectors[0] = X;
theLSQPlaneVectors[1] = Y;
theLSQPlaneVectors[2] = N;
structuresValidity |= LSQ_PLANE;
}
const CCVector3* Neighbourhood::getLSQPlaneX()
{
if (!(structuresValidity & LSQ_PLANE))
computeLeastSquareBestFittingPlane();
return ((structuresValidity & LSQ_PLANE) ? theLSQPlaneVectors : 0);
}
const CCVector3* Neighbourhood::getLSQPlaneY()
{
if (!(structuresValidity & LSQ_PLANE))
computeLeastSquareBestFittingPlane();
return ((structuresValidity & LSQ_PLANE) ? theLSQPlaneVectors + 1 : 0);
}
const CCVector3* Neighbourhood::getLSQPlaneNormal()
{
if (!(structuresValidity & LSQ_PLANE))
computeLeastSquareBestFittingPlane();
return ((structuresValidity & LSQ_PLANE) ? theLSQPlaneVectors + 2 : 0);
}
//const float* Neighbourhood::getHeightFunction(unsigned char* dimsHF/*=0*/)
//{
// if (!(structuresValidity & HEIGHT_FUNCTION))
// computeHeightFunction();
// if (dimsHF)
// {
// dimsHF[0] = theHeightFunctionDirections[0];
// dimsHF[1] = theHeightFunctionDirections[1];
// dimsHF[2] = theHeightFunctionDirections[2];
// }
// return ((structuresValidity & HEIGHT_FUNCTION) ? theHeightFunction : 0);
//}
const double* Neighbourhood::get3DQuadric()
{
if (!(structuresValidity & QUADRIC_3D))
compute3DQuadric();
return ((structuresValidity & QUADRIC_3D) ? the3DQuadric : 0);
}
void Neighbourhood::computeGravityCenter()
{
//invalidate previous centroid (if any)
structuresValidity &= (~GRAVITY_CENTER);
assert(m_associatedCloud);
unsigned count = (m_associatedCloud ? m_associatedCloud->size() : 0);
if (!count)
return;
//sum
CCVector3d Psum(0 0 0);
for (unsigned i = 0; i {
const CCVector3* P = m_associatedCloud->getPoint(i);
Psum.x += P->x;
Psum.y += P->y;
Psum.z += P->z;
}
CCVector3 G(static_cast(Psum.x / cou
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
..A..H. 47616 2019-05-21 09:23 PointVisulization\.vs\PointVisulization\v14\.suo
文件 412896 2017-05-09 08:34 PointVisulization\PointVisulization\1759.xyz
文件 135795 2017-05-10 15:26 PointVisulization\PointVisulization\1795index.txt
文件 4720 2017-05-11 10:29 PointVisulization\PointVisulization\Camera.h
文件 264 2017-03-24 09:54 PointVisulization\PointVisulization\Const.h
文件 6183 2017-05-10 15:28 PointVisulization\PointVisulization\IndexCloud.txt
文件 24577 2017-05-03 17:58 PointVisulization\PointVisulization\Matrix.h
文件 9516 2017-05-04 08:27 PointVisulization\PointVisulization\Neighborhood.cpp
文件 7692 2017-05-03 18:00 PointVisulization\PointVisulization\Neighborhood.h
文件 17180 2017-03-24 10:25 PointVisulization\PointVisulization\Octree.cpp
文件 6143 2017-03-24 10:25 PointVisulization\PointVisulization\Octree.h
文件 1158 2017-04-06 15:25 PointVisulization\PointVisulization\opengl_WIN32-release.props
文件 3855 2017-03-30 16:23 PointVisulization\PointVisulization\PointCloud.cpp
文件 1527 2017-05-02 08:10 PointVisulization\PointVisulization\PointCloud.h
文件 4705 2019-03-04 16:45 PointVisulization\PointVisulization\PointVisulization.vcxproj
文件 2212 2019-03-04 16:45 PointVisulization\PointVisulization\PointVisulization.vcxproj.filters
文件 165 2017-05-03 15:23 PointVisulization\PointVisulization\PointVisulization.vcxproj.user
文件 904189 2019-03-04 16:45 PointVisulization\PointVisulization\Release\Neighborhood.obj
文件 970480 2019-03-04 16:45 PointVisulization\PointVisulization\Release\Octree.obj
文件 993765 2019-03-04 16:45 PointVisulization\PointVisulization\Release\PointCloud.obj
文件 7788 2019-05-20 09:39 PointVisulization\PointVisulization\Release\PointVis.1ADCBAF6.tlog\cl.command.1.tlog
文件 103670 2019-05-20 09:39 PointVisulization\PointVisulization\Release\PointVis.1ADCBAF6.tlog\cl.read.1.tlog
文件 3802 2019-05-20 09:39 PointVisulization\PointVisulization\Release\PointVis.1ADCBAF6.tlog\cl.write.1.tlog
文件 3938 2019-05-20 09:39 PointVisulization\PointVisulization\Release\PointVis.1ADCBAF6.tlog\li
文件 6094 2019-05-20 09:39 PointVisulization\PointVisulization\Release\PointVis.1ADCBAF6.tlog\li
文件 1624 2019-05-20 09:39 PointVisulization\PointVisulization\Release\PointVis.1ADCBAF6.tlog\li
文件 209 2019-05-20 09:39 PointVisulization\PointVisulization\Release\PointVis.1ADCBAF6.tlog\PointVisulization.lastbuildstate
文件 4089 2019-05-20 09:39 PointVisulization\PointVisulization\Release\PointVisulization.log
文件 1540692 2019-05-20 09:39 PointVisulization\PointVisulization\Release\Source.obj
文件 580080 2019-03-04 16:45 PointVisulization\PointVisulization\Release\triangle.obj
............此处省略28个文件信息
评论
共有 条评论