Skip to content

Commit

Permalink
cheap hackery to force BPF writer to write an identity Mueller matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
hobu committed Mar 1, 2015
1 parent 34f06d7 commit 3c28c79
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions include/pdal/drivers/bpf/BpfWriter.hpp
Expand Up @@ -64,6 +64,7 @@ class PDAL_DLL BpfWriter : public Writer
Schema *m_schema;
std::string m_filename;
BpfDimensionList m_dims;
bool m_writeIdentity_xform;

virtual void processOptions(const Options& options);
virtual void ready(PointContext ctx);
Expand Down
14 changes: 11 additions & 3 deletions src/drivers/bpf/BpfWriter.cpp
Expand Up @@ -78,6 +78,10 @@ void BpfWriter::processOptions(const Options& options)
m_header.m_pointFormat = BpfFormat::ByteMajor;
else
m_header.m_pointFormat = BpfFormat::DimMajor;
if (options.hasOption("identity_mueller"))
m_writeIdentity_xform = options.getValueOrThrow<bool>("identity_mueller");
else
m_writeIdentity_xform = false;
if (options.hasOption("coord_id"))
{
m_header.m_coordType = BpfCoordType::UTM;
Expand Down Expand Up @@ -127,19 +131,23 @@ void BpfWriter::loadBpfDimensions(PointContext ctx)
if (!dim)
throw pdal_error("Couldn't find required X dimension for BPF output.");
addDimension(dim);
m_header.m_xform.m_vals[0]= dim->getNumericScale();
if (!m_writeIdentity_xform)
m_header.m_xform.m_vals[0]= dim->getNumericScale();

dim = m_schema->getDimensionPtr("Y");
if (!dim)
throw pdal_error("Couldn't find required Y dimension for BPF output.");
addDimension(dim);
m_header.m_xform.m_vals[5] = dim->getNumericScale();

if (!m_writeIdentity_xform)
m_header.m_xform.m_vals[5] = dim->getNumericScale();

dim = m_schema->getDimensionPtr("Z");
if (!dim)
throw pdal_error("Couldn't find required Z dimension for BPF output.");
addDimension(dim);
m_header.m_xform.m_vals[10] = dim->getNumericScale();
if (!m_writeIdentity_xform)
m_header.m_xform.m_vals[10] = dim->getNumericScale();

size_t numDims = m_schema->numDimensions();
for (size_t d = 0; d < numDims; ++d)
Expand Down

0 comments on commit 3c28c79

Please sign in to comment.