Biomechanical Joint Model
 Author: Anderson Maciel

VInternal.H

Go to the documentation of this file.
00001 /************************************************************************\
00002 
00003   Copyright 1997 The University of North Carolina at Chapel Hill.
00004   All Rights Reserved.
00005 
00006   Permission to use, copy, modify and distribute this software
00007   and its documentation for educational, research and non-profit
00008   purposes, without fee, and without a written agreement is
00009   hereby granted, provided that the above copyright notice and
00010   the following three paragraphs appear in all copies.
00011 
00012   IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL
00013   HILL BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL,
00014   INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
00015   ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
00016   EVEN IF THE UNIVERSITY OF NORTH CAROLINA HAVE BEEN ADVISED OF
00017   THE POSSIBILITY OF SUCH DAMAGES.
00018 
00019 
00020   Permission to use, copy, modify and distribute this software
00021   and its documentation for educational, research and non-profit
00022   purposes, without fee, and without a written agreement is
00023   hereby granted, provided that the above copyright notice and
00024   the following three paragraphs appear in all copies.
00025 
00026   THE UNIVERSITY OF NORTH CAROLINA SPECIFICALLY DISCLAIM ANY
00027   WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00028   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00029   PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS"
00030   BASIS, AND THE UNIVERSITY OF NORTH CAROLINA HAS NO OBLIGATION
00031   TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
00032   MODIFICATIONS.
00033 
00034 
00035    --------------------------------- 
00036   |Please send all BUG REPORTS to:  |
00037   |                                 |
00038   |   geom@cs.unc.edu               |
00039   |                                 |
00040    ---------------------------------
00041   
00042      
00043   The authors may be contacted via:
00044 
00045   US Mail:  A. Pattekar/J. Cohen/T. Hudson/S. Gottschalk/M. Lin/D. Manocha
00046             Department of Computer Science
00047             Sitterson Hall, CB #3175
00048             University of N. Carolina
00049             Chapel Hill, NC 27599-3175
00050             
00051   Phone:    (919)962-1749
00052             
00053   EMail:    geom@cs.unc.edu
00054 
00055 \************************************************************************/
00056 
00057 /************************************************************************\
00058 Filename: VInternal.H
00059 --
00060 Description: This file declares three classes - VCReportType,
00061              VCObject and VCInternal.
00062              VCReportType is a simple class through which
00063              collisions are reported.
00064              VCObject holds all the necessary information
00065              about an object.
00066              VCInternal contains the implementation of VCollide.
00067 
00068 \************************************************************************/
00069 
00070 
00071 #ifndef VINTERNAL_H
00072 #define VINTERNAL_H
00073 
00074 #include "RAPID.H"
00075 #include "NBody.H"
00076 
00077 //state in which VCollide is:
00078 const int VCstate_default   = 0; //default state
00079 const int VCstate_newObject = 1; //a new object has been created but its
00080                                  //geometry is yet to be inputted.
00081 const int VCstate_addTri    = 2; //the geometry is being inputted.
00082 
00083 
00084 class VCReportType;
00085        //multiply defined in VInternal.C, VCollide.H and VCollide.h
00086        //this was done so that the implementation can be hidden from the
00087        //user.
00088 
00089 /************************************************************************
00090 Class: VCObject
00091 --
00092 Description: Each instance of this class keeps all the necessary 
00093              information about an object.
00094 
00095 \************************************************************************/
00096 
00097 class VCObject
00098 {
00099   friend class VCInternal;
00100   
00101 private:
00102   
00103   int         id;          //the id of the object.
00104   RAPID_model *b;          //RAPID box for the object. This also stores
00105                            //the geometry of the object.
00106   
00107   double      trans[4][4]; //the current transformation matrix for the object.
00108   int         activation_state; //1=>object is activated, 0=>deactivated.
00109 };
00110 
00111 
00112 /************************************************************************
00113 Class: VCInternal
00114 --
00115 Description: Each instance of this class maintains information about a
00116              set of objects and activation/deactivation states between
00117              them. Collision detection can be performed only on
00118              objects that belong to the same instance of the this
00119              class. It uses the NBody class as its back-end.
00120 
00121 \************************************************************************/
00122 
00123 class VCInternal
00124 {
00125   int      state;       //the state in which VCollide is.
00126   int      next_id;     //next free id, since ids are generated by the program.
00127   int      current_id;  //the id of the object being worked on by "AddTri"
00128                         //or "EndObject".
00129   NBody    nbody;       //an instance of the NBody class.
00130   PairData report_data; //for reporting the collisions.
00131   PairData disabled;    //set of disabled pairs.
00132   int      size;        //size of the "vcobjects" array.
00133   VCObject **vc_objects;//array of pointers to VCObjects.
00134   
00135 public:
00136   VCInternal();
00137   ~VCInternal();
00138 
00139   int NewObject(int *id); //create a new object in the database.
00140   int AddTri(double v1[], double v2[], double v3[]); //insert the
00141                                                       //geometry .
00142   int EndObject(void);    //tell VCollide that inserting the 
00143                           //geometry is complete.
00144   int UpdateTrans(int id, double trans[][4]);
00145                           //update the transformation matrix of
00146                           //the object.
00147   int ActivateObject(int id);       //activate for collision detection.
00148   int DeactivateObject(int id);     //deactivate from collision detection.
00149   int ActivatePair(int id1, int id2);  //activate the pair.
00150   int DeactivatePair(int id1, int id2);//deactivate the pair.
00151 
00152   int DeleteObject(int id);  //delete the object from the database.
00153 
00154   int Collide(void);  //perform collision detection.
00155 
00156   int Report(int size, VCReportType *vcrep);
00157                       //report the results of collision detection.
00158 
00159 };
00160 
00161 
00162 #endif

Generated on Thu Dec 1 10:13:41 2005 for COME - Biomechanical Joint Model by  doxygen 1.4.5