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

The CuikSuite Project

cpolyhedron.h

Go to the documentation of this file.
00001 #ifndef CPOLYHEDRONH
00002 #define CPOLYHEDRONH
00003 
00004 #include "plot3d.h"
00005 #include "htransform.h"
00006 #include "color.h"
00007 
00008 #include <stdlib.h>
00009 
00019 /************************************************************************************/
00027 #define NORMAL_SHAPE 0
00028 
00036 #define HIDDEN_SHAPE 1
00037 
00045 #define DECOR_SHAPE  2
00046 /************************************************************************************/
00047 /************************************************************************************/
00057 #define OFF      0
00058 
00068 #define SPHERE   1
00069 
00078 #define CYLINDER 2
00079 /************************************************************************************/
00080 
00102 typedef struct {
00103   unsigned int type; 
00105   Tcolor color; 
00107   unsigned int obj3d; 
00109   unsigned int nv; 
00110   unsigned int nf; 
00111   unsigned int ne; 
00112   double **v; 
00113   unsigned int *nvf; 
00114   unsigned int **fv; 
00116   double rad; 
00118   double center[3]; 
00120   double p1[3]; 
00121   double p2[3]; 
00123   double maxCoord; 
00127 } Tcpolyhedron;
00128 
00139 void InitCPolyhedronFromFile(char *fname,Tcolor *c,
00140                              unsigned int gr,Tcpolyhedron *p);
00141 
00153 void NewSphere(double r,double *center,Tcolor *c,
00154                unsigned int gr,Tcpolyhedron *p);
00155 
00168 void NewCylinder(double r,double *p1,double *p2,Tcolor *c,
00169                  unsigned int gr,Tcpolyhedron *p);
00170 
00179 void CopyCPolyhedron(Tcpolyhedron *p_dst,Tcpolyhedron *p_src);
00180 
00190 void TransformCPolyhedron(THTransform *t,Tcpolyhedron *p);
00191 
00201 unsigned int GetCPolyhedronType(Tcpolyhedron *p);
00202 
00211 void SetCPolyhedronColor(Tcolor *c,Tcpolyhedron *p);
00212 
00221 void GetCPolyhedronColor(Tcolor *c,Tcpolyhedron *p);
00222 
00232 unsigned int GetCPolyhedronNVertex(Tcpolyhedron *p);
00233 
00253 void GetCPolyhedronDefiningPoint(unsigned int i,double *point,Tcpolyhedron *p);
00254 
00264 double GetCpolyhedronRadius(Tcpolyhedron *p);
00265 
00281 void GetCPolyhedronVertex(unsigned int i,double *point,Tcpolyhedron *p);
00282 
00295 double GetCPolyhedronMaxCoordinate(Tcpolyhedron *p);
00296 
00307 void PlotCPolyhedron(Tplot3d *pt,Tcpolyhedron *p);
00308 
00309 
00319 void MoveCPolyhedron(Tplot3d *pt,THTransform *t,Tcpolyhedron *p);
00320 
00331 void SaveCPolyhedron(char *fileName,Tcpolyhedron *p);
00332 
00340 void DeleteCPolyhedron(Tcpolyhedron *p);
00341 
00342 #endif