2008-04-24 11:07:47 -07:00
|
|
|
#ifndef GEOM_H_
|
|
|
|
#define GEOM_H_
|
|
|
|
|
|
|
|
// TODO: Make this cross platform (MSVC)
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
/*
|
|
|
|
* A point
|
|
|
|
*/
|
|
|
|
typedef struct _point point;
|
|
|
|
|
|
|
|
struct _point
|
|
|
|
{
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* A rectangle
|
|
|
|
*/
|
|
|
|
typedef struct _rect rect;
|
|
|
|
|
|
|
|
struct _rect
|
|
|
|
{
|
|
|
|
point topLeft;
|
|
|
|
point bottomRight;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Method signatures
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks to see if the point p is inside of the rectangle r.
|
|
|
|
*
|
2008-04-27 08:14:42 -07:00
|
|
|
* @param p
|
|
|
|
* @param r
|
|
|
|
* @return If the point is in the rectangle.
|
2008-04-24 11:07:47 -07:00
|
|
|
*/
|
|
|
|
bool pointInRect(point p, rect r);
|
|
|
|
|
2008-04-27 08:14:42 -07:00
|
|
|
/**
|
|
|
|
* Adds point p to point q.
|
|
|
|
*
|
|
|
|
* @param p
|
|
|
|
* @param q
|
|
|
|
* @return p + q.
|
|
|
|
*/
|
|
|
|
point pointAdd(point p, point q);
|
|
|
|
|
2008-04-24 11:07:47 -07:00
|
|
|
|
|
|
|
#endif /*GEOM_H_*/
|
2008-04-26 06:22:48 -07:00
|
|
|
|