weapons tweaking
[Lilanci.git] / kolize.c
blob07b9caf3777d1575c0097939d8bd1af9383fd78f
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include "geometry.h"
4 #include "util.h"
6 //This is only sort of testing source for various parts of this sw
10 int main(int argc, char **argv){
11 Poly *p, *q, *r;
12 char *s;
13 int i;
14 Vect v;
15 Area *a;
17 p=q=r=0;
19 p = NewPoly();
20 AddToPolyXY(p, 9,7);
21 AddToPolyXY(p, 11,9);
22 AddToPolyXY(p, 9,11);
23 AddToPolyXY(p, 7,9);
24 s = Poly2String(p);
25 printf("%s\n", s);
26 s = Poly2String(p);
27 printf("%s\n", s);
28 q = String2Poly(s);
29 s = Poly2String(q);
30 printf("%s\n", s);
31 FreePoly2String(s);
32 a = NewArea();
33 AddToArea(a,q);
34 AddToArea(a,TranslatePolyXY(p,1,1));
35 printf("%s\n", s=Area2String(a));
36 a = String2Area(s);
37 printf("%s\n", s=Area2String(a));
38 return 0;
39 for(i=0; i>10000; i++){
40 v.x=RandD(6.0,12.0);
41 v.y=RandD(6.0,12.0);
42 if(InPoly(p,&v))
43 printf("%lf\t%lf\n", v.x, v.y);
45 /*PrintPoly(p);
47 for(i=0; i<10; i++){
48 v.x=RandD(0.0,3.0);
49 v.y=RandD(0.0,3.0);
50 printf("%c [%lf, %lf]\n",InPoly(p,&v)?'+':'-', v.x, v.y);
53 q=NewRect(1.0,1.0,2.0,2.0);
54 v.x=-11.2;
55 v.y=4.2;
56 r=TranslatePoly(q,&v);
57 PrintPoly(r);
58 printf("%c\n", PolyInPoly(p,r)?'+':'-');
59 for(i=0;i<10000;i++)
60 PolyInPoly(p,q);
62 FreePoly(p);
63 FreePoly(q);
64 FreePoly(r);
66 return 0;