Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1981 in orxonox.OLD for orxonox/branches/chris/core/collision.cc


Ignore:
Timestamp:
Jun 18, 2004, 2:43:46 PM (21 years ago)
Author:
chris
Message:

orxonox/branches/chris: added doxygen-optimized comments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/chris/core/collision.cc

    r1975 r1981  
    2222using namespace std;
    2323
     24/**
     25   \brief simple CollisionCluster constructor
     26   \param rad: the radius of the base sphere
     27   \param mid: the middle point of the sphere
     28*/
    2429CollisionCluster::CollisionCluster (float rad = 1.0, Vector mid = Vector(0,0,0))
    2530{
     
    3136}
    3237
     38/**
     39   \brief loads a CollisionCluster from a data file
     40   \param filename: self-explanatory
     41*/
    3342CollisionCluster::CollisionCluster (char* filename)
    3443{
     
    5867}
    5968
     69/**
     70   \brief Simple destructor that cleans up all the mess
     71*/
    6072CollisionCluster::~CollisionCluster ()
    6173{
     
    6375}
    6476
     77/**
     78   \brief stores the CollisionCluster into a file
     79   \param filename: self-explanatory
     80   \return zero on success, -1 on error
     81*/
    6582int CollisionCluster::store (char* filename)
    6683{
     
    7491}
    7592
     93/**
     94   \brief performs a collision check between a CollisionCluster and a Line
     95   \param pa: pointer to the Placement of the CollisionCluster
     96   \param a: pointer to the CollisionCluster
     97   \param ahitflags: pointer to an unsigned long to store hitlocation data
     98   \param trace: pointer to the Line
     99   \param impactpoint: pointer to a Vector where the point of intersection is stored in
     100   \return true on collision, false otherwise. If true is returned, the flag in ahitflags that symbolises the hit subsphere is set, and impactpoint is set to the Location where the intersection occured
     101*/
    76102bool check_trace (const Placement* pa, const CollisionCluster* a, unsigned long* ahitflags, const Line* trace, Vector* impactpoint)
    77103{
     
    82108}
    83109
     110/**
     111   \brief performs a collision check between two CollisionClusters
     112   \param pa: pointer to the Placement of the first CollisionCluster
     113   \param a: pointer to the first CollisionCluster
     114   \param ahitflags: pointer to an unsigned long to store hitlocation data on the first CollisionCluster
     115   \param pb: pointer to the Placement of the second CollisionCluster
     116   \param b: pointer to the second CollisionCluster
     117   \param bhitflags: pointer to an unsigned long to store hitlocation data on the second CollisionCluster
     118   \return true on collision, false otherwise
     119   If true is returned, all flags in ahitflags and bhitflags that symbolize intersecting subspheres in the respective CollisionCluster are set
     120*/
    84121bool check_collision (const Placement* pa, const CollisionCluster* a, unsigned long* ahitflags, const Placement* pb, const CollisionCluster* b, unsigned long* bhitflags)
    85122{
     
    91128}
    92129
     130/**
     131   \brief performs an intersection check between two spheres
     132   \param m1: center point of first sphere
     133   \param r1: radius of first sphere
     134   \param m2: center point of second sphere
     135   \param r2: radius of second sphere
     136   \return true on intersection, false otherwise
     137*/
    93138bool sphere_sphere_collision( Vector m1, float r1, Vector m2, float r2)
    94139{
     
    97142}
    98143
     144/**
     145   \brief performs an intersection check between a Line and a sphere
     146   \param m: center point of the sphere
     147   \param r: radius of the sphere
     148   \param l: pointer to the Line
     149   \param impactpoint: pointer to a buffer to store the point of intersection
     150   \return true on intersection, false otherwise. If true is returned, impactpoint is set to the loaction where the intersection occured
     151*/
    99152bool trace_sphere_collision( Vector m, float r, const Line* l, Vector* impactpoint)
    100153{
     
    124177}
    125178
     179/**
     180   \brief recursive implementation for collision detection within a CC_Tree
     181*/
    126182bool cctree_iterate(const Placement* pa, CC_Tree* ta, unsigned long* ahitflags, const Placement* pb, CC_Tree* tb, unsigned long* bhitflags)
    127183{
     
    163219}
    164220
     221/**
     222   \brief sets the <ID>th flag in flags
     223   \param flags: pointer to the long used for flagging
     224   \param ID: number of the flag to be set
     225*/
    165226void setflag( unsigned long* flags, unsigned long ID)
    166227{
     
    175236}
    176237
     238/**
     239   \brief frees the memory allocated in a CC_Tree
     240*/
    177241void free_CC_Tree( CC_Tree* tree)
    178242{
     
    185249}
    186250
     251/**
     252   \brief loads a CC_Tree from a stream
     253*/
    187254CC_Tree* load_CC_Tree (FILE* stream)
    188255{
     
    233300}
    234301
     302/**
     303   \brief saves a CC_Tree to a stream
     304*/
    235305int save_CC_Tree (CC_Tree* tree, FILE* stream)
    236306{
     
    263333}
    264334
     335/**
     336   \brief recursive implementation for traceing detection within a CC_Tree
     337*/
    265338bool cctree_trace( const Placement* p, CC_Tree* t, unsigned long* hitflags, const Line* trace, Vector* impactpoint)
    266339{
Note: See TracChangeset for help on using the changeset viewer.