I'm rewriting a set of file readers that a former-colleague of mine created that read raw-point data of XYZ (Cartesian) coordinates or RTZ (Polar) coordinates. Currently the data is stored directly in the reader, making everything rely on the state of those objects. I'd like to separate the reader from the collected data it reads by creating some data objects.
Each of the coordinate systems is nearly identical from a purely data-driven point of view.
Cartesian Coordinates
X (List of doubles)
Y (List of doubles)
Z (Multidimensional array of doubles at [X,Y])
Polar Coordinates
R (List of doubles)
T (List of doubles)
Z (Multidimensional array of doubles at [R,T])
I'm trying to determine if I can, in good conscience, define a common interface for both of these. The data is the same, even though what it represents is subtly different. Each has two opposing axes of a 3D coordinate system, and a table of Z values at various combinations of those axes. But an X coordinate doesn't necessarily map to R. And I'm not sure what I would call the properties on a common interface - Axis1, Axis2, and Z?
Or am I trying to consolidate something here that really needs to remain separate? Should there be a separate (albeit similar) interface for each data object representing coordinates from each system?
fromPolarfactory method that converts to cartesian – isbadawi Jan 14 at 17:46