Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
demo.c
Package: leda.tar.gz [view]
Upload User: gzelex
Upload Date: 2007-01-07
Package Size: 707k
Code Size: 1k
Category:
Mathimatics-Numerical algorithms
Development Platform:
MultiPlatform
- #include <LEDA/graph.h>
- #include <LEDA/window.h>
- #include <LEDA/rat_point1.h>
- #include <LEDA/rat_segment1.h>
- extern void sweep1(const list<rat_segment1>&, GRAPH<rat_point1,rat_segment1>&);
- main()
- {
- window W;
- W.set_node_width(3);
- int size = 5;
- int N = 100;
- panel P("sweep demo");
- P.int_item("grid size",size,1,40);
- P.int_item("# segments", N, 1,2000);
- P.button("continue");
- P.button("repeat");
- P.button("quit");
- bool repeat = false;
- for(;;)
- {
- if ( !repeat && P.open(0,0) == 1) repeat = true;;
- W.init(-0.25*size,1.25*size,-0.25*size);
- list<rat_segment1> seglist;
- GRAPH<rat_point1,rat_segment1> G;
- for (int i=0; i<N; i++)
- { int x1 = rand_int(0,size);
- int y1 = rand_int(0,size);
- int x2 = rand_int(0,size);
- int y2 = rand_int(0,size);
- seglist.append(rat_segment1(x1,y1,x2,y2));
- }
- rat_segment1 s;
- int c = 0;
- forall(s,seglist)
- { if (++c == 16) c = 1;
- W.draw_segment(s.xcoord1(),s.ycoord1(), s.xcoord2(),s.ycoord2(),color(c));
- }
- sweep1(seglist,G);
- cout << G.number_of_nodes() << endl;
- node v;
- forall_nodes(v,G)
- W.draw_filled_node(G[v].xcoord(),G[v].ycoord());
- }
- return 0;
- }