graphics change
[Lilanci.git] / geometry.h
blobc8fd3d27d1d7043ef4f4707458e6aaba23269ec9
1 #ifndef GEOMETRY_H_G
2 #define GEOMETRY_H_G
4 typedef struct {
5 double x,y;
6 } Vect;
8 typedef struct {
9 Vect *v; //vertexs
10 Vect *n; //normal's for loines between v[i] and v[i+1]
11 double *a; //dot products
12 int novec;
13 int alloc;
14 } Poly;
16 double DotProduct(Vect *a, Vect *b);
18 int InPoly(Poly *p, Vect *v);
19 Poly *NewPoly();
20 int AddToPoly(Poly *p,Vect *v);
21 int AddToPolyXY(Poly *p, double x, double y);
22 void FreePoly(Poly *p);
23 Poly *NewRect(double x, double y, double xx, double yy);
24 int PolyInPoly(Poly *p1, Poly *p2); //does they intersect?
25 int PolyInPolyComp(Poly *p1, Poly *p2); // is one completely inside another? 0 no 1 first in second 2 second in first
26 Poly *TranslatePolyXY(Poly *p, double x, double y); //returns translated copy of Poly
27 Poly *TranslatePoly(Poly *p, Vect *v); //returns translated copy of Poly
28 void MultiplyPoly(Poly *p, double xm, double ym);
29 void PrintPoly(Poly *p);
30 void PrintVect(Vect *a);
31 char *Poly2String(Poly *p);
32 void FreePoly2String(char *s);
33 Poly *String2Poly(char *s);
35 typedef struct{
36 int nopol;
37 Poly **p;
38 } Area;
40 Area *NewArea();
41 void FreeArea(Area *a);
42 int AddToArea(Area *a, Poly *p);
43 int InArea(Area *a, Vect *v);
44 int AreaInArea(Area *a1, Area *a2); //does they intersect?
45 int AreaInAreaComp(Area *a1, Area *a2); // is one completely inside another? 0 no 1 first in second 2 second in first
46 Area *TranslateAreaXY(Area *a, double x, double y); //returns translated copy of Area
47 Area *TranslateArea(Area *a, Vect *v); //returns translated copy of Area
48 void MultiplyArea(Area *p, double xm, double ym);
49 void PrintArea(Area *a);
50 char *Area2String(Area *a);
51 void FreeArea2String(char *s);
52 Area *String2Area(char *s);
53 #endif //GEOMETRY_H_G