Function:ss2qpt
From S2PLOT
ss2qpt
Fetch the projection type of the device in use.
Prototype
int ss2qpt();
Description
Fetch the projection type of the device in use. Return values are:
- 0 = perspective
- 1 = orthographic
- 2 = fisheye
See Also
s2ldev | List the available S2PLOT devices on stdout. |
ss2spt | Set the projection type of the device in use. |
Code Example
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "s2plot.h"
int main(int argc, char *argv[])
{
int N = 100; /* Number of points */
XYZ xyz; /* Position */
COLOUR col; /* Colour */
int i;
int dev; /* Random device */
char string[32]; /* Name of device */
srand48((long)time(NULL)); /* Seed random numbers */
fprintf(stderr,"Choose /S2FISH or /S2MONO device\n");
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 */
for (i=0;i<N;i++) { /* Random data positions */
xyz.x = drand48()*2.0 - 1.0;
xyz.y = drand48()*2.0 - 1.0;
xyz.z = drand48()*2.0 - 1.0;
col.r = drand48();
col.g = drand48();
col.b = drand48();
ns2vpoint(xyz, col); /* Draw the point */
}
dev = ss2qpt(); /* Get projection type */
switch (dev) {
case 0 : sprintf(string,"Perspective"); break;
case 1 : sprintf(string,"Orthographic"); break;
case 2 : sprintf(string,"Fisheye"); break;
default : sprintf(string,"Unknown!"); break;
}
s2textxy(0.0,0.0,0.0, string);
s2show(1); /* Open the s2plot window */
return 1;
}
Back to S2PLOT function list.