Function:ns2vthwcube

From S2PLOT

(Difference between revisions)
Jump to: navigation, search
Revision as of 22:51, 7 January 2009
S2plot admin (Talk | contribs)

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

Line 23: Line 23:
<code><pre> <code><pre>
 +#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 */
 +
 + XYZ xyz1 = { -0.8, -0.8, -0.8 }; /* Box coordinate */
 + XYZ xyz2 = { +0.8, +0.8, +0.8 }; /* Box coordinate */
 +
 + COLOUR col = { 1.0, 0.3, 0.2 }; /* RGB colours */
 +
 + float w = 2.0; /* Box border width */
 +
 + ns2vthwcube(xyz1, xyz2, col, w);
 +
 + s2show(1); /* Open the s2plot window */
 +
 + return 1;
 +}
</pre></code> </pre></code>

Current revision

ns2vthwcube

Draw a cube - vector input.

Prototype

void ns2vthwcube(XYZ P1, XYZ P2, COLOUR col, float width);

Description

Draw a wireframe cube (with axes parallel to the coordinate axes) in a specific colour and thickness

See Also

ns2thwcube Draw a wireframe cube.
s2wcube Draw a wireframe cube.
ns2scube Draw a solid cube.
ns2vscube Draw a solid 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 */

   XYZ xyz1 = { -0.8, -0.8, -0.8 };             /* Box coordinate */
   XYZ xyz2 = { +0.8, +0.8, +0.8 };             /* Box coordinate */

   COLOUR col = { 1.0, 0.3, 0.2 };              /* RGB colours */

   float w = 2.0;                               /* Box border width */

   ns2vthwcube(xyz1, xyz2, col, w);

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

   return 1;
}

Back to S2PLOT function list.


Personal tools