Function:s2qah

From S2PLOT

(Difference between revisions)
Jump to: navigation, search
Revision as of 02:28, 23 November 2007
S2plot admin (Talk | contribs)

← Previous diff
Revision as of 02:28, 23 November 2007
S2plot admin (Talk | contribs)

Next diff →
Line 1: Line 1:
-==s2qci==+==s2qah==
Query the arrow-head style. Query the arrow-head style.

Revision as of 02:28, 23 November 2007

s2qah

Query the arrow-head style.

Prototype

void s2qah(int *fs, float *angle, float *barb);

Description

Query the arrow-head style.

See Also

s2sahSet the arrow-head style.

Code Example

#include <stdio.h>
#include <stdlib.h>
#include "s2plot.h"

void cb(double *t, int *kc)
{
   static int lkc = 0;                          /* Count of key presses */
   int filled = 1;                              /* Arrow fill style */

   if (lkc != *kc) {                            /* Space bar pressed? */
      s2sah(filled, drand48()*130+5.0, drand48()*0.95+0.05);
                                                /* Choose random arrow format */
   }

   int fs;                                      /* Fill style */
   float angle, barb;                           /* Arrow parameters */
   s2qah(&fs, &angle, &barb);                   /* Query arrow paramters */
   
   char string[32];                     
   sprintf(string,"Arrow (angle,barb) = (%.2f, %.2f)",angle,barb);      
                                                /* Write to string */
   s2textxy(0,0,0,string);                      /* Display text */

   s2sch(4);                                    /* Control size of arrowhead */
   float x[2], y[2], z[2];                      
   x[0] = -0.8; y[0] = -0.4; z[0] = 0.0;        /* Coordinates of line */
   x[1] = +0.8; y[1] = -0.4; z[1] = 0.0;
   s2arro(x[0],y[0],z[0], x[1],y[1],z[1]);      /* Draw the arrow */ 
   s2sch(1);                                    /* Reset size for text */

   lkc = *kc;                                   /* Update count */
}

int main(int argc, char *argv[])
{
   fprintf(stderr,"Press the <spacebar> to change arrow parameters");

   s2opend("/s2mono", argc, argv);              /* Open in mono mode */
   s2swin(-1.,1., -1.,1., -1.,1.);              /* Set the window coordinates */
   s2box("BCDET",0,0,"BCDET",0,0,"BCDET",0,0);  /* Draw coordinate box */
   
   cs2scb(cb);                                  /* Install dynamic callback */
   s2show(1);                                   /* Open the s2plot window */

   return 1;
}

Back to S2PLOT function list.


Personal tools