Function:ns2vdisk

From S2PLOT

Jump to: navigation, search

ns2vdisk

Draw an annulus with given centre, inner and out radii, and colour - vector input.

Prototype

void ns2vdisk(XYZ P, float nx, float ny, float nz, float r1, float r2, COLOUR col);

Description

Draw an annulus with given centre (P), inner and outer radii (r1, r2) and RGB colour (col), using vector data structures. The annulus is oriented with normal vector (nx,ny,nz).

See Also

ns2disk Draw an annulus with given centre, inner and out radii, and colour.
struct_COLOUR Data structure for (r,g,b) colour indices.
struct_XYZ Data structure for (x,y,z) coordinates.


Code Example

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

int main(int argc, char *argv[])
{
   XYZ xyz = { 0.0, 0.0, 0.0 };			/* Centre of annular disk */
   XYZ normal;					/* Normal */
   float inner = 0.1;				/* Inner radius */
   float outer = 0.7;				/* Outer radius */
   COLOUR col = { 0.0, 1.0, 1.0 };		/* Colour of annular disk */

   srand48((long)time(NULL));			/* Seed random numbers */
   normal.x = drand48();			/* Random normal! */
   normal.y = drand48();
   normal.z = drand48();

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

   ns2vdisk(xyz, normal, inner,outer, col);	/* Draw disk */
   s2show(1);					/* Open the s2plot window */
   
   return 1;
}

Back to S2PLOT function list.


Personal tools