Function:ss2snfe

From S2PLOT

(Difference between revisions)
Jump to: navigation, search
Revision as of 21:54, 16 December 2007
S2plot admin (Talk | contribs)

← Previous diff
Revision as of 21:55, 16 December 2007
S2plot admin (Talk | contribs)

Next diff →
Line 31: Line 31:
ss2snfe(1.0); /* on <space> press */ ss2snfe(1.0); /* on <space> press */
} }
 +
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {

Revision as of 21:55, 16 December 2007

ss2snfe

Set the clipping plane expansion factor.

Prototype

void ss2snfe(float expand);

Description

Set the expansion scale of near and far clipping planes. Use with great caution, particularly in stereoscopic display modes. In general, you should use the default configuration for the clipping planes.

See Also

Code Example

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

void cb(double *t, int *kc)
{
   XYZ foc = { 0, 0, 0 };                       /* Set the camera focus */
   ss2scf(foc, 1);

   if (*kc % 2 == 1)
      ss2snfe(0.5);                             /* Change the near/far */
   else                                         /*  expansion factor */
      ss2snfe(1.0);                             /*  on <space> press */
}

int main(int argc, char *argv[])
{
   s2opend("/s2dsana", argc, argv);             /* Open in anaglyph 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 */

   int i, N = 500;                              /* Loop variables */
   float bound = 2.0;                           /* Bound bigger than window */
   XYZ xyz;                                     /* Point location */
   COLOUR rgb;                                  /* Point colour */
   for (i=0;i<N;i++) {
      xyz.x = 0.0;
      xyz.y = 0.0;
      xyz.z = drand48()*(2.0*bound) - bound;    /* Random z-value for point */
      rgb.r = drand48();
      rgb.g = drand48();
      rgb.b = drand48();
      ns2vthpoint(xyz, rgb, 3);                 /* Draw the point */
   }
   cs2scb(cb);                                  /* Install a dynamic callback */

   XYZ pos = { 0.0, 0.0, +5.0 };                /* Move the camera closer */
   XYZ vd = { 0.0, 0, -1.0 };
   XYZ up = { 0.0, 1.0, 0 };
   ss2sc(pos, up, vd, 1);

   XYZ foc = { 0, 0, 0 };                       /* Set the camera focus */
   ss2scf(foc, 1);

   s2textxy(-1,0.1,0,"Rotate camera and press <space>");
   s2textxy(-0.5,-0.1,0,"to see effect of ss2snfe");

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

   return 1;
}

Back to S2PLOT function list.


Personal tools