Function:s2line
From S2PLOT
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
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.