Function:ss2qcs
From S2PLOT
(Difference between revisions)
Revision as of 22:57, 7 January 2009 S2plot admin (Talk | contribs) ← Previous diff |
Current revision S2plot admin (Talk | contribs) |
||
Line 1: | Line 1: | ||
==ss2qcs== | ==ss2qcs== | ||
- | Set/query the camer speed. | + | Set/query the camera speed. |
==Prototype== | ==Prototype== | ||
Line 22: | Line 22: | ||
<code><pre> | <code><pre> | ||
+ | #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; | ||
+ | } | ||
</pre></code> | </pre></code> | ||
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.