Function:ns2erc

From S2PLOT

(Difference between revisions)
Jump to: navigation, search
Revision as of 01:50, 6 January 2009
S2plot admin (Talk | contribs)

← Previous diff
Current revision
S2plot admin (Talk | contribs)

Line 1: Line 1:
==ns2erc== ==ns2erc==
 +Draw an arc.
==Prototype== ==Prototype==
<code><pre> <code><pre>
 +void ns2erc(float px, float py, float pz,
 + float nx, float ny, float nz,
 + float sx, float sy, float sz,
 + float deg, int nseg, float axratio);
</pre></code> </pre></code>
==Description== ==Description==
 +Draw an arc with specified major/minor axis ratio. The major axis is given by the starting vector.
 +
 +==See Also==
 +<table>
 +<tr><td> [[Function:ns2verc |ns2verc]]</td><td>Draw an arc - vector input.</td></tr>
 +<tr><td> [[Function:ns2arc |ns2arc]]</td><td>Draw an arc at (px,py,pz) with normal (nx,ny,nz) in current pen (thickness,colour).</td></tr>
 +<tr><td>[[Function:ns2varc | ns2varc ]]</td><td>Draw an arc at (px,py,pz) with normal (nx,ny,nz) in current pen (thickness,colour) - vector input. </td></tr>
 +<tr><td>[[Function:s2line |s2line]]</td><td>Draw a poly line, n vertices at (xpts, ypts, zpts).</td></tr>
 +</table>
==Code Example== ==Code Example==
<code><pre> <code><pre>
 +#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 */
 +
 + float axratio = 0.5;
 + ns2erc(px,py,pz, nx,ny,nz, sx,sy,sz, deg, nseg, axratio);
 + /* Draw the arc */
 + s2show(1); /* Open the s2plot window */
 +
 + return 1;
 +}
</pre></code> </pre></code>
[[S2PLOT:Function List | Back]] to S2PLOT function list. [[S2PLOT:Function List | Back]] to S2PLOT function list.
- 
__NOTOC__ __NOTOC__
__NOEDITSECTION__ __NOEDITSECTION__
- 
- 
-Back to [[Function:Template | template]] page. 

Current revision

ns2erc

Draw an arc.

Prototype

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

Description

Draw an arc with specified major/minor axis ratio. The major axis is given by the starting vector.

See Also

ns2vercDraw an arc - vector input.
ns2arcDraw an arc at (px,py,pz) with normal (nx,ny,nz) in current pen (thickness,colour).
ns2varc Draw an arc at (px,py,pz) with normal (nx,ny,nz) in current pen (thickness,colour) - vector input.
s2lineDraw a poly line, n vertices at (xpts, ypts, zpts).

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

   float axratio = 0.5;
   ns2erc(px,py,pz, nx,ny,nz, sx,sy,sz, deg, nseg, axratio);
                                                /* Draw the arc */
   s2show(1);                                   /* Open the s2plot window */

   return 1;
}

Back to S2PLOT function list.



Personal tools