Function:ns2arc

From S2PLOT

(Difference between revisions)
Jump to: navigation, search
Revision as of 01:38, 30 October 2007
S2plot admin (Talk | contribs)

← Previous diff
Revision as of 05:45, 11 December 2007
S2plot admin (Talk | contribs)

Next diff →
Line 12: Line 12:
==Description== ==Description==
-Draw an arc at (px,py,pz) with normal (nx,ny,nz) using the current pen thickness and colour. Vector (sx,sy,sz) gives starting vector from (px,py,pz) and is rotated around the normal in steps (deg/(nseg-1)). +Draw an arc centered around (px,py,pz) with surface normal (nx,ny,nz) using the current pen thickness and colour. Vector (sx,sy,sz) gives the position (both direction and radius) relative to (px,py,pz), from which the first segment of the arc is drawn. 'deg' specifies the arc angle in degrees, which is broken into 'nseg' segments.
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. 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.
 +
 +If the surface normal N is calculated using a vector cross-product, for the purpose of drawing an arc between two given vectors, the first vector parameter in the cross-product calculation should be used as the reference direction for S.
== See Also == == See Also ==

Revision as of 05:45, 11 December 2007

ns2arc

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

Prototype

void ns2arc(float px, float py, float pz, float nx, float ny, float nz, 
float sx, float sy, float sz, float deg, int nseg);

Description

Draw an arc centered around (px,py,pz) with surface normal (nx,ny,nz) using the current pen thickness and colour. Vector (sx,sy,sz) gives the position (both direction and radius) relative to (px,py,pz), from which the first segment of the arc is drawn. 'deg' specifies the arc angle in degrees, which is broken into 'nseg' segments.

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.

If the surface normal N is calculated using a vector cross-product, for the purpose of drawing an arc between two given vectors, the first vector parameter in the cross-product calculation should be used as the reference direction for S.

See Also

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


Code Example

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

int main(int argc, char *argv[])
{
   float px, py, pz;				/* Position */
   float nx, ny, nz;				/* Normal */
   float sx, sy, sz;				/* 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 */

   px = 0.0; py = 0.0; pz = 0.0;		/* Set position */
   nx = 0.0; ny = 1.0; nz = 1.0; 		/* Normal vector */
   sx = 1.0; sy = 0.0; sz = 0.0;		/* Starting vector */

   s2slw(3);					/* Set line width */
   s2sci(S2_PG_YELLOW);				/* Set the colour */
   ns2arc(px,py,pz, nx,ny,nz, sx,sy,sz, deg, nseg);	
						/* Draw the arc */
   s2show(1);					/* Open the s2plot window */
   
   return 1;
}

Back to S2PLOT function list.


Personal tools