Back to index

texmacs  1.0.7.15
Public Member Functions | Public Attributes | Protected Attributes
logarithmic_rep Struct Reference
Inheritance diagram for logarithmic_rep:
Inheritance graph
[legend]
Collaboration diagram for logarithmic_rep:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 logarithmic_rep (array< SI > subd, array< string > col, point o, double st, SI b)
 operator tree ()
array< grid_curveget_curves (point lim1, point lim2, bool b)
point find_closest_point (point p, point pmin, point pmax)
virtual void set_aspect (tree aspect)
virtual array< grid_curveget_curves_around (point p, double delta, frame f)
virtual point find_point_around (point p, double delta, frame f)

Public Attributes

double step
SI base
int ref_count

Protected Attributes

array< SIsubd
array< stringcol
point center

Detailed Description

Definition at line 378 of file grid.cpp.


Constructor & Destructor Documentation

logarithmic_rep::logarithmic_rep ( array< SI subd,
array< string col,
point  o,
double  st,
SI  b 
) [inline]

Definition at line 381 of file grid.cpp.

                                                                               :
    grid_rep (subd, col, o), step (max (st, 1.0e-6)), base (b) {}

Member Function Documentation

point logarithmic_rep::find_closest_point ( point  p,
point  pmin,
point  pmax 
) [virtual]

Implements grid_rep.

Definition at line 431 of file grid.cpp.

                                                                    {
  double x, y, ssubd= ((double) subd[1]) / step;
  point res= p;
  if (ssubd!=0) {
    p= p-center;
    x= nearest (p[0]*ssubd);
    y= nearest (p[1]*ssubd);
    res= center + point (x/ssubd, y/ssubd);
    if (inside_rectangle (res, pmin, pmax))
      return res;
    p= center+p;
  }
  double xo, yo;
  xo= center[0];
  yo= center[1];
  double x1, y1, x2, y2;
  x1= xo-step;
  y1= yo-step;
  x2= xo+step;
  y2= yo+step;
  p= p-center;
  double x0, y0;
  x0= (SI)(p[0]/step);
  y0= (SI)(p[1]/step);
  x0*= step;
  y0*= step;
  p= p-point(x0,y0);
  p= center+p;
  double xm, ym;
  xm= ym= tm_infinity/2;
  int i;
  for (i=1; i<base; i++) {
    double dx, dy;
    dx= dy= step*log((double)i)/log((double)base);
    for (x=xo; x<=x2; x+=step)
      if (norm(x+dx-p[0])<norm(xm-p[0])) xm= x+dx;
    for (x=xo-step; x>=x1-step; x-=step)
      if (norm(x+dx-p[0])<norm(xm-p[0])) xm= x+dx;
    for (y=yo; y<=y2; y+=step)
      if (norm(y+dy-p[1])<norm(ym-p[1])) ym= y+dy;
    for (y=yo-step; y>=y1-step; y-=step)
      if (norm(y+dy-p[1])<norm(ym-p[1])) ym= y+dy;
  }
  p= point (x0+xm, y0+ym);
  if (ssubd!=0) {
    if (inside_rectangle (point (res[0], p[1]), pmin, pmax))
      return point (res[0], p[1]);
    if (inside_rectangle (point (p[0], res[1]), pmin, pmax))
      return point (p[0], res[1]);
  }
  return p;
}

Here is the call graph for this function:

point grid_rep::find_point_around ( point  p,
double  delta,
frame  f 
) [virtual, inherited]

Definition at line 76 of file grid.cpp.

                                                           {
  point p2= f (p);
  point pmin, pmax;
  pmin= f[point (p2[0]-delta, p2[1]-delta)];
  pmax= f[point (p2[0]+delta, p2[1]+delta)];
  return find_closest_point (p, pmin, pmax);
}

Here is the call graph for this function:

array< grid_curve > logarithmic_rep::get_curves ( point  lim1,
point  lim2,
bool  b 
) [virtual]

Implements grid_rep.

Definition at line 389 of file grid.cpp.

                                                           {
  (void) b;
  array<grid_curve> res;
  if (N(subd)<1) return res;
  double x1= min (lim1[0], lim2[0]);
  double y1= min (lim1[1], lim2[1]);
  double x2= max (lim1[0], lim2[0]);
  double y2= max (lim1[1], lim2[1]);
  double xo= center[0];
  double yo= center[1];
  int i;
  double x, y;
  if (N(col)>=3) {
    for (i=2; i<base; i++) {
      double dx, dy;
      dx= dy= step*log((double)i)/log((double)base);
      for (x=xo; x<=x2; x+=step)
        res << create_line (x+dx, y1, x+dx, y2, col[2]);
      for (x=xo-step; x>=x1-step; x-=step)
        res << create_line (x+dx, y1, x+dx, y2, col[2]);
      for (y=yo; y<=y2; y+=step)
        res << create_line (x1, y+dy, x2, y+dy, col[2]);
      for (y=yo-step; y>=y1-step; y-=step)
        res << create_line (x1, y+dy, x2, y+dy, col[2]);
    }
  }
  if (N(col)>=2) {
    for (x=xo; x<=x2; x+=step)
      res << create_line (x, y1, x, y2, col[1]);
    for (x=xo; x>=x1; x-=step)
      res << create_line (x, y1, x, y2, col[1]);
    for (y=yo; y<=y2; y+=step)
      res << create_line (x1, y, x2, y, col[1]);
    for (y=yo; y>=y1; y-=step)
      res << create_line (x1, y, x2, y, col[1]);
  }
  res << create_line (x1, yo, x2, yo, col[0]);
  res << create_line (xo, y1, xo, y2, col[0]);
  return res;
}

Here is the call graph for this function:

array< grid_curve > grid_rep::get_curves_around ( point  p,
double  delta,
frame  f 
) [virtual, inherited]

Reimplemented in cartesian_rep.

Definition at line 67 of file grid.cpp.

                                                           {
  point p2= f (p);
  point pmin, pmax;
  pmin= f[point (p2[0]-delta, p2[1]-delta)];
  pmax= f[point (p2[0]+delta, p2[1]+delta)];
  return get_curves (pmin, pmax, true);
}

Here is the call graph for this function:

logarithmic_rep::operator tree ( ) [inline, virtual]

Implements grid_rep.

Definition at line 383 of file grid.cpp.

{ return "logarithmic"; }
void grid_rep::set_aspect ( tree  aspect) [virtual, inherited]

Definition at line 21 of file grid.cpp.

                                 {
  subd= array<SI> (2);
  subd[0]= 0;
  subd[1]= 1;
  col= array<string> (2);
  col[0]= "#808080";
  col[1]= "#c0c0c0";
  if (is_tuple (aspect)) {
    int i;
    bool b= false;
    subd= array<SI> (N(aspect));
    col= array<string> (N(aspect));
    for (i=0; i<N(aspect); i++) {
       if (is_tuple (aspect[i], "axes", 1)) {
         subd[i]= 0;
         b= true;
       }
       else {
         subd[i]= as_int (aspect[i][0]);
       }
       col[i]= as_string (aspect[i][1]);
    }
    if (!b) {
      array<SI> subd0 (1);
      array<string> col0 (1);
      subd0[0]= 0;
      col0[0]= "#e0e0ff";
      subd= subd0 << subd;
      col= col0 << col;
    }
    do {
      b= true;
      for (i=1; i<N(subd); i++)
         if (subd[i-1]>subd[i]) {
           SI j;
           string c;
           j= subd[i-1];subd[i-1]= subd[i];subd[i]= j;
           c= col[i-1];col[i-1]= col[i];col[i]= c;
           b= false;
         }
    }
    while (!b);
  }
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 380 of file grid.cpp.

point grid_rep::center [protected, inherited]

Definition at line 38 of file grid.hpp.

array<string> grid_rep::col [protected, inherited]

Definition at line 37 of file grid.hpp.

int abstract_struct::ref_count [inherited]

Definition at line 142 of file basic.hpp.

Definition at line 379 of file grid.cpp.

array<SI> grid_rep::subd [protected, inherited]

Definition at line 36 of file grid.hpp.


The documentation for this struct was generated from the following file: