Function:ns2disk

From S2PLOT

Jump to: navigation, search

ns2disk

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

Prototype

void ns2disk(float x, float y, float z, float nx, float ny, float nz, float r1, float r2, 
float red, float green, float blue);

Description

Draw an annulus with given centre (x,y,z), inner and outer radii (r1, r2) and RGB colour (red, green, blue). The annulus is oriented with normal vector (nx,ny,nz).

See Also

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


Code Example

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

int main(int argc, char *argv[])
{
   float x = 0.0,				/* Centre of annular disk */
	 y = 0.0,
	 z = 0.0;
   float nx, ny, nz;				/* Normal */
   float inner = 0.1;				/* Inner radius */
   float outer = 0.2;				/* Outer radius */
   float r = 0.0,				/* Colour of annular disk */
	 g = 1.0,
	 b = 1.0;

   srand48((long)time(NULL));			/* Seed random numbers */
   nx = drand48();				/* Random normal! */
   ny = drand48();
   nz = 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 */

   ns2disk(x,y,z, nx,ny,nz, inner,outer, r,g,b);	/* Draw disk */
   s2show(1);					/* Open the s2plot window */
   
   return 1;
}

Back to S2PLOT function list.