Biomechanical Joint Model
 Author: Anderson Maciel

RAPID.H

Go to the documentation of this file.
00001 
00002 /*************************************************************************\
00003 
00004   Copyright 1995 The University of North Carolina at Chapel Hill.
00005   All Rights Reserved.
00006 
00007   Permission to use, copy, modify and distribute this software and its
00008   documentation for educational, research and non-profit purposes, without
00009   fee, and without a written agreement is hereby granted, provided that the
00010   above copyright notice and the following three paragraphs appear in all
00011   copies.
00012 
00013   IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL BE
00014   LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR
00015   CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE
00016   USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY
00017   OF NORTH CAROLINA HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
00018   DAMAGES.
00019 
00020   THE UNIVERSITY OF NORTH CAROLINA SPECIFICALLY DISCLAIM ANY
00021   WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00022   MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE
00023   PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
00024   NORTH CAROLINA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
00025   UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
00026 
00027   The authors may be contacted via:
00028 
00029   US Mail:             S. Gottschalk
00030                        Department of Computer Science
00031                        Sitterson Hall, CB #3175
00032                        University of N. Carolina
00033                        Chapel Hill, NC 27599-3175
00034 
00035   Phone:               (919)962-1749
00036 
00037   EMail:              {gottscha}@cs.unc.edu
00038 
00039 
00040 \**************************************************************************/
00041 
00042 #ifndef RAPID_H
00043 #define RAPID_H
00044 
00045 /****************************************************************************/
00046 
00047 
00048 // RAPID API RETURN VALUES
00049 
00050 
00051 const int RAPID_OK = 0; 
00052   // Used by all API routines except constructors and destructors.
00053 
00054 
00055 const int RAPID_ERR_MODEL_OUT_OF_MEMORY = 1; 
00056   // Returned when an API function cannot obtain enough memory to store
00057   // or process a RAPID_model object.
00058 
00059 
00060 const int RAPID_ERR_COLLIDE_OUT_OF_MEMORY = 2;
00061   // Returned when RAPID_Collide() cannot allocate enough storage to hold
00062   // collision information.  In this case, there is as much collision
00063   // detection information available as could be allocated for.
00064 
00065 
00066 const int RAPID_ERR_UNPROCESSED_MODEL = 3;
00067   // Returned when an unprocessed model is passed to a function which
00068   // expects only processed models, such as RAPID_Collide().
00069 
00070 
00071 const int RAPID_ERR_BUILD_OUT_OF_SEQUENCE = 4;
00072   // Returned when: 
00073   //       1. AddTri() is called before BeginModel().  The triangle will 
00074   //          be added anyway as if BeginModel() had been previously called.
00075   //       2. BeginModel() is called immediately after AddTri().  The
00076   //          model will be placed into an empty initial state.  
00077   // This error code is something like a warning: the invoked
00078   // operation takes place anyway, but the returned error code may tip
00079   // off the client that something out of the ordinary is happenning.
00080 
00081 
00082 const int RAPID_ERR_BUILD_EMPTY_MODEL = 5; 
00083   // Returned when EndModel() is called on a model to which no
00084   // triangles have been added.  This is similar in spirit to the
00085   // OUT_OF_SEQUENCE return code, except that the requested operation
00086   // has FAILED -- the model remains "unprocessed".
00087 
00088 
00089 /****************************************************************************/
00090 
00091 
00092 class box;
00093 class tri;
00094 
00095 class RAPID_model
00096 {
00097 public:
00098 
00099   // Declarations the client doesn't need to see
00100   // note -- wherever the file "RAPID.H" gets copied, "RAPID_private.H"
00101   // should go with it.
00102 
00103 #include "RAPID_private.H"
00104 
00105 public:
00106 
00107   // These are everything the client needs to use RAPID.
00108 
00109   RAPID_model();
00110   ~RAPID_model();
00111   
00112   int BeginModel();
00113   int AddTri(const double *p1, const double *p2, const double *p3, int id);
00114   int EndModel();
00115   
00116 };
00117 
00118 /****************************************************************************/
00119 
00120 //                These are for the client
00121 
00122 // Find all pairwise intersecting triangles
00123 const int RAPID_ALL_CONTACTS = 1;
00124 
00125 // Just report one intersecting triangle pair, if there are any.
00126 const int RAPID_FIRST_CONTACT = 2;
00127                                  
00128 
00129 // This is the collision query invocation.  It assumes that the 
00130 // models are not being scaled up or down, but have their native
00131 // dimensions.
00132 int 
00133 RAPID_Collide(double R1[3][3], double T1[3], RAPID_model *o1,
00134               double R2[3][3], double T2[3], RAPID_model *o2,
00135               int flag = RAPID_ALL_CONTACTS);
00136 
00137 // This collision query permits the models to each be scaled by
00138 // some positive factor (must be greater than 0).
00139 int 
00140 RAPID_Collide(double R1[3][3], double T1[3], double s1, RAPID_model *o1,
00141               double R2[3][3], double T2[3], double s2, RAPID_model *o2,
00142               int flag = RAPID_ALL_CONTACTS);
00143 
00144 // this is for the client
00145 struct collision_pair
00146 {
00147   int id1;
00148   int id2;
00149 };
00150 
00151 /****************************************************************************/
00152 
00153 extern  int RAPID_num_box_tests;
00154 extern  int RAPID_num_tri_tests;
00155 extern  int RAPID_num_contacts;
00156 extern  struct collision_pair *RAPID_contact;
00157 
00158 #endif
00159 
00160 
00161 
00162 
00163 
00164 
00165 
00166 

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