dispmap/svpointcloud.cpp
Andrey Tkachenko 826af318d3 point cloud
2014-07-25 18:44:53 +04:00

34 lines
713 B
C++

#include "svpointcloud.h"
SvPointCloud::SvPointCloud(uint width, uint height)
{
m_pointFiledHeight = height;
m_pointFiledWidth = width;
m_pointField = new SvPoint**[height]();
for (uint y = 0; y < height; y++) {
m_pointField[y] = new SvPoint*[width]();
}
}
SvPointCloud::~SvPointCloud()
{
for (uint y = 0; y < m_pointFiledHeight; y++) {
for (uint x = 0; x < m_pointFiledWidth; x++) {
if (m_pointField[y][x]) {
delete m_pointField[y][x];
}
}
delete[] m_pointField[y];
}
delete[] m_pointField;
}
void SvPointCloud::addPoint(SvPoint point)
{
m_pointField[point.y()][point.x()] = new SvPoint(point);
}