Example #1
0
File: demo.c Project: Juanlu001/gr
int main(void)
{
  float positions[3] = {0, 0, 0}, colors[3] = {0.5, 0.5, 0.5}, radii[1] = {2};

  gr3_clear();
  gr_setviewport(0.1, 0.95, 0.1, 0.95);
  gr3_setbackgroundcolor(1, 1, 1, 1);
  gr3_drawspheremesh(1, positions, colors, radii);
  gr3_drawimage(0, 1, 0, 1, 500, 500, GR3_DRAWABLE_GKS);
  gr_axes(0.04, 0.04, 0, 0, 5, 5, -0.01);
  gr_settextalign(2, 4);
  gr_text(0.525, 0.95, "GR3 Demo");
  gr3_export("gr3demo.png", 500, 500);
  gr_updatews();
}
Example #2
0
File: demo.c Project: jheinen/gr
int main(void)
{
  double x[POINTS], y[CURVES][POINTS];
  int i, j, k;

  putenv("GKS_DOUBLE_BUF=1");
#ifdef __APPLE__
  putenv("GKS_WSTYPE=211");
#endif

  srand(0);
  for (j = 0; j < CURVES; j++)
    {
      x[0] = y[j][0] = 0;
      for (i = 1; i < POINTS; i++)
        {
          x[i] = i;
          y[j][i] = y[j][i - 1] + (-0.5 + (double)rand() / RAND_MAX);
        }
    }

  k = 0;
  while (1)
    {
      gr_clearws();
      gr_setviewport(0.1, 0.95, 0.1, 0.95);
      gr_setwindow(k, k + POINTS, -20, 20);
      gr_setlinecolorind(1);
      gr_setcharheight(0.02);
      gr_axes(20, 1, k, -20, 5, 5, -0.01);
      for (j = 0; j < CURVES; j++)
        {
          gr_setlinecolorind(980 + j);
          gr_polyline(POINTS, x, y[j]);
        }
      gr_updatews();
      k++;
      for (i = 1; i < POINTS; i++)
        {
          x[i - 1] = x[i];
          for (j = 0; j < CURVES; j++) y[j][i - 1] = y[j][i];
        }
      x[POINTS - 1] = k + POINTS;
      for (j = 0; j < CURVES; j++) y[j][POINTS - 1] = y[j][POINTS - 2] + (-0.5 + (double)rand() / RAND_MAX);
    }
}
Example #3
0
void FORTRAN(gr_axes)(
  double *x_tick, double *y_tick, double *x_org, double *y_org,
  int *major_x, int *major_y, double *tick_size)
{
  gr_axes(*x_tick, *y_tick, *x_org, *y_org, *major_x, *major_y, *tick_size);
}