Function:ss2qcs

From S2PLOT

(Difference between revisions)
Jump to: navigation, search
Revision as of 22:19, 6 January 2009
S2plot admin (Talk | contribs)

← Previous diff
Current revision
S2plot admin (Talk | contribs)

Line 1: Line 1:
==ss2qcs== ==ss2qcs==
- +Set/query the camera speed.
==Prototype== ==Prototype==
<code><pre> <code><pre>
 +float ss2qcs(void);
</pre></code> </pre></code>
==Description== ==Description==
 +Set/query the camera speed (ie. increment amount for camera movements. Values between 0.01 and 20.0 are reasonably sensible.
==See Also== ==See Also==
 +<table>
 +<tr><td>[[Function:ss2scs | ss2scs ]]</td><td>Set the camera speed. </td></tr>
 +<tr><td>[[Function:ss2qca | ss2qca ]]</td><td>Query the camera aperture. </td></tr>
 +<tr><td>[[Function:ss2sca | ss2sca ]]</td><td>Set the camera aperture. </td></tr>
 +<tr><td>[[Function:ss2sc | ss2sc ]]</td><td>Set the camera position, up vector and view direction. </td></tr>
 +<tr><td>[[Function:ss2qc | ss2qc ]]</td><td>Query the camera position, up vector and view direction. </td></tr>
 +</table>
==Code Example== ==Code Example==
<code><pre> <code><pre>
-</pre></code>+#include <stdio.h>
 +#include <stdlib.h>
 +#include <time.h>
 +#include "s2plot.h"
-[[S2PLOT:Function List | Back]] to S2PLOT function list.+void cb(double *t, int *kc)
 +{
 + static int lkc = 0; /* Count of key presses */
 + float qcs = ss2qcs(); /* Query camera increment */
 + char string[32];
 + sprintf(string,"%.2f",qcs);
 + s2textxy(0,0,0,string); /* Display text */
-__NOTOC__+ lkc = *kc; /* Update count */
-__NOEDITSECTION__+}
-Back to [[Function:Template | template]] page.+int main(int argc, char *argv[])
 +{
 + 
 + srand48((long)time(NULL)); /* Seed random numbers */
 + s2opend("/s2mono",argc, argv); /* Open the display: mono */
 + s2swin(-1.,1., -1.,1., -1.,1.); /* Set the window coordinates */
 + s2box("BCDE",0,0,"BCDE",0,0,"BCDE",0,0); /* Draw coordinate box */
 + 
 + s2lab("","","","Press < and > to change camera movement increment, then +/- to test zooming\n");
 + 
 + cs2scb(cb); /* Install dynamic callback */
 + s2show(1); /* Open the s2plot window */
 + 
 + return 1;
 +}
 +</pre></code>
 + 
 +[[S2PLOT:Function List | Back]] to S2PLOT function list.
 + 
 +__NOTOC__
 +__NOEDITSECTION__

Current revision

ss2qcs

Set/query the camera speed.

Prototype

float ss2qcs(void);

Description

Set/query the camera speed (ie. increment amount for camera movements. Values between 0.01 and 20.0 are reasonably sensible.

See Also

ss2scs Set the camera speed.
ss2qca Query the camera aperture.
ss2sca Set the camera aperture.
ss2sc Set the camera position, up vector and view direction.
ss2qc Query the camera position, up vector and view direction.

Code Example

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

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

   float qcs = ss2qcs();                        /* Query camera increment */
   char string[32];

   sprintf(string,"%.2f",qcs);
   s2textxy(0,0,0,string);                      /* Display text */

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


int main(int argc, char *argv[])
{

   srand48((long)time(NULL));                   /* Seed random numbers */
   s2opend("/s2mono",argc, argv);               /* Open the display: mono */
   s2swin(-1.,1., -1.,1., -1.,1.);              /* Set the window coordinates */
   s2box("BCDE",0,0,"BCDE",0,0,"BCDE",0,0);     /* Draw coordinate box */

   s2lab("","","","Press < and > to change camera movement increment, then +/- to test zooming\n");

   cs2scb(cb);                                  /* Install dynamic callback */
   s2show(1);                                   /* Open the s2plot window */

   return 1;
}

Back to S2PLOT function list.


Personal tools