Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/chris/src/collision.h @ 1998

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

orxonox/branches/chris: merged trunk into my branch, moved new files into new folder

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