#include <gugr_contour.h>
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< vertex > | verts |
Ptr< line > | lines |
int | nOwners |
Ptr< void *> | owners |
bool | side |
bool | hole |
contour_node * | parent |
RefMap< void > | childs |
segment * | hseg |
segment * | seg |
bool | hseg_firstref |
contour_node * | next |
contour_node * | prev |
|
Definition at line 160 of file gugr_contour.h. Referenced by dump(), and Insert().
|
|
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 } |
|
Definition at line 178 of file gugr_contour.h.
|
|
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 } |
|
Definition at line 166 of file gugr_contour.h. References nOwners, and owners.
|
|
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 } |
|
Definition at line 150 of file gugr_contour.h. |
|
Definition at line 147 of file gugr_contour.h. |
|
Definition at line 152 of file gugr_contour.h. |
|
Definition at line 155 of file gugr_contour.h. |
|
Definition at line 141 of file gugr_contour.h. Referenced by get_polyline_joined(). |
|
Definition at line 157 of file gugr_contour.h. |
|
Definition at line 143 of file gugr_contour.h. Referenced by contour_node(), and hasOwner(). |
|
Definition at line 138 of file gugr_contour.h. Referenced by get_polyline(), and get_polyline_joined(). |
|
Definition at line 144 of file gugr_contour.h. Referenced by hasOwner(). |
|
Definition at line 149 of file gugr_contour.h. |
|
Definition at line 158 of file gugr_contour.h. |
|
Definition at line 153 of file gugr_contour.h. |
|
Definition at line 146 of file gugr_contour.h. Referenced by contour_node(), and Insert(). |
|
Definition at line 139 of file gugr_contour.h. Referenced by get_polyline(), and get_polyline_joined(). |