[libpc] The specialness of X, Y, Z dimensions

Howard Butler hobu.inc at gmail.com
Wed Apr 13 10:48:38 EDT 2011


Michael,

One of the things I've struggled with is a lot of the filters have X::Double etc baked in as the X dimension for their operations, but my reader is producing X::Int32+scaling.  What should the filters be doing?  Looking for Field_X plus every combination of DataType?  This seems silly.  The crop filter *wants* XYZ data as a <double>, but some other filter might want unscaled data to work with (if it is available).

What if we were able flip around the getField call to return what you wanted instead of what you have?

// Return you the *first* X dimension in the schema, regardless of DataType
Dimension const& xDim = schema.getX();
int fieldIndex = schema.getDimensionIndex(xDim);

double x = buffer.getField<double>(index, fieldIndex); // Would implicitly apply scaling if the dimension had it
uint32_t x = buffer.getField<uint32_t>(index, fieldIndex);  

A challenge is getField currently gives you direct access into the buffer, so there's no need to worry about differing type sizes.  

What do you think?

Howard




More information about the libpc mailing list