Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/chris/core/collision.h @ 1966

Last change on this file since 1966 was 1966, checked in by chris, 20 years ago

orxonox/branches/chris: Basic sphere-sphere collision code implemented, still lacks traceing (line-sphere collision)

File size: 1.2 KB
Line 
1
2#ifndef COLLISION_H
3#define COLLISION_H
4
5#include "stdincl.h"
6
7typedef struct CC_Tree
8{
9  unsigned long n;
10  union
11  {
12  struct CC_Tree** b;
13  unsigned long ID;
14  } data;
15  float r;
16  Vector m;
17} CC_Tree;
18
19class CollisionCluster {
20 
21  CC_Tree* root;
22 
23 
24 public:
25  CollisionCluster (float r, Vector m); // simple cluster
26  CollisionCluster (char* filename); // get cluster from file
27  ~CollisionCluster ();
28 
29  int store (char* filename);
30 
31  friend bool cctree_iterate(const Placement* pa, CC_Tree* ta, unsigned long* ahitflags, const Placement* pb, CC_Tree* tb, unsigned long* bhitflags);
32  friend bool check_trace (const Placement* pa, const CollisionCluster* a, unsigned long* ahitflags, const Line& trace, Vector* impactpoint);
33  friend bool check_collision (const Placement* pa, const CollisionCluster* a, unsigned long* ahitflags, const Placement* pb, const CollisionCluster* b, unsigned long* bhitflags);
34};
35
36bool sphere_sphere_collision( Vector m1, float r1, Vector m2, float r2);
37bool trace_sphere_collision( Vector m, float r, Line& l, Vector* impactpoint);
38
39void setflag( unsigned long* flags, unsigned long ID);
40
41void free_CC_Tree( CC_Tree* tree);
42CC_Tree* load_CC_Tree (FILE* stream);
43int save_CC_Tree (CC_Tree* tree, FILE* stream);
44
45#endif
Note: See TracBrowser for help on using the repository browser.