libmove3d  3.13.0
/home/slemaign/softs-local/BioMove3D-git/include/p3d.h
00001 
00002 /***************************************/
00003 /* structure de polyhedre utilisee     */
00004 /***************************************/     
00005 
00006 #ifndef _P3D_H
00007 #define _P3D_H
00008 
00009 /*
00010   #include "p3d_sys.h"
00011   #include "p3d_type.h"
00012   #include "p3d_matrix.h"
00013   #include "p3d_poly.h"
00014 */
00015  #include "polyhedre.h"
00016 /* the entity shapes: 0=polyh, 1=sphere, 2=cube, 3=box, 4=cylinder, 5=cone */
00017 #define POLYHEDRON_ENTITY 0
00018 #define CONVEX_POLYHEDRON 1
00019 #define CONCAVE_POLYHEDRON 2
00020 #define SPHERE_ENTITY 3
00021 #define CUBE_ENTITY 4
00022 #define BOX_ENTITY 5
00023 #define CYLINDER_ENTITY 6
00024 #define CONE_ENTITY 7
00025 
00026 #include <../collision/PQP/include/PQP.h>
00027 
00028 typedef double * configPt;
00029 
00030 typedef struct {
00031   configPt q;
00032   char * name;
00033   int * ikSol;
00034 } config_name, * config_namePt;
00035 
00036 /* Point 3D */
00037 typedef struct p3d_point {
00038   double x, y, z;
00039 } p3d_point;
00040 
00041 /* Boite 3D (utile pour les graphiques, la marge de manoeuvre des robots...) */
00042 typedef struct box {
00043   double x1,x2,y1,y2,z1,z2;
00044 } p3d_box, *pp3d_box;
00045 
00046 
00047 /*---------------------------------------------------------------------------
00048  * BB structures.
00049  */
00050 
00055 typedef struct elem_list_BB {
00061   struct obj * obj1;
00066   struct obj * obj2;
00068   struct elem_list_BB * next;
00069 } p3d_elem_list_BB;
00070 
00071 
00079 typedef struct BB_handle {
00083   int env_id;
00087   int nb_robot;
00089   p3d_elem_list_BB ** lists_links_env;
00091   p3d_elem_list_BB ** lists_links_rob;
00093   p3d_elem_list_BB ** lists_links_autocol;
00094 } p3d_BB_handle;
00095 
00096 typedef struct BB {  
00097     double xmin,ymin,zmin;  
00098     double xmax,ymax,zmax;  
00099   } p3d_BB, *pp3d_BB; 
00100 
00101 typedef struct p3d_primitive { 
00102   double radius;  /* sphere, cylinder, cone */
00103   double other_radius;  /* cone */ /* Carl 10 oct. 2000 */
00104   double height;  /* cylinder, cone */
00105   double sin_slope; /* sinus of slope of cone, angle at "top" between symmetry axis and side */
00106   double x_length; /* cube, box */
00107   double y_length; /* cube, box */
00108   double z_length; /* cube, box */
00109 }p3d_primitive;
00110 
00111 
00112 /* Modif Bio */
00113 #ifdef BIO
00114 typedef struct s_autocol {
00115   int size;
00116   struct p3d_poly **list; /*list of atoms with forbidden interaction. All must belong to rigids of higher index than the following field, nrigid */
00117   int nrigid; /* index of the rigid to which the atom owner of this structure belongs */
00118 } autocol_struct;
00119 
00120 
00121 enum atom_type {SULPHUR, SULPHUR_H, OXYGEN, OXYGEN_H, NITROGEN, NITROGEN_H, NITROGEN_FULL, CARBON, HYDROGEN,BROMINE, IODINE, FLUORINE, PHOSPHORUS, CHLORINE}; 
00122 #endif
00123 
00124 
00125 
00128 typedef enum {
00129   POLY_DEFAULT_DISPLAY, 
00130   POLY_NO_DISPLAY, 
00131   POLY_UNLIT_BLACK_DISPLAY, 
00132   POLY_UNLIT_RED_DISPLAY, 
00133   POLY_RED_DISPLAY, 
00134   POLY_UNLIT_GREEN_DISPLAY, 
00135   POLY_GREEN_DISPLAY, 
00136   POLY_UNLIT_BLUE_DISPLAY, 
00137   POLY_BLUE_DISPLAY, 
00138   POLY_CUSTOM_COLOR_DISPLAY, 
00139   POLY_UNLIT_CUSTOM_COLOR_DISPLAY 
00140 } poly_display_mode;
00141 
00142 #define P3D_NB_OPENGL_CONTEXT 20
00143 
00144 /* Structure de polyhedre permettant d'utiliser I_COLLIDE */
00145 typedef struct p3d_poly
00146 {
00147   struct obj *p3d_objPt; // pointer to the object (modif Juan)
00148   int entity_type;      /* the shape : 0,1,2=polyh, 3=sphere, 4=cube, 5=box, 6=cylinder, 7=cone */
00149   p3d_primitive *primitive_data; /* the data in case entity_type != polyhedron */
00150   poly_polyhedre *poly;  /*tsiano inclusion structure propre */
00151   void *end_user_data;
00152   int id;        /* numero d'identification */
00153   int geo_id;   /* identifier of poly from which this one was copied, or in case 
00154                    of direct construction the same as the one in field  id  */ /* UI 19042001 */
00155   int is_used_in_object_flag;  /* TRUE if poly is used in an object, FALSE otherwise */
00156   int p_in_o_id;  /* identifier of poly in the object, independent of instance of the object */   /* UI 30042001 */
00157   p3d_box box; /* boite pour les positions */
00158   p3d_matrix4 pos0 ; /* position initiale */
00160   p3d_matrix4 pos_rel_jnt ;
00161   int TYPE ; /* P3D_REAL : detecte et dessine ; P3D_GRAPHIC : dessine mais pas detecte ; P3D_GHOST : detecte mais pas dessine */
00162   int forceBBComputation;
00163   int color ; 
00164   double *color_vect;
00165 
00166   // OpenGL Contexts
00167   int nb_context;
00168   int list[P3D_NB_OPENGL_CONTEXT];       /* liste opengl du polyhedre */
00169   int listfil[P3D_NB_OPENGL_CONTEXT];    /* liste opengl du polyhedre filaire*/
00170   int listgour[P3D_NB_OPENGL_CONTEXT];   /* liste opengl du polyedre gouraud ? */
00171   int MODIF ;
00172 
00173   poly_display_mode display_mode; 
00174   double custom_color[4];  
00177   /* Modif BIO */
00178 #ifdef BIO
00179   enum atom_type type;
00180   autocol_struct *autocol_data;
00181 #ifdef HYDROGEN_BOND
00182   double *r;      /* collision radius pointer*/
00183 #else
00184   double r;       /* collision radius */
00185 #endif
00186   /* vector of collision radii for hydrogen bridges and the like mod */
00187   double *radii; 
00188   double pos[3]; /* atom position */
00189   double (*matpos)[4]; /* transformation matrix of the atom */
00190 #endif
00191  } p3d_poly;
00192 
00194 typedef enum p3d_robot_part
00195 {
00196   P3D_NOT_A_PART,
00197   P3D_HAND_PART,
00198   P3D_RIGHT_HAND_PART,
00199   P3D_LEFT_HAND_PART,
00200   P3D_ARM_PART,
00201   P3D_RIGHT_ARM_PART,
00202   P3D_LEFT_ARM_PART,
00203   P3D_BASE_PART,
00204   P3D_FINGER_PART,
00205   P3D_FINGERTIP_PART
00206 } p3d_robot_part;
00207 
00210 typedef enum {
00211   P3D_OBJ_DEFAULT_DISPLAY, 
00212   P3D_OBJ_NO_DISPLAY, 
00213   P3D_OBJ_UNLIT_BLACK_DISPLAY, 
00214   P3D_OBJ_UNLIT_RED_DISPLAY, 
00215   P3D_OBJ_RED_DISPLAY, 
00216   P3D_OBJ_UNLIT_GREEN_DISPLAY, 
00217   P3D_OBJ_GREEN_DISPLAY, 
00218   P3D_OBJ_UNLIT_BLUE_DISPLAY, 
00219   P3D_OBJ_BLUE_DISPLAY, 
00220   P3D_OBJ_CUSTOM_COLOR_DISPLAY,  
00221   P3D_OBJ_UNLIT_CUSTOM_COLOR_DISPLAY,  
00222 } p3d_obj_display_mode;
00223 
00224 /* Structure d'objet (obstacle ou corps d'un robot) */
00225 typedef struct obj {
00226   char       *name;
00227   int         num;  /* non-unique identifier: starts at 0 for static objects '
00228                        as well as for each robot */
00229   int         o_id; /* unique identifier for static objects, bodies and mov objs. */
00230   int  o_id_in_env; /* unique identifier for static objects, bodies and mov objs. in this environment (used in p3d_kcd.c to make the link) */
00231   int         geo_id;   /* identifier of object from which this one was copied, or in case 
00232                    of direct construction the same as the one in field  id  */ /* UI 20042001 */
00233   int  GRAPHIC_TYPE; /* P3D_DEACTIVATED_OBSTACLE, P3D_ACTIVATED_OBSTACLE, 
00234                         P3D_ADDABLE_OBSTACLE ou P3D_ADDED_OBSTACLE , 
00235                         ou encore P3D_REAL_OBJECT, P3D_GRAPHIC_OBJECT, P3D_GHOST_OBJECT */
00236   void *end_user_data;
00237   int is_used_in_device_flag;  /* TRUE if object is used in a device, FALSE otherwise */
00238   int is_used_in_env_flag;  /* TRUE if object is used in an environment (as obstacle or as body), FALSE otherwise */
00239   int         type;
00240   p3d_matrix4  opos; /* for a body: position of the local frame (just information) */
00241   p3d_matrix4  BodyWrtPilotingJoint; /* for a body: placement matrix expressing
00242                                         the pos/orie of a body w.r.t. the frame of its piloting joint. */
00243   struct env *env;
00244   int np;             /* nombre de polyhedres dans l'objet */
00245   p3d_poly **pol, *polcur;
00246   p3d_box box;
00247   struct jnt *jnt;  /* joint that pilots this object */
00248   p3d_BB      BB;     /* boite englobante */
00249   p3d_BB      BB0;
00250   int concat; //if the object is concat flag to don't draw it
00251   int contact_surface; 
00254   PQP_Model *pqpModel; 
00255   struct obj *pqpPreviousBody; 
00256   unsigned int pqpID; 
00257   p3d_matrix4 pqpPose; 
00258   struct obj *pqpUnconcatObj; 
00263   p3d_obj_display_mode display_mode;  
00265 // TODO: Because of the removal of hri_planner from BioMove3D (to libhri), this flag is problematic:
00266 // - libmove3d p3d_rob struct is compiled without this part
00267 // - libhri/move3d-studio use this part, resulting in structs that have different sizes.
00268 //#ifdef HRI_PLANNER_GUI
00269 //
00270   int caption_selected; 
00271   int show_pos_area;     /* boolean show/hide disc of position area */
00272   double max_pos_range;  /* Max Range distance for the position area */
00273   double min_pos_range;  /* Min Range distance for the position area */
00274   int trans;  /* TRUE if the object is transparent  */  
00275 //#endif
00276 
00277 #ifdef DPG
00278   unsigned int nbPointCloud;
00279   p3d_vector3* pointCloud;
00280 #endif
00281   enum p3d_robot_part robot_part; 
00282   double distance_weight; 
00283   bool isDeformable; 
00284 } p3d_obj, *pp3d_obj;
00285 
00286 
00287 /* structure de pre-jacobienne */
00288 typedef struct prejac {
00289   int numder;                 
00290   double alpha;               
00291   p3d_matrix4 J;              
00292   struct prejac *prev_prejac; 
00293 } p3d_prejac;
00294 
00295 
00296 /************************************************************/
00297 
00298 extern double p3d_version;
00299 
00300 //start path deform
00301 typedef struct config_on_edge{ 
00302 /*To test the visibility 
00303   of an edge from a given configuration*/
00304   configPt q;
00305   double p;  /*param along the edge*/
00306 } p3d_config_on_edge;
00307 //end path deform
00308 
00309 #endif
00310 
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines