Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions apps/console_tools/laz_to_ply.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ bool convert_and_save(const char* from, const char* to)
}

laszip_point* point = nullptr;
if (laszip_get_point_pointer(header, &point))
if (laszip_get_point_pointer(laszip_reader, &point))
{
return false;
}
Expand All @@ -57,7 +57,7 @@ bool convert_and_save(const char* from, const char* to)
laszip_I64 point_read_count = 0;
while (point_read_count < point_count)
{
if (laszip_read_point(header))
if (laszip_read_point(laszip_reader))
{
return false;
}
Expand All @@ -71,6 +71,12 @@ bool convert_and_save(const char* from, const char* to)
point_read_count++;
}

if (laszip_close_reader(laszip_reader) || laszip_destroy(laszip_reader))
{
spdlog::error("Failed closing LASzip reader");
return false;
}

if (std::ofstream to_file = std::ofstream(to, std::ios::out | std::ios::binary))
{
to_file << "ply\n";
Expand All @@ -84,6 +90,12 @@ bool convert_and_save(const char* from, const char* to)
to_file << "end_header\n";

to_file.write((const char*)points.data(), points.size() * sizeof(Point));
to_file.close();
if (!to_file)
{
spdlog::error("Failed writing PLY output {}", to);
return false;
}
}
else
{
Expand Down
Loading