next up previous contents
Next: LinSphCoordinateSystem: Combining Spherical and Up: Example Coordinate Systems Previous: CoordinateSystem: the Simplest System

LinearCoordinateSystem: a System With Linear Axes

 

The metadata that were illustrated in the example in §3.1.2 actually describe a simple, two-dimensional coordinate system in which each axis is linear. We can turn that collection of metadata into CoordinateSystem easily using the LinearCoordinateSystem:

    // create a simple linear coordinate system
    CoordinateSystem coord = new LinearCoordinateSystem(cmdata);
Notic how this CoordinateSystem uses the metadata to make a linear transformation between data voxels and coordinate positions:
double datapos[] = refpos;
CoordPos cpos = coordSys.getCoordPos(datapos);   
System.out.println( cpos.getAxisLabel(0) + ": " + cpos.getValueString(0) );
System.out.println( cpos.getAxisLabel(1) + ": " + cpos.getValueString(1) );
System.out.println( cpos.getAxisLabel(2) + ": " + cpos.getValueString(2) );
/* 
 * OUTPUT:
 * East-West: 0
 * North-South: 0
 * Altitude: 0
 */

double centralTower[] = { 0, 0, 25 }; 
cpos = coordSys.getCoordPos(centralTower);
System.out.println( cpos.getAxisLabel(0) + ": " + cpos.getValueString(0) );
System.out.println( cpos.getAxisLabel(1) + ": " + cpos.getValueString(1) );
System.out.println( cpos.getAxisLabel(2) + ": " + cpos.getValueString(2) );
/* 
 * OUTPUT:
 * East-West: 28.75
 * North-South: -72.25
 * Altitude: 250
 */

The LinearCoordinateSystem can also account for rotations and skewing of the coordinate system with respect to the dataset planes.



Ray Plante
Mon Aug 25 15:16:12 CDT 1997