Function:s2circxz

From S2PLOT

(Difference between revisions)
Jump to: navigation, search
Revision as of 07:22, 27 October 2007
S2plot admin (Talk | contribs)

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


Current revision

s2circxz

Draw a circle in the xz plane at a given y coordinate.

Prototype

void s2circxz(float px, float py, float pz, float r, int nseg, float asp);

Description

Draw a circle in the xz plane at a given y coordinate. Use nseg to control how many line segments are used to draw the circle. Low values of nseg (>= 3) can be used to draw n-sided polygons!

Argument asp controls the aspect ratio and whether a circle or ellipse is drawn. asp<0 will produce a circle by calculating the radius as the functions s2disk?? do. asp=1.0 will produce a circle when the x and y axes have the same device scale and an ellipse otherwise; asp < 1.0 will squash the ellipse further in y (z, x); asp > 1.0 stretch in the y (z, x) direction.


See Also

s2circxy Draw a circle in the xy plane at a given z coordinate.
s2circyz Draw a circle in the yz plane at a given x coordinate.
s2diskxy Draw a disk in the xy plane at a given z coordinate.
s2diskxz Draw a disk in the xz plane at a given y coordinate.
s2diskyz Draw a disk in the yz plane at a given x coordinate.

PGPLOT Equivalent

PGCIRC

Code Example

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

int main(int argc, char *argv[])
{
   float r   = 0.5;				/* Radius */
   int nseg  = 32;				/* Segments for circle */
   float asp = 1.0;				/* Circle not ellipse */

   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 */
   s2sci(S2_PG_RED);
   s2circxz(0.0,+0.5,0.0, r, nseg,asp);		/* Circle in x-z plane */
   s2sci(S2_PG_BLUE);
   s2circxz(0.0,-0.5,0.0, r/2.0, nseg,asp);	/* Circle in x-z plane */
   s2show(1);					/* Open the s2plot window */
   
   return 1;
}

Back to S2PLOT function list.


Personal tools