There is no Plot routine to draw a straight line, because any straight line in physical coordinates can potentially turn into a curve in graphical coordinates. We therefore start by considering how to draw geodesic curves. These are curves which trace the path of shortest distance between two points in physical coordinates and are the basic drawing element in a Plot.
In many instances, the geodesic will, in fact, be a straight line, but this depends on the Plot's current Frame. If this represents a celestial coordinate system, for instance, it will be a great circle (corresponding with the behaviour of the AST_DISTANCE function which defines the metric of the physical coordinate space). The geodesic will, of course, be transformed into graphics coordinates before being plotted. A geodesic curve is plotted using AST_CURVE as follows:
DOUBLE PRECISION START( NCOORD ), FINISH( NCOORD ) ... CALL AST_CURVE( PLOT, START, FINISH, STATUS )
Here, START and FINISH are arrays containing the starting and finishing coordinates of the curve. The AST_OFFSET and AST_DISTANCE routines can often be useful for computing these ().
If you need to draw a series of curves end-to-end (when drawing a contour line, for example), then a more efficient alternative is to use AST_POLYCURVE. This has the same effect as a sequence of calls to AST_CURVE, but allows you to supply a whole set of points at the same time. AST_POLYLINE then joins them, in sequence, using geodesic curves:
INTEGER NPOINT DOUBLE PRECISION COORDS( NPOINT, NCOORD ) ... CALL AST_POLYCURVE( PLOT, NPOINT, NCOORD, NPOINT, COORDS, STATUS )
Here, NPOINT specifies how many points are to be joined and NCOORD
specifies how many coordinates are being supplied for each point. The
array COORDS supplies the coordinates of the points in the Plot's
physical coordinate system.
AST A Library for Handling World Coordinate Systems in Astronomy