next up previous 264
Next: Frame Axis Attributes
Up: Representing Coordinate Systems (Frames)
Previous: Creating a Frame


Using a Frame as a Mapping

We should briefly point out that the Frame we created above ([*]) is also a Mapping ([*]) and therefore inherits the properties and behaviour common to other Mappings.

One way to see this is to set the Frame's Report attribute (inherited from the Mapping class) to a non-zero value and pass the Frame pointer to a coordinate transformation function, such as astTran2.

double xin[ 5 ] = { 0.0, 1.0, 2.0, 3.0, 4.0, 5.0 };
double yin[ 5 ] = { 0.0, 2.0, 4.0, 6.0, 8.0, 10.0 };
double xout[ 5 ];
double yout[ 5 ];

...

astSet( frame, "Report=1" );
astTran2( frame, 5, xin, yin, 1, xout, yout );

The resulting output might then look like this:

(1, 2) --> (1, 2)
(2, 4) --> (2, 4)
(3, 6) --> (3, 6)
(4, 8) --> (4, 8)
(5, 10) --> (5, 10)

This is not very exciting because a Frame implements an identity transformation just like a UnitMap ([*]). However, it illustrates that a Frame can be used as a Mapping and that its Nin and Nout attributes are both equal to the number of Frame axes.

When we consider more specialised Frames (e.g. [*]), we will see that using them as Mappings can be very useful indeed.


next up previous 264
Next: Frame Axis Attributes
Up: Representing Coordinate Systems (Frames)
Previous: Creating a Frame

AST A Library for Handling World Coordinate Systems in Astronomy
Starlink User Note 211
R.F. Warren-Smith & D.S. Berry
24th May 2011
E-mail:ussc@star.rl.ac.uk

Copyright (C) 2009 Science \& Technology Facilities Council