Function:ss2ucf
From S2PLOT
(Difference between revisions)
Revision as of 01:26, 30 October 2007
ss2ucf
Unset the camera mid/focus point - revert to auto mid-point.
Prototype
void ss2ucf(void);
Description
Reset the camera mid/focus point so that an automatic mid-point is calculated. To set the focus manually, use ss2scf.
See Also
ss2scf | Set the camera mid/focus point. |
Code Example
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "s2plot.h"
void numcb(int *N)
{
if (*N != 1) return;
ss2ucf(); /* Go back to rotating around centre */
}
int main(int argc, char *argv[])
{
int i, N = 20; /* Loop variables */
float x, y, z; /* Random data */
XYZ focus; /* Point to rotate about */
int wc = 1; /* Use world coordinates */
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 */
}
focus.x = drand48()*2.0 - 1.0; /* Random rotation point */
focus.y = drand48()*2.0 - 1.0;
focus.z = drand48()*2.0 - 1.0;
ss2scf(focus, wc); /* Set the rotation point */
s2sch(0.7); /* Set text height */
s2textxy(-1,0,0,"Rotate camera - then press 1 followed by +");
cs2sncb(&numcb); /* Install number callback */
s2show(1); /* Open the s2plot window */
return 1;
}
Back to S2PLOT function list.