Function:ns2verc
From S2PLOT
(Difference between revisions)
| Revision as of 22:19, 7 January 2009 S2plot admin (Talk | contribs) ← Previous diff |
Current revision S2plot admin (Talk | contribs) |
||
| Line 9: | Line 9: | ||
| ==Description== | ==Description== | ||
| - | Draw an arc as above, but with specified major/minor axis ratio. The major axis is given by the starting vector. | + | Draw an arc with specified major/minor axis ratio. The major axis is given by the starting vector. |
| ==See Also== | ==See Also== | ||
| Line 22: | Line 22: | ||
| <code><pre> | <code><pre> | ||
| - | </pre></code> | + | #include <stdio.h> |
| + | #include <stdlib.h> | ||
| + | #include "s2plot.h" | ||
| - | [[S2PLOT:Function List | Back]] to S2PLOT function list. | + | 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 */ | ||
| - | __NOTOC__ | + | s2slw(3); /* Set line width */ |
| - | __NOEDITSECTION__ | + | s2sci(S2_PG_YELLOW); /* Set the colour */ |
| + | float axratio = 2.0; | ||
| - | Back to [[Function:Template | template]] page. | + | ns2verc(pos, normal, start, deg, nseg, axratio); /* Draw the arc */ |
| + | s2show(1); /* Open the s2plot window */ | ||
| + | |||
| + | return 1; | ||
| + | } | ||
| + | </pre></code> | ||
| + | |||
| + | [[S2PLOT:Function List | Back]] to S2PLOT function list. | ||
| + | |||
| + | __NOTOC__ | ||
| + | __NOEDITSECTION__ | ||
Current revision
ns2verc
Draw an arc - vector input.
Prototype
void ns2verc(XYZ P, XYZ N, XYZ S, 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
| ns2erc | Draw an arc. |
| ns2arc | Draw 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. |
| s2line | Draw 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[])
{
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 */
float axratio = 2.0;
ns2verc(pos, normal, start, deg, nseg, axratio); /* Draw the arc */
s2show(1); /* Open the s2plot window */
return 1;
}
Back to S2PLOT function list.
