summaryrefslogtreecommitdiff
path: root/graphics/epix/samples/semicirc.xp
blob: 8cac63ae9d039731549ddeaafec506c3a36c802b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* -*-ePiX-*- */
#include "epix.h"
using namespace ePiX;
double f(double x)
{
  return sqrt(1-x*x);
}

double width(0.6), height(f(width)), posn(0.5), y_posn(f(posn));

int main()
{
  picture(P(-1, 0), P(1, 1), "2.5 x 1.25in");

  begin();

  h_axis(4);  
  v_axis(2);  
  h_axis_labels(xsize(), P(0, -4), b);

  arc(P(0,0), 1, 0, M_PI);
  bold();
  rect(P(-width,0), P(width, height));

  label(P(posn, y_posn), P(2,4), "$y=\\sqrt{1-x^2}$", tr);

  end();
}