2014-01-31 08:23:00 +13:00
|
|
|
|
|
|
|
|
#ifndef COLLISION_H
|
|
|
|
|
#define COLLISION_H
|
|
|
|
|
|
2019-01-18 15:55:06 +01:00
|
|
|
#include "geom.hpp"
|
2014-01-31 08:23:00 +13:00
|
|
|
|
2016-05-04 09:58:44 +02:00
|
|
|
extern const float COLLISION_FLT_EPSILON;
|
2014-01-31 08:23:00 +13:00
|
|
|
|
|
|
|
|
struct Collision{
|
|
|
|
|
float time;
|
|
|
|
|
Vector normal;
|
|
|
|
|
void *surface;
|
|
|
|
|
unsigned short index;
|
|
|
|
|
|
|
|
|
|
Collision():time(1),surface(0),index(~0){}
|
|
|
|
|
|
|
|
|
|
bool update( const Line &line,float time,const Vector &normal );
|
|
|
|
|
|
|
|
|
|
bool sphereCollide( const Line &src_line,float src_radius,const Vector &dest,float dest_radius );
|
|
|
|
|
bool sphereCollide( const Line &line,float radius,const Vector &dest,const Vector &radii );
|
|
|
|
|
|
|
|
|
|
bool triangleCollide( const Line &src_line,float src_radius,const Vector &v0,const Vector &v1,const Vector &v2 );
|
|
|
|
|
|
|
|
|
|
bool boxCollide( const Line &src_line,float src_radius,const Box &box );
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif
|