Institut de Robòtica i Informàtica Industrial
KRD Group

The CuikSuite Project

world.h

Go to the documentation of this file.
00001 #ifndef WORLDH
00002 #define WORLDH
00003 
00004 #include "vector.h"
00005 #include "mechanism.h"
00006 #include "cuiksystem.h"
00007 #include "equations.h"
00008 #include "plot3d.h"
00009 #include "box.h"
00010 #include "csmapping.h"
00011 #include "parameters.h"
00012 #include "filename.h"
00013 
00014 #include <stdlib.h>
00015 
00026 /************************************************************************************/
00031 #define INITIAL_FRAME_DELAY 5.0
00032 
00037 #define FRAME_RATE (1.0/10) 
00038 
00045 #define FINAL_FRAME_DELAY 500.0
00046 /************************************************************************************/
00047 /************************************************************************************/
00052 #define EMPTY_WORLD 0
00053 
00058 #define WORLD_WITH_GEOMETRY 1
00059 
00064 #define WORLD_WITH_EQUATIONS 2
00065 /************************************************************************************/
00066 
00074 typedef struct {
00075   unsigned int stage; 
00079   Tmechanism m;   
00081   unsigned int nl; 
00082   unsigned int nb; 
00083   unsigned int nj; 
00084   double maxCoord; 
00087   TCuikSystem kinCS; 
00089   boolean *systemVars; 
00099   Tequation **refEqs; 
00103 } Tworld;
00104 
00105 
00113 void InitWorld(Tworld *w);
00114 
00128 void InitWorldFromFile(Tparameters *p,Tfilename *f,Tworld *w);
00129 
00140 unsigned int AddLink2World(Tlink *l,Tworld *w);
00141 
00142 
00153 unsigned int AddJoint2World(Tjoint *j,Tworld *w);
00154 
00166 unsigned int GetWorldDOF(Tworld *w);
00167 
00179 unsigned int GetWorldLinkID(char *linkName,Tworld *w);
00180 
00192 Tlink *GetWorldLink(unsigned int linkID,Tworld *w);
00193 
00203 unsigned int GetWorldNLinks(Tworld *w);
00204 
00214 unsigned int GetWorldNJoints(Tworld *w);
00215 
00228 unsigned int GetWorldNConvexBodiesInLinks(Tworld *w);
00229 
00240 unsigned int GetWorldSystemVars(boolean **sv,Tworld *w);
00241 
00256 void GenerateWorldEquationSystems(Tparameters *p,Tworld *w);
00257 
00269 void GetGlobalInitialBox(Tbox *b,Tworld *w);
00270 
00286 unsigned int MaxKinematicReduction(Tparameters *p,Tbox *b,
00287                                    double *reduction,Tworld *w);
00288 
00300 unsigned int SplitGlobalBox(Tparameters *p,Tbox *box,Tbox **b1,Tbox **b2,Tworld *w);
00301 
00315 void PlotWorld(Tplot3d *pt,double axesLength,Tworld *w);
00316 
00335 void MoveWorld(Tplot3d *pt,Tbox *b,Tworld *w);
00336 
00359 void AnimateWorld(char *pname,double axesLength,double frameDelay,Tlist *p,Tworld *w);
00360 
00371 void PrintWorldCS(Tparameters *p,Tfilename *fname,Tworld *w);
00372 
00380 void DeleteWorld(Tworld *w);
00381 
00382 #endif