Function:ss2tc
From S2PLOT
(Difference between revisions)
Revision as of 01:26, 30 October 2007 S2plot admin (Talk | contribs) ← Previous diff |
Current revision S2plot admin (Talk | contribs) |
||
Line 25: | Line 25: | ||
#include <stdio.h> | #include <stdio.h> | ||
#include <stdlib.h> | #include <stdlib.h> | ||
+ | #include <time.h> | ||
#include "s2plot.h" | #include "s2plot.h" | ||
int main(int argc, char *argv[]) | int main(int argc, char *argv[]) | ||
{ | { | ||
- | int i, N = 20; /* Loop variables */ | + | int i, N = 20; /* Loop variables */ |
- | float x, y, z; /* Random data */ | + | float x, y, z; /* Random data */ |
- | int trans = 0; /* Translation disabled */ | + | int trans = 0; /* Translation disabled */ |
- | s2opend("/?",argc, argv); /* Open the display */ | + | srand48((long)time(NULL)); /* Seed random numbers */ |
- | s2swin(-1.,1., -1.,1., -1.,1.); /* Set the window coordinates */ | + | s2opend("/?",argc, argv); /* Open the display */ |
- | s2box("BCDET",0,0,"BCDET",0,0,"BCDET",0,0); /* Draw coordinate box */ | + | s2swin(-1.,1., -1.,1., -1.,1.); /* Set the window coordinates */ |
+ | s2box("BCDET",0,0,"BCDET",0,0,"BCDET",0,0); /* Draw coordinate box */ | ||
- | s2slw(3); /* Set line width */ | + | s2slw(3); /* Set line width */ |
for (i=0;i<N;i++) { | for (i=0;i<N;i++) { | ||
- | x = drand48()*2.0 - 1.0; /* Random (x,y,z) */ | + | x = drand48()*2.0 - 1.0; /* Random (x,y,z) */ |
y = drand48()*2.0 - 1.0; | y = drand48()*2.0 - 1.0; | ||
z = drand48()*2.0 - 1.0; | z = drand48()*2.0 - 1.0; | ||
- | s2sci(15*drand48() + 1); /* Random colour */ | + | s2sci(15*drand48() + 1); /* Random colour */ |
- | s2pt1(x,y,z,1); /* Plot the point */ | + | s2pt1(x,y,z,1); /* Plot the point */ |
} | } | ||
- | ss2tc(trans); /* Set translation state */ | + | ss2tc(trans); /* Set translation state */ |
- | s2sch(0.8); /* Set text height */ | + | s2sch(0.8); /* Set text height */ |
s2textxy(-1,0,0,"You can't translate camera with +/-!"); | s2textxy(-1,0,0,"You can't translate camera with +/-!"); | ||
- | s2show(1); /* Open the s2plot window */ | + | s2show(1); /* Open the s2plot window */ |
- | + | ||
return 1; | return 1; | ||
} | } | ||
+ | |||
</pre></code> | </pre></code> | ||
[[S2PLOT:Function List | Back]] to S2PLOT function list. | [[S2PLOT:Function List | Back]] to S2PLOT function list. | ||
__NOTOC__ | __NOTOC__ | ||
__NOEDITSECTION__ | __NOEDITSECTION__ |
Current revision
ss2tc
Enable/disable (1,0) camera translation.
Prototype
void ss2tc(int enabledisable);
Description
Enable (enabledisable = 1) or disable (enabledisable = 0) camera translation. This is particularly useful in fisheye display modes.
See Also
ss2sc | Set the camera position, up vector and view direction. |
ss2qc | Query the camera position, up vector and view direction. |
ss2sas | Start/Stop the camera rotation. |
Code Example
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "s2plot.h"
int main(int argc, char *argv[])
{
int i, N = 20; /* Loop variables */
float x, y, z; /* Random data */
int trans = 0; /* Translation disabled */
srand48((long)time(NULL)); /* Seed random numbers */
s2opend("/?",argc, argv); /* Open the display */
s2swin(-1.,1., -1.,1., -1.,1.); /* Set the window coordinates */
s2box("BCDET",0,0,"BCDET",0,0,"BCDET",0,0); /* Draw coordinate box */
s2slw(3); /* Set line width */
for (i=0;i<N;i++) {
x = drand48()*2.0 - 1.0; /* Random (x,y,z) */
y = drand48()*2.0 - 1.0;
z = drand48()*2.0 - 1.0;
s2sci(15*drand48() + 1); /* Random colour */
s2pt1(x,y,z,1); /* Plot the point */
}
ss2tc(trans); /* Set translation state */
s2sch(0.8); /* Set text height */
s2textxy(-1,0,0,"You can't translate camera with +/-!");
s2show(1); /* Open the s2plot window */
return 1;
}
Back to S2PLOT function list.