Function:ns2scube

From S2PLOT

Revision as of 03:45, 29 August 2011; view current revision
←Older revision | Newer revision→
Jump to: navigation, search

ns2scube

Draw a solid cube.

Prototype

void ns2scube(float x1, float y1, float z1, float x2, float y2, float z2,
	      float red, float green, float blue,float alpha);

Description

Draw a solid cube with filled but transparent faces.

See Also

s2wcube Draw a wireframe cube.
ns2vscube Draw a solid cube - vector input.
ns2thwcube Draw a wireframe cube.
ns2vthwcube Draw a wireframe cube - vector input.

Code Example

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

int main(int argc, char *argv[])
{
   char xopt[] = "BCDETMNOPQ";
   char yopt[] = "BCDETMNOPQ";
   char zopt[] = "BCDETMNOPQ";

   s2opend("/?",argc, argv);                    /* Open the display */
   s2swin(-1.,1., -1.,1., -1.,1.);              /* Set the window coordinates */
   s2box(xopt, 0,0, yopt, 0,0, zopt, 0,0);      /* Draw the coordinate box */
   s2lab("X-axis","Y-axis","Z-axis","Plot");    /* Write some labels */

   float x1 = -0.8, x2 = +0.8;                  /* Box coordinates */
   float y1 = -0.8, y2 = +0.8;
   float z1 = -0.8, z2 = +0.8;

   float r = 1.0, g = 0.3, b = 0.2;             /* RGB colours */
   float alpha = 0.4;                           /* Alpha channel transparency */

   ns2scube(x1,y1,z1, x2,y2,z2, r,g,b, alpha);

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

   return 1;
}

Back to S2PLOT function list.


Personal tools