#define SMALL 0.0000000001
-static pointf
+pointf
subPt (pointf a, pointf b)
{
pointf c;
return c;
}
-static pointf
+pointf
perp (pointf a)
{
pointf c;
return (a.x*b.x + a.y*b.y);
}
-static pointf
+pointf
scale (double c, pointf a)
{
pointf b;
extern pointf cwrotatepf(pointf p, int cwrot);
extern void rect2poly(pointf *p);
+extern pointf scale(double c, pointf v);
+extern pointf perp(pointf v);
+extern pointf subPt(pointf v, pointf w);
extern int seg_intersect (pointf a, pointf b, pointf c, pointf d, pointf* x);
#ifdef __cplusplus
return (dx * dx + dy * dy);
}
-void subPt(Point * a, Point b, Point c)
+void subpt(Point * a, Point b, Point c)
{
a->x = b.x - c.x;
a->y = b.y - c.y;
#ifndef GEOMETRY_H
#define GEOMETRY_H
+#ifdef HAVE_POINTF_S
+ typedef pointf Point;
+#else
typedef struct Point {
double x, y;
} Point;
+#endif
extern Point origin;
extern void geominit(void);
extern double dist_2(Point *, Point *); /* Distance squared between two points */
- extern void subPt(Point * a, Point b, Point c);
+ extern void subpt(Point * a, Point b, Point c);
extern void addPt(Point * a, Point b, Point c);
extern double area_2(Point a, Point b, Point c);
extern int leftOf(Point a, Point b, Point c);
a1 = (a + n - 1) % n;
b1 = (b + m - 1) % m;
- subPt(&A, P[a], P[a1]);
- subPt(&B, Q[b], Q[b1]);
+ subpt(&A, P[a], P[a1]);
+ subpt(&B, Q[b], Q[b1]);
cross = area_2(origin, A, B);
bHA = leftOf(P[a1], P[a], Q[b]);