Function:ss2sc

From S2PLOT

(Difference between revisions)
Jump to: navigation, search
Revision as of 06:25, 6 March 2008
S2plot admin (Talk | contribs)

← Previous diff
Current revision
S2plot admin (Talk | contribs)

Line 16: Line 16:
<table> <table>
<tr><td>[[Function:ss2qc | ss2qc ]]</td><td>Query the camera position, up vector and view direction. </td></tr> <tr><td>[[Function:ss2qc | ss2qc ]]</td><td>Query the camera position, up vector and view direction. </td></tr>
-<tr><td>[[Function:ss2tc | ss2tc ]]</td><td>Enable/disable (1,0) camera translation. </td></tr>+<tr><td>[[Function:ss2sca | ss2sca ]]</td><td>Set the camera aperture. </td></tr>
 +<tr><td>[[Function:ss2qca | ss2qca ]]</td><td>Query the camera aperture. </td></tr>
 +<tr><td>[[Function:ss2scs | ss2scs ]]</td><td>Set the camera speed. </td></tr>
 +<tr><td>[[Function:ss2qcs | ss2qcs ]]</td><td>Query the camera speed. </td></tr>
</table> </table>

Current revision

ss2sc

Set the camera position, up vector and view direction.

Prototype

void ss2sc(XYZ position, XYZ up, XYZ vdir, int worldcoords);

Description

Set the camera position, up vector and view direction (vdir). If worldcoords > 0 then caller has given world coordinates, otherwise they are viewport-relative coordinates.

See Also

ss2qc Query the camera position, up vector and view direction.
ss2sca Set the camera aperture.
ss2qca Query the camera aperture.
ss2scs Set the camera speed.
ss2qcs Query the camera speed.


Code Example

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

int main(int argc, char *argv[])
{
   XYZ pos;                                     /* Camera position */
   XYZ up;                                      /* Camera up vector */
   XYZ view;                                    /* Camera view vector */
   int wc = 1;                                  /* Use world coordinates */
   int i, N = 20;                               /* Loop variables */
   float x, y, z;                               /* Temporary data */

   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 positions */
      y = drand48()*2.0 - 1.0;
      z = drand48()*2.0 - 1.0;
      s2sci(15*drand48()+1);                    /* Random colour */
      s2pt1(x, y, z, 1);
   }

   pos.x  = 0.0; pos.y  = 0.0; pos.z  = 10.0;
   up.x   = 0.5; up.y   = 0.5; up.z   = 0.0;
   view.x = 0.0; view.y = 0.0; view.z = -1.0;

   ss2sc(pos, up, view, wc);            /* Set new camera position */

   s2show(1);                                   /* Open the s2plot window */

   return 1;
}

Back to S2PLOT function list.


Personal tools