Tests: add more unit tests for Points module

This commit is contained in:
wmayer
2024-03-12 15:39:42 +01:00
committed by wwmayer
parent ed573fcf86
commit 84202c4b1e
3 changed files with 250 additions and 16 deletions

View File

@@ -197,6 +197,8 @@ AscReader::AscReader() = default;
void AscReader::read(const std::string& filename)
{
points.load(filename.c_str());
this->height = 1;
this->width = points.size();
}
// ----------------------------------------------------------------------------
@@ -546,8 +548,6 @@ PlyReader::PlyReader() = default;
void PlyReader::read(const std::string& filename)
{
clear();
this->width = 1;
this->height = 0;
Base::FileInfo fi(filename);
Base::ifstream inp(fi, std::ios::in | std::ios::binary);
@@ -559,6 +559,9 @@ void PlyReader::read(const std::string& filename)
std::size_t offset = 0;
Eigen::Index numPoints = Eigen::Index(readHeader(inp, format, offset, fields, types, sizes));
this->width = numPoints;
this->height = 1;
Eigen::MatrixXd data(numPoints, fields.size());
if (format == "ascii") {
readAscii(inp, offset, data);
@@ -1021,8 +1024,8 @@ PcdReader::PcdReader() = default;
void PcdReader::read(const std::string& filename)
{
clear();
this->width = -1;
this->height = -1;
this->width = 0;
this->height = 1;
Base::FileInfo fi(filename);
Base::ifstream inp(fi, std::ios::in | std::ios::binary);
@@ -1788,6 +1791,8 @@ void E57Reader::read(const std::string& filename)
normals = reader.getNormals();
colors = reader.getColors();
intensity = reader.getItensity();
width = points.size();
height = 1;
}
catch (const Base::BadFormatError&) {
throw;