Blob Blame Raw

#include "private.h"

int heliCheckCollision(HeliCollider *a, HeliCollider *b, double *normX, double *normY) {
	// corner with side
	// corner with circle
	// circle with circle
	#warning "TODO: heliCheckCollision: not implemented yet"
	return FALSE;
}

int heliPointCollision(HeliCollider *c, double x, double y) {
	x -= c->x;
	y -= c->y;
	if (c->type == COLLIDER_CIRCLE) {
		return x*x + y*y <= c->radius*c->radius;
	} else
	if (c->type == COLLIDER_RECTANGLE) {
		double a = c->rotation*(PI/180);
		double sn = sin(a);
		double cn = cos(a);
		return fabs(x*cn - y*sn) <= c->width*0.5
			&& fabs(x*sn + y*cn) <= c->height*0.5;
	}
	return FALSE;
}