Function:ns2varc

From S2PLOT

Revision as of 01:39, 30 October 2007; view current revision
←Older revision | Newer revision→
Jump to: navigation, search

ns2varc

Draw an arc at (px,py,pz) with normal (nx,ny,nz) in current pen (thickness,colour) - vector input.

Prototype

void ns2varc(XYZ P, XYZ N, XYZ S, float deg, int nseg);

Description

Draw an arc at position P with normal N using the current pen thickness and colour. Vector S gives starting vector from P and is rotated around the normal in steps (deg/(nseg-1)).

This function is an "extension", and its behaviour for world coordinates which have unequal scales in x, y and/or z is not particularly well defined.

See Also


Code Example

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

int main(int argc, char *argv[])
{
   XYZ pos;					/* Position */
   XYZ normal;					/* Normal */
   XYZ start;					/* Starting vector */
   float deg = 180.0;				/* Angular extent */
   int nseg = 48;				/* Number of segments */

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

   pos.x    = 0.0; pos.y    = 0.0; pos.z    = 0.0;	/* Set position */
   normal.x = 0.0; normal.y = 1.0; normal.z = 1.0; 	/* Normal vector */
   start.x  = 1.0; start.y  = 0.0; start.z  = 0.0; 	/* Normal vector */

   s2slw(3);					/* Set line width */
   s2sci(S2_PG_YELLOW);				/* Set the colour */
   ns2varc(pos, normal, start, deg, nseg); 	/* Draw the arc */
   s2show(1);					/* Open the s2plot window */
   
   return 1;
}

Back to S2PLOT function list.