Function:s2line

From S2PLOT

(Difference between revisions)
Jump to: navigation, search
Revision as of 07:19, 27 October 2007
S2plot admin (Talk | contribs)

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

Line 14: Line 14:
== See Also == == See Also ==
-<table>+<table border=1>
<tr><td>[[Function:s2sci | s2sci ]]</td><td>Set the pen colour by index. </td></tr> <tr><td>[[Function:s2sci | s2sci ]]</td><td>Set the pen colour by index. </td></tr>
<tr><td>[[Function:s2slw | s2slw ]]</td><td>Set the linewidth in pixels. </td></tr> <tr><td>[[Function:s2slw | s2slw ]]</td><td>Set the linewidth in pixels. </td></tr>

Current revision

s2line

Draw a poly line, n vertices at (xpts, ypts, zpts).

Prototype

void s2line(int n, float *xpts, float *ypts, float *zpts);

Description

Draw a poly line, n vertices at (xpts, ypts, zpts). The line is drawn in the current colour and with the current line width.

See Also

s2sci Set the pen colour by index.
s2slw Set the linewidth in pixels.
ns2line Draw a line from one point to another in a specific colour.
ns2vline Draw a line from one point to another in a specific colour - vector input.
ns2thline Draw a thick line from one point to another in a specific colour.
ns2vthline Draw a thick line from one point to another in a specific colour - vector input.
ns2vcline Draw a coloured line, with colour blended between the two given colours along the line - vector input.

PGPLOT Equivalent

PGLINE

Code Example

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

int main(int argc, char *argv[])
{
   float x[10], y[10], z[10];			/* Arrays of coordinate points */
   int N = 10;					/* Number of points */
   int i;					/* Loop variable */

   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 */

   for (i=0;i<N;i++) {
      x[i] = drand48()*2.0 - 1.0;		/* Random (x,y,z) coordinates */
      y[i] = drand48()*2.0 - 1.0;
      z[i] = drand48()*2.0 - 1.0;
   }

   s2sci(S2_PG_YELLOW);				/* Set colour */
   s2slw(4);					/* Set line width */
   s2line(N, x, y, z);   			/* Draw the poly-line */

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

Back to S2PLOT function list.


Personal tools