Function:ss2spt

From S2PLOT

Revision as of 04:57, 22 November 2007; view current revision
←Older revision | Newer revision→
Jump to: navigation, search

ss2spt

Set the projection type of the device in use.

Prototype

void ss2spt(int projtype);

Description

Set the projection type of the device in use. Only certain changes are allowed. Values are:

  • 0 = perspective
  • 1 = orthographic
  • 2 = fisheye

See Also

s2ldev List the available S2PLOT devices on stdout.
ss2qpt Query the projection type.


Code Example

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

void cb(double *t, int *kc)
{
   int pt = ss2qpt();                   /* Query current projection type */

   char string[32];                     
   sprintf(string,"Projection type = %d",pt);   /* Write to string */
   s2textxy(0,0,0,string);              /* Display text */

   int spt = (*kc % 2);                 /* Generate new projection type */
   ss2spt(spt);                         /* Set the new projection type */

   switch (*kc % 2) {
      case 0 : s2lab("","","","Perspective"); break;
      case 1 : s2lab("","","","Orthographic"); break;
   }
   
}

int main(int argc, char *argv[])
{
   fprintf(stderr,"Press the <spacebar> to change eye-separation");

   s2opend("/s2mono", argc, argv);             /* Open in mono mode */
   s2swin(-1.,1., -1.,1., -1.,1.);              /* Set the window coordinates */
   s2box("BCDET",0,0,"BCDET",0,0,"BCDET",0,0);  /* Draw coordinate box */
   
   cs2scb(cb);                                  /* Install dynamic callback */
   s2show(1);                                   /* Open the s2plot window */

   return 1;
}

Back to S2PLOT function list.


Personal tools