zoom.c
资源名称:leda.tar.gz [点击查看]
上传用户:gzelex
上传日期:2007-01-07
资源大小:707k
文件大小:1k
源码类别:
数值算法/人工智能
开发平台:
MultiPlatform
- #include <LEDA/plane.h>
- #include <LEDA/window.h>
- #include <math.h>
- main()
- {
- window W;
- W.init(-100000000, 100000000, -100000000);
- int n = W.read_int("n = ");
- list<segment> L;
- point c(0,0);
- segment s;
- double r = 1000000000;
- double alpha = 0;
- double d = 2*LEDA_PI/n;
- for(int i = 0; i<n; i++)
- { point p(rand_int(-10,+10),rand_int(-10,+10));
- s = segment(p,c.translate(alpha,r));
- L.append(s);
- alpha += d;
- }
- forall(s,L) W << s;
- point p,q;
- for(;;)
- { if (W.read_mouse(p)==3) break;
- W.read_mouse_rect(p,q);
- W.init(p.xcoord(),q.xcoord(),p.ycoord());
- forall(s,L) W << s;
- }
- return 0;
- }