Function:s2circxy

From S2PLOT

Jump to: navigation, search

s2circxy

Draw a circle in the xy plane at a given z coordinate.

Prototype

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

Description

Draw a circle in the xy plane at a given z 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

s2circxz Draw a circle in the xz plane at a given y 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);
   s2circxy(0.0,0.0,-0.5, r, nseg,asp);		/* Circle in x-y plane */
   s2sci(S2_PG_BLUE);
   s2circxy(0.0,0.0,+0.5, r/2.0, nseg,asp);	/* Circle in x-y plane */
   s2show(1);					/* Open the s2plot window */
   
   return 1;
}

Back to S2PLOT function list.


Personal tools