Back to index

texmacs  1.0.7.15
Classes | Functions
grid.cpp File Reference
#include "grid.hpp"
#include "math_util.hpp"
#include "curve.hpp"

Go to the source code of this file.

Classes

struct  empty_grid_rep
struct  cartesian_rep
struct  polar_rep
struct  logarithmic_rep

Functions

grid empty_grid ()
static grid_curve create_line (double x1, double y1, double x2, double y2, string col)
grid cartesian (array< SI > subd, array< string > col, point o, double step)
static grid_curve create_arc (double x1, double y1, double x2, double y2, double x3, double y3, string col)
grid polar (array< SI > subd, array< string > col, point o, double step, SI astep)
grid logarithmic (array< SI > subd, array< string > col, point o, double step, SI base)
grid as_grid (tree t)
tree as_tree (grid g)

Function Documentation

grid as_grid ( tree  t)

Definition at line 494 of file grid.cpp.

                 {
  array<SI> subd (0, 1);
  array<string> col ("black", "black");
  grid gr= empty_grid ();
  double step= 1.0;
  point center= point (0.0, 0.0);
  if (is_tuple (t, "empty"))
    gr= empty_grid ();
  else
  if (is_tuple (t, "cartesian")) {
    if (is_tuple (t, "cartesian", 0)) ;
    else
    if (is_tuple (t, "cartesian", 1))
      step= as_double (t[1]);
    else
    if (is_tuple (t, "cartesian", 2)) {
      center= as_point (t[1]);
      step= as_double (t[2]);
    }
    gr= cartesian (subd, col, center, step);
  }
  else
  if (is_tuple (t, "polar")) {
    SI astep= 8;
    if (is_tuple (t, "polar", 0)) ;
    else
    if (is_tuple (t, "polar", 1))
      step= as_double (t[1]);
    else
    if (is_tuple (t, "polar", 2)) {
      step= as_double (t[1]);
      astep= as_int (t[2]);
    }
    else
    if (is_tuple (t, "polar", 3)) {
      center= as_point (t[1]);
      step= as_double (t[2]);
      astep= as_int (t[3]);
    }
    gr=polar (subd, col, center, step, astep);
  }
  else
  if (is_tuple (t, "logarithmic")) {
    SI base= 10;
    if (is_tuple (t, "logarithmic", 0)) ;
    else
    if (is_tuple (t, "logarithmic", 1))
      step= as_double (t[1]);
    else
    if (is_tuple (t, "logarithmic", 2)) {
      step= as_double (t[1]);
      base= as_int (t[2]);
    }
    else
    if (is_tuple (t, "logarithmic", 3)) {
      center= as_point (t[1]);
      step= as_double (t[2]);
      base= as_int (t[3]);
    }
    gr= logarithmic (subd, col, center, step, base);
  }
  return gr;
}

Here is the call graph for this function:

Here is the caller graph for this function:

tree as_tree ( grid  g)

Definition at line 559 of file grid.cpp.

                 {
  return (tree) g;
}
grid cartesian ( array< SI subd,
array< string col,
point  o,
double  step 
)

Definition at line 247 of file grid.cpp.

                                                                    {
  return tm_new<cartesian_rep> (subd, col, o, step);
}

Here is the caller graph for this function:

static grid_curve create_arc ( double  x1,
double  y1,
double  x2,
double  y2,
double  x3,
double  y3,
string  col 
) [static]

Definition at line 266 of file grid.cpp.

{
  array<point> a(3);
  a[0]= point (x1, y1);
  a[1]= point (x2, y2);
  a[2]= point (x3, y3);
  array<path> cip(3);
  grid_curve res= grid_curve (col, arc (a, cip, true));
  return res;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static grid_curve create_line ( double  x1,
double  y1,
double  x2,
double  y2,
string  col 
) [static]

Definition at line 128 of file grid.cpp.

                                                                     {
  array<point> a(2);
  a[0]= point (x1, y1);
  a[1]= point (x2, y2);
  array<path> cip(2);
  grid_curve res= grid_curve (col, poly_segment (a, cip));
  return res;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 109 of file grid.cpp.

              {
  return tm_new<empty_grid_rep> ();
}

Here is the caller graph for this function:

grid logarithmic ( array< SI subd,
array< string col,
point  o,
double  step,
SI  base 
)

Definition at line 485 of file grid.cpp.

                                                                               {
  return tm_new<logarithmic_rep> (subd, col, o, step, base);
}

Here is the caller graph for this function:

grid polar ( array< SI subd,
array< string col,
point  o,
double  step,
SI  astep 
)

Definition at line 370 of file grid.cpp.

                                                                          {
  return tm_new<polar_rep> (subd, col, o, step, astep);
}

Here is the caller graph for this function: