NetPoint Class Reference

List of all members.

Public Member Functions

 NetPoint ()
void setNotFree ()
void mark_as_tx ()
void move (bool goto_shouldbe)
void fixx ()
void fixy ()
void realize ()
void set_bound (int mx, int my)

Public Attributes

double x
double y
double shouldbe_x
double shouldbe_y
double a
double b
double nx
double ny
bool free
NetPointup
NetPointdown
NetPointleft
NetPointright

Detailed Description

Definition at line 27 of file morph.cpp.


Constructor & Destructor Documentation

NetPoint::NetPoint  )  [inline]
 

Definition at line 42 of file morph.cpp.

References down, free, left, right, shouldbe_x, shouldbe_y, up, x, and y.

00043   {
00044     x = y = shouldbe_x = shouldbe_y = 0;
00045     free = true;
00046     up = down = left = right = NULL;
00047   }


Member Function Documentation

void NetPoint::fixx  )  [inline]
 

Definition at line 112 of file morph.cpp.

References a, free, left, right, and x.

00113   {
00114     if (!free) return;
00115     // where are the current endpoints
00116     NetPoint * L;
00117     L = left;
00118     while(L)
00119       {
00120         if (!L->free) break;
00121         L=L->left;
00122       }
00123 
00124     NetPoint * R;
00125     R = right;
00126     while(R)
00127       {
00128         if (!R->free) break;
00129         R=R->right;
00130       }
00131     assert(L&&R);
00132     double pct = (a-L->a)/(R->a-L->a);
00133     printf("%g\n",pct);
00134     x = pct*(R->x-L->x)+L->x;
00135   }

void NetPoint::fixy  )  [inline]
 

Definition at line 137 of file morph.cpp.

References b, down, free, up, and y.

00138   {
00139     if (!free) return;
00140     // where are the current endpoints
00141     NetPoint * U;
00142     U = up;
00143     while(U)
00144       {
00145         if (!U->free) break;
00146         U=U->up;
00147       }
00148     
00149     NetPoint * D;
00150     D = down;
00151     while(D)
00152       {
00153         if (!D->free) break;
00154         D=D->down;
00155       }
00156     assert(U&&D);
00157     double pct = (b-U->b)/(D->b-U->b);
00158     y = pct*(D->y-U->y)+U->y;
00159   }

void NetPoint::mark_as_tx  )  [inline]
 

Definition at line 54 of file morph.cpp.

References a, b, shouldbe_x, shouldbe_y, x, and y.

00055   {
00056     a = x;
00057     b = y;
00058     x = shouldbe_x;
00059     y = shouldbe_y;
00060   }

void NetPoint::move bool  goto_shouldbe  )  [inline]
 

Definition at line 61 of file morph.cpp.

References down, free, left, nx, ny, right, shouldbe_x, shouldbe_y, sign(), up, x, and y.

00062   {
00063     double bx = x;
00064     double by = y;
00065     if (free)
00066       {
00067         int i = 0;
00068         x = 0;
00069         y = 0;
00070         if (left)
00071           {
00072             x+=left->x;
00073             y+=left->y;
00074             i++;
00075           }
00076         if (right)
00077           {
00078             x+=right->x;
00079             y+=right->y;
00080             i++;
00081           }
00082         if (up)
00083           {
00084             x+=up->x;
00085             y+=up->y;
00086             i++;
00087           }
00088         if (down)
00089           {
00090             x+=down->x;
00091             y+=down->y;
00092             i++;
00093           }
00094         x/=i;
00095         y/=i;
00096       }
00097     else if (goto_shouldbe && (shouldbe_x != x || shouldbe_y != y))
00098       {
00099         double dx=0;
00100         double dy=0;
00101         dx = sign(shouldbe_x-x);
00102         dy = sign(shouldbe_y-y);
00103         x+=dx;
00104         y+=dy;
00105       }
00106     nx = x;
00107     ny =y;
00108     x = bx;
00109     y = by;
00110   }

void NetPoint::realize  )  [inline]
 

Definition at line 161 of file morph.cpp.

References nx, ny, x, and y.

00162   {
00163     x = nx;
00164     y = ny;
00165   }

void NetPoint::set_bound int  mx,
int  my
[inline]
 

Definition at line 167 of file morph.cpp.

References a, b, x, and y.

00168   {
00169     if (x>mx-1) x = mx-1;
00170     if (y>my-1) y = my-1;
00171     if (a>mx-1) a = mx-1;
00172     if (b>my-1) b = my-1;
00173     if (x<0) x = 0;
00174     if (y<0) y = 0;
00175     if (a<0) a = 0;
00176     if (b<0) b = 0;
00177   }

void NetPoint::setNotFree  )  [inline]
 

Definition at line 48 of file morph.cpp.

References free, shouldbe_x, shouldbe_y, x, and y.

00049   {
00050     shouldbe_x=x;
00051     shouldbe_y=y;
00052     free = false;
00053   }


Member Data Documentation

double NetPoint::a
 

Definition at line 33 of file morph.cpp.

Referenced by fixx(), mark_as_tx(), and set_bound().

double NetPoint::b
 

Definition at line 34 of file morph.cpp.

Referenced by fixy(), mark_as_tx(), and set_bound().

NetPoint* NetPoint::down
 

Definition at line 39 of file morph.cpp.

Referenced by fixy(), move(), and NetPoint().

bool NetPoint::free
 

Definition at line 37 of file morph.cpp.

Referenced by fixx(), fixy(), move(), NetPoint(), and setNotFree().

NetPoint* NetPoint::left
 

Definition at line 40 of file morph.cpp.

Referenced by fixx(), move(), and NetPoint().

double NetPoint::nx
 

Definition at line 35 of file morph.cpp.

Referenced by move(), and realize().

double NetPoint::ny
 

Definition at line 36 of file morph.cpp.

Referenced by move(), and realize().

NetPoint* NetPoint::right
 

Definition at line 41 of file morph.cpp.

Referenced by fixx(), move(), and NetPoint().

double NetPoint::shouldbe_x
 

Definition at line 31 of file morph.cpp.

Referenced by mark_as_tx(), move(), NetPoint(), and setNotFree().

double NetPoint::shouldbe_y
 

Definition at line 32 of file morph.cpp.

Referenced by mark_as_tx(), move(), NetPoint(), and setNotFree().

NetPoint* NetPoint::up
 

Definition at line 38 of file morph.cpp.

Referenced by fixy(), move(), and NetPoint().

double NetPoint::x
 

Definition at line 29 of file morph.cpp.

Referenced by fixx(), mark_as_tx(), move(), NetPoint(), realize(), set_bound(), and setNotFree().

double NetPoint::y
 

Definition at line 30 of file morph.cpp.

Referenced by fixy(), mark_as_tx(), move(), NetPoint(), realize(), set_bound(), and setNotFree().


The documentation for this class was generated from the following file:
Generated on Mon Jun 5 22:08:43 2006 for iis by  doxygen 1.4.6