Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

gugr::contour_node Struct Reference

#include <gugr_contour.h>

List of all members.

Public Methods

 contour_node (bool aside)
bool hasOwner (void *o)
void get_polyline (gul::polyline< gul::point2< guar::rational > > &pl)
void get_polyline_joined (gul::polyline< gul::point2< guar::rational > > &pl)
void Insert (contour_node *achild)
void dump (int indent)

Public Attributes

int nVerts
Ptr< vertexverts
Ptr< linelines
int nOwners
Ptr< void *> owners
bool side
bool hole
contour_node * parent
RefMap< void > childs
segmenthseg
segmentseg
bool hseg_firstref
contour_node * next
contour_node * prev


Constructor & Destructor Documentation

gugr::contour_node::contour_node bool    aside [inline]
 

Definition at line 160 of file gugr_contour.h.

References nOwners, and side.

Referenced by dump(), and Insert().

00161   { 
00162     parent = 0; 
00163     side = aside; 
00164     nOwners = 0; }


Member Function Documentation

void gugr::contour_node::dump int    indent [inline]
 

Definition at line 265 of file gugr_contour.h.

References childs, and contour_node().

00266   {
00267     RefMap<void>::Node mn;
00268     int i;
00269 
00270     for( i = 0; i < indent; i++ ) std::cout << " ";
00271     std::cout << "contour " << (void *)this << "\n";
00272     for( i = 0; i < indent; i++ ) std::cout << " ";
00273     std::cout << "parent = " << (void *)parent << "\n";
00274     for( i = 0; i < indent; i++ ) std::cout << " ";
00275     std::cout << "childs = (\n";
00276 
00277     mn = childs.First();
00278     while( !mn.IsEmpty() )
00279     {
00280       for( i = 0; i < indent; i++ ) std::cout << " ";
00281       std::cout << "  " << mn.key() << "\n";
00282       mn = childs.Successor( mn );
00283     }
00284     for( i = 0; i < indent; i++ ) std::cout << " ";
00285     std::cout << ")\n\n";
00286 
00287     // recursion, dump childs
00288     mn = childs.First();
00289     while( !mn.IsEmpty() )
00290     {
00291       ((contour_node *)mn.key())->dump(indent+4);
00292       mn = childs.Successor( mn );
00293     }
00294   }

void gugr::contour_node::get_polyline gul::polyline< gul::point2< guar::rational > > &    pl [inline]
 

Definition at line 178 of file gugr_contour.h.

References nVerts, and verts.

00179   {
00180     int i;
00181 
00182     pl.P.reserve_pool(nVerts);
00183     pl.n = nVerts;
00184 
00185     for( i = 0; i < nVerts; i++ )
00186       pl.P[i] = verts[i].v();
00187   }

void gugr::contour_node::get_polyline_joined gul::polyline< gul::point2< guar::rational > > &    pl [inline]
 

Definition at line 189 of file gugr_contour.h.

References lines, nVerts, and verts.

00190   {
00191     int i,j,i1,iend;
00192 
00193     pl.P.reserve_pool(nVerts);
00194     pl.n = nVerts;
00195 
00196     // find a point which is not in the midst of a series of
00197     // colinear points
00198     i1 = nVerts-1;
00199     for( i = 0; i < nVerts; i++ )
00200     {
00201       if( (compare(lines[i].dx(),lines[i1].dx())!=0) ||
00202           (compare(lines[i].dy(),lines[i1].dy())!=0) )
00203         break;
00204       i1 = i;
00205     }
00206     if( i == nVerts ) // not found
00207     {
00208       pl.n = 0;  // everything is colinear, so whole contour is unnecessary
00209       return;    
00210     }
00211 
00212     pl.P[0] = verts[i].v();
00213     // DumpPS<float>::dump_point(pl.P[0]);
00214 
00215     i1 = iend = i;
00216     i++; 
00217     if( i >= nVerts ) i = 0;
00218     j = 1;
00219 
00220     for(;;)
00221     {
00222       // search next point which is not colinear
00223       while( i != iend )
00224       {
00225         if( (compare(lines[i].dx(),lines[i1].dx())!=0) ||
00226             (compare(lines[i].dy(),lines[i1].dy())!=0) )
00227           break;
00228 
00229         i++;
00230         if( i >= nVerts ) i = 0; // wrap around
00231       }
00232 
00233       // start point of contour reached again
00234       if( i == iend )
00235         break;
00236 
00237       pl.P[j] = verts[i].v();
00238       // DumpPS<float>::dump_point(pl.P[j]);
00239 
00240       i1 = i;
00241       i++;
00242       if( i >= nVerts ) i = 0; // wrap around
00243       j++;
00244     }
00245 
00246     pl.n = j;
00247   }

bool gugr::contour_node::hasOwner void *    o [inline]
 

Definition at line 166 of file gugr_contour.h.

References nOwners, and owners.

00167   {
00168     int i;
00169 
00170     for( i=0; i < nOwners; i++ )
00171     {
00172       if( owners[i] == o )
00173         return true;
00174     }
00175     return false;
00176   }

void gugr::contour_node::Insert contour_node *    achild [inline]
 

Definition at line 249 of file gugr_contour.h.

References childs, gugr::compare_pointer_to_pointer(), contour_node(), and side.

00250   {
00251     int side;
00252     RefMap<void>::Node pos,child;
00253 
00254     side = childs.SearchNode( (void *)achild, compare_pointer_to_pointer,
00255                                &pos );
00256     if( side != 0 )
00257     {
00258       child = childs.NewNode((void *)achild);
00259       achild->parent = this;
00260       childs.InsertNode( child, pos, side );
00261     }
00262   }


Member Data Documentation

RefMap<void> gugr::contour_node::childs
 

Definition at line 150 of file gugr_contour.h.

Referenced by dump(), and Insert().

bool gugr::contour_node::hole
 

Definition at line 147 of file gugr_contour.h.

segment* gugr::contour_node::hseg
 

Definition at line 152 of file gugr_contour.h.

bool gugr::contour_node::hseg_firstref
 

Definition at line 155 of file gugr_contour.h.

Ptr<line> gugr::contour_node::lines
 

Definition at line 141 of file gugr_contour.h.

Referenced by get_polyline_joined().

contour_node* gugr::contour_node::next
 

Definition at line 157 of file gugr_contour.h.

int gugr::contour_node::nOwners
 

Definition at line 143 of file gugr_contour.h.

Referenced by contour_node(), and hasOwner().

int gugr::contour_node::nVerts
 

Definition at line 138 of file gugr_contour.h.

Referenced by get_polyline(), and get_polyline_joined().

Ptr<void*> gugr::contour_node::owners
 

Definition at line 144 of file gugr_contour.h.

Referenced by hasOwner().

contour_node* gugr::contour_node::parent
 

Definition at line 149 of file gugr_contour.h.

contour_node* gugr::contour_node::prev
 

Definition at line 158 of file gugr_contour.h.

segment* gugr::contour_node::seg
 

Definition at line 153 of file gugr_contour.h.

bool gugr::contour_node::side
 

Definition at line 146 of file gugr_contour.h.

Referenced by contour_node(), and Insert().

Ptr<vertex> gugr::contour_node::verts
 

Definition at line 139 of file gugr_contour.h.

Referenced by get_polyline(), and get_polyline_joined().


The documentation for this struct was generated from the following file:
Generated on Mon Jan 21 04:17:54 2002 for GUL 0.6 - Geometry Utility Library by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001