dispmap/svpointcloud.cpp

36 lines
792 B
C++
Raw Normal View History

2014-07-23 20:50:12 +04:00
#include "svpointcloud.h"
2014-07-28 20:25:39 +04:00
#include <string.h>
2014-07-23 20:50:12 +04:00
2014-07-25 11:32:00 +04:00
SvPointCloud::SvPointCloud(uint width, uint height)
2014-07-23 20:50:12 +04:00
{
2014-07-28 20:25:39 +04:00
m_pointFieldHeight = height;
m_pointFieldWidth = width;
2014-07-25 11:32:00 +04:00
2014-07-28 20:25:39 +04:00
m_pointField = new SvPoint**[height];
2014-07-25 11:32:00 +04:00
for (uint y = 0; y < height; y++) {
2014-07-28 20:25:39 +04:00
m_pointField[y] = new SvPoint*[width];
memset(m_pointField[y], 0, sizeof(SvPoint*) * width);
2014-07-25 11:32:00 +04:00
}
2014-07-23 20:50:12 +04:00
}
2014-07-25 11:32:00 +04:00
SvPointCloud::~SvPointCloud()
2014-07-23 20:50:12 +04:00
{
2014-07-28 20:25:39 +04:00
for (uint y = 0; y < m_pointFieldHeight; y++) {
for (uint x = 0; x < m_pointFieldWidth; x++) {
2014-07-25 18:44:11 +04:00
if (m_pointField[y][x]) {
delete m_pointField[y][x];
}
}
2014-07-25 11:32:00 +04:00
delete[] m_pointField[y];
}
2014-07-23 20:50:12 +04:00
2014-07-25 11:32:00 +04:00
delete[] m_pointField;
}
2014-07-28 20:25:39 +04:00
void SvPointCloud::addPoint(SvPoint &point)
2014-07-25 11:32:00 +04:00
{
2014-07-25 18:44:11 +04:00
m_pointField[point.y()][point.x()] = new SvPoint(point);
2014-07-23 20:50:12 +04:00
}