Skip to content

Commit

Permalink
Don't write ints using fixed precision.
Browse files Browse the repository at this point in the history
  • Loading branch information
abellgithub committed Mar 25, 2019
1 parent ddac23f commit 5553dc8
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions io/PlyWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,6 @@ void PlyWriter::ready(PointTableRef table)
" points supported.");

m_stream = Utils::createFile(m_filename, true);
if (m_format == Format::Ascii && m_precisionArg->set())
{
*m_stream << std::fixed;
m_stream->precision(m_precision);
}
writeHeader(table.layout());
}

Expand All @@ -174,6 +169,14 @@ void PlyWriter::writeValue(PointRef& point, Dimension::Id dim,
if (m_format == Format::Ascii)
{
double d = point.getFieldAs<double>(dim);
if (m_precisionArg->set() &&
Dimension::base(type) == Dimension::BaseType::Floating)
{
*m_stream << std::fixed;
m_stream->precision(m_precision);
}
else
m_stream->unsetf(std::ios_base::fixed);
*m_stream << d;
}
else if (m_format == Format::BinaryLe)
Expand Down

0 comments on commit 5553dc8

Please sign in to comment.