Back to index

texmacs  1.0.7.15
Classes | Typedefs | Functions
rectangles.hpp File Reference
#include "list.hpp"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  rectangle_rep
class  rectangle

Typedefs

typedef list< rectanglerectangles

Functions

 CONCRETE_CODE (rectangle)
tm_ostreamoperator<< (tm_ostream &out, rectangle r)
rectangle copy (rectangle r)
bool operator== (rectangle r1, rectangle r2)
bool operator!= (rectangle r1, rectangle r2)
bool intersect (rectangle r1, rectangle r2)
bool operator<= (rectangle r1, rectangle r2)
rectangle translate (rectangle r, SI x, SI y)
rectangle operator* (rectangle r, int d)
rectangle operator/ (rectangle r, int d)
double area (rectangle r)
rectangles operator- (rectangles l1, rectangles l2)
rectangles operator& (rectangles l1, rectangles l2)
rectangles operator| (rectangles l1, rectangles l2)
rectangles operator* (rectangles l, int d)
rectangles operator/ (rectangles l, int d)
rectangles translate (rectangles l, SI x, SI y)
rectangles thicken (rectangles l, SI width, SI height)
rectangles outline (rectangles l, SI pixel)
rectangles correct (rectangles l)
rectangles simplify (rectangles l)
rectangle least_upper_bound (rectangles l)
double area (rectangles r)

Typedef Documentation

Definition at line 44 of file rectangles.hpp.


Function Documentation

double area ( rectangle  r)

Definition at line 78 of file rectangles.cpp.

                   {
  double w= max (r->x2 - r->x1, 0);
  double h= max (r->y2 - r->y1, 0);
  return w*h;
}

Here is the caller graph for this function:

double area ( rectangles  r)

Definition at line 243 of file rectangles.cpp.

                    {
  double sum= 0.0;
  while (!is_nil (r)) {
    sum += area (r->item);
    r= r->next;
  }
  return sum;
}

Here is the call graph for this function:

Definition at line 40 of file rectangles.cpp.

                   {
  return rectangle (r->x1, r->y1, r->x2, r->y2);
}

Definition at line 214 of file rectangles.cpp.

                       {
  if (is_nil (l)) return l;
  if ((l->item->x1 >= l->item->x2) || (l->item->y1 >= l->item->y2))
    return correct (l->next);
  return rectangles (l->item, correct (l->next));
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool intersect ( rectangle  r1,
rectangle  r2 
)

Definition at line 66 of file rectangles.cpp.

                                       {
  return
    (r1->x1<r2->x2) && (r1->x2>r2->x1) &&
    (r1->y1<r2->y2) && (r1->y2>r2->y1);
}

Here is the caller graph for this function:

Definition at line 228 of file rectangles.cpp.

                                 {
  ASSERT (!is_nil (l), "no rectangles in list");
  rectangle r1= copy (l->item);
  while (!is_nil (l->next)) {
    l= l->next;
    rectangle r2= l->item;
    r1->x1= min (r1->x1, r2->x1);
    r1->y1= min (r1->y1, r2->y1);
    r1->x2= max (r1->x2, r2->x2);
    r1->y2= max (r1->y2, r2->y2);
  }
  return r1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool operator!= ( rectangle  r1,
rectangle  r2 
)

Definition at line 52 of file rectangles.cpp.

                                         {
  return
    (r1->x1!=r2->x1) || (r1->y1!=r2->y1) ||
    (r1->x2!=r2->x2) || (r1->y2!=r2->y2);
}
rectangles operator& ( rectangles  l1,
rectangles  l2 
)

Definition at line 142 of file rectangles.cpp.

                                          {
  rectangles l, lc1, lc2;
  for (lc1= l1; !is_nil (lc1); lc1= lc1->next)
    for (lc2= l2; !is_nil (lc2); lc2= lc2->next)
      intersection (lc1->item, lc2->item, l);
  return l;
}

Here is the call graph for this function:

rectangle operator* ( rectangle  r,
int  d 
)

Definition at line 117 of file rectangles.cpp.

                                {
  return rectangle (r->x1*d, r->y1*d, r->x2*d, r->y2*d);
}
rectangles operator* ( rectangles  l,
int  d 
)

Definition at line 202 of file rectangles.cpp.

                                 {
  if (is_nil (l)) return l;
  return rectangles (l->item*d, l->next*d);
}

Here is the call graph for this function:

rectangles operator- ( rectangles  l1,
rectangles  l2 
)

Definition at line 131 of file rectangles.cpp.

                                          {
  rectangles a=l1;
  for (; !is_nil (l2); l2= l2->next) {
    rectangles b;
    complement (a, l2->item, b);
    a=b;
  }
  return a;
}

Here is the call graph for this function:

rectangle operator/ ( rectangle  r,
int  d 
)

Definition at line 122 of file rectangles.cpp.

                                {
  return rectangle (r->x1/d, r->y1/d, r->x2/d, r->y2/d);
}
rectangles operator/ ( rectangles  l,
int  d 
)

Definition at line 208 of file rectangles.cpp.

                                 {
  if (is_nil (l)) return l;
  return rectangles (l->item/d, l->next/d);
}

Here is the call graph for this function:

tm_ostream& operator<< ( tm_ostream out,
rectangle  r 
)

Definition at line 32 of file rectangles.cpp.

                                           {
  out << "rectangle ("
      << r->x1 << ", " << r->y1 << ", "
      << r->x2 << ", " << r->y2 << ")";
  return out;
}
bool operator<= ( rectangle  r1,
rectangle  r2 
)

Definition at line 59 of file rectangles.cpp.

                                         {
  return
    (r1->x1>=r2->x1) && (r1->x2<=r2->x2) &&
    (r1->y1>=r2->y1) && (r1->y2<=r2->y2);
}
bool operator== ( rectangle  r1,
rectangle  r2 
)

Definition at line 45 of file rectangles.cpp.

                                         {
  return
    (r1->x1==r2->x1) && (r1->y1==r2->y1) &&
    (r1->x2==r2->x2) && (r1->y2==r2->y2);
}
rectangles operator| ( rectangles  l1,
rectangles  l2 
)

Definition at line 169 of file rectangles.cpp.

                                          {
  rectangles l (l1-l2);
  while (!is_nil (l2)) {
    l = disjoint_union (l, l2->item);
    l2= l2->next;
  }
  return l;
}

Here is the call graph for this function:

rectangles outline ( rectangles  l,
SI  pixel 
)

Definition at line 196 of file rectangles.cpp.

                                  {
  return simplify (correct (thicken (rs, pixel, 3*pixel) -
                         thicken (rs, 0, 2*pixel)));
}

Here is the call graph for this function:

Definition at line 222 of file rectangles.cpp.

                        {
  if (is_nil (l) || is_atom (l)) return l;
  return simplify (l->next) | rectangles (l->item);
}

Here is the call graph for this function:

rectangles thicken ( rectangles  l,
SI  width,
SI  height 
)

Definition at line 187 of file rectangles.cpp.

                                            {
  if (is_nil (l)) return l;
  rectangle& r= l->item;
  return rectangles (rectangle (r->x1- width, r->y1- height,
                            r->x2+ width, r->y2+ height),
                   thicken (l->next, width, height));
}

Here is the call graph for this function:

Here is the caller graph for this function:

rectangle translate ( rectangle  r,
SI  x,
SI  y 
)

Definition at line 73 of file rectangles.cpp.

                                    {
  return rectangle (r->x1+x, r->y1+y, r->x2+x, r->y2+y);
}

Here is the caller graph for this function:

rectangles translate ( rectangles  l,
SI  x,
SI  y 
)

Definition at line 179 of file rectangles.cpp.

                                     {
  if (is_nil (l)) return l;
  rectangle& r= l->item;
  return rectangles (rectangle (r->x1+ x, r->y1+ y, r->x2+ x, r->y2+ y),
                   translate (l->next, x, y));
}

Here is the call graph for this function: