Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members  

prm.h

Go to the documentation of this file.
00001 /*
00002 ** ---------------------------------------------------------------
00003 ** prm.h  -  Primitive module definitions and prototypes.
00004 **
00005 ** ---------------------------------------------------------------
00006 */
00007 
00008 #ifndef _PRM_H
00009 #define _PRM_H
00010 
00033 /*
00034 ** ---------------------------------------------------------------
00035 ** Used global definitions:
00036 **
00037 */
00038 #include <stdio.h>  /* FILE */
00039 
00040 /*
00041 ** ---------------------------------------------------------------
00042 ** Public data type definitions:
00043 */
00044 
00045 #ifndef ABS
00046 #define ABS(x) (((x) < 0.0)? -(x): (x))
00047 #endif
00048 
00050 #define COORD_TOL  0.001
00051 
00054 typedef enum _prmtype {
00056   PRM_UNDEF,
00058   PRM_QUAD,
00060   PRM_CIRC,
00062   NumPrmTypes
00063  } PrmType;
00064 
00067 typedef struct _Coord {
00069   double    x;
00071   double    y;
00072  } Coord;
00073 
00076 typedef struct _prm Prm;
00077 
00078 /* Some predefined RGB color codes for convenience 
00079  * (stolen from CD graphics system):
00080  */
00081 #define  PRM_WHITE         0xFFFFFFL   /* 255,255,255 */
00082 #define  PRM_GRAY          0xC0C0C0L   /* 192,192,192 */
00083 #define  PRM_DARK_GRAY     0x808080L   /* 128,128,128 */
00084 #define  PRM_BLACK         0x000000L   /*   0,  0,  0 */
00085 #define  PRM_RED           0xFF0000L   /* 255,  0,  0 */
00086 #define  PRM_DARK_RED      0x800000L   /* 128,  0,  0 */
00087 #define  PRM_GREEN         0x00FF00L   /*   0,255,  0 */
00088 #define  PRM_DARK_GREEN    0x008000L   /*   0,128,  0 */
00089 #define  PRM_BLUE          0x0000FFL   /*   0,  0,255 */
00090 #define  PRM_DARK_BLUE     0x000080L   /*   0,  0,128 */
00091 #define  PRM_YELLOW        0xFFFF00L   /* 255,255,  0 */
00092 #define  PRM_DARK_YELLOW   0x808000L   /* 128,128,  0 */
00093 #define  PRM_MAGENTA       0xFF00FFL   /* 255,  0,255 */
00094 #define  PRM_DARK_MAGENTA  0x800080L   /* 128,  0,128 */
00095 #define  PRM_CYAN          0x00FFFFL   /*   0,255,255 */
00096 #define  PRM_DARK_CYAN     0x008080L   /*   0,128,128 */
00097 
00098 /*
00099 ** ---------------------------------------------------------------
00100 ** Public functions:
00101 **
00102 */
00103 
00104 /* --------------------------------------------------------------- */
00118 Prm *prmCreateFront( PrmType type );
00119 
00120 /* --------------------------------------------------------------- */
00134 Prm *prmCreateBack( PrmType type );
00135 
00136 /* --------------------------------------------------------------- */
00148 void prmDelete( Prm *prm );
00149 
00150 /* --------------------------------------------------------------- */
00158 void prmDeleteSelected( void );
00159 
00160 /* --------------------------------------------------------------- */
00166 void prmDeleteList( void );
00167 
00168 /* --------------------------------------------------------------- */
00177 Prm *prmFirst( void );
00178 
00179 /* --------------------------------------------------------------- */
00188 Prm *prmLast( void );
00189 
00190 /* --------------------------------------------------------------- */
00203 Prm *prmNext( Prm *prm );
00204 
00205 /* --------------------------------------------------------------- */
00218 Prm *prmPrevious( Prm *prm );
00219 
00220 /* --------------------------------------------------------------- */
00232 void prmMoveFront( Prm *prm );
00233 
00234 /* --------------------------------------------------------------- */
00245 void prmMoveBack( Prm *prm );
00246 
00247 /* --------------------------------------------------------------- */
00260 int prmGetType( Prm *prm );
00261 
00262 /* --------------------------------------------------------------- */
00273 void prmRead( Prm *prm, FILE *fd );
00274 
00275 /* --------------------------------------------------------------- */
00286 void prmWrite( Prm *prm, FILE *fd );
00287 
00288 /* --------------------------------------------------------------- */
00300 int prmGetNPts( Prm *prm );
00301 
00302 /* --------------------------------------------------------------- */
00318 void prmSetCoords( Prm *prm, int id, double x, double y );
00319 
00320 /* --------------------------------------------------------------- */
00335 void prmGetCoords( Prm *prm, int id, double *x, double *y );
00336 
00337 /* --------------------------------------------------------------- */
00350 void prmSet1stPt( Prm *prm, double x, double y );
00351 
00352 /* --------------------------------------------------------------- */
00365 void prmSet2ndPt( Prm *prm, double x, double y );
00366 
00367 /* --------------------------------------------------------------- */
00373 void prmSelectAll( void );
00374 
00375 /* --------------------------------------------------------------- */
00384 void prmSelect( Prm *prm );
00385 
00386 /* --------------------------------------------------------------- */
00396 void prmUnselect( Prm *prm );
00397 
00398 /* --------------------------------------------------------------- */
00404 void prmUnselectAll( void );
00405 
00406 /* --------------------------------------------------------------- */
00416 int prmCheckSelected( Prm *prm );
00417 
00418 /* --------------------------------------------------------------- */
00429 void prmSetColor( Prm *prm, long int color );
00430 
00431 /* --------------------------------------------------------------- */
00444 long int prmGetColor( Prm *prm );
00445 
00446 /* --------------------------------------------------------------- */
00456 void prmSetHeight( Prm *prm, double height );
00457 
00458 /* --------------------------------------------------------------- */
00470 double prmGetHeight( Prm *prm );
00471 
00472 /* --------------------------------------------------------------- */
00488 int prmPickArea( Prm *prm, double x, double y );
00489 
00490 /* --------------------------------------------------------------- */
00507 int prmPickVertex( Prm *prm, double x, double y, double tol,
00508                    int *id );
00509 
00510 /* --------------------------------------------------------------- */
00528 int prmPickSide( Prm *prm, double x, double y, double tol,
00529                  int *id );
00530 
00531 /* --------------------------------------------------------------- */
00542 void prmTranslate( Prm *prm, double dx, double dy );
00543 
00544 /* --------------------------------------------------------------- */
00559 void prmTranslateVertex( Prm *prm, int id, double dx, double dy );
00560 
00561 /* --------------------------------------------------------------- */
00578 void prmTranslateSide( Prm *prm, int id, double dx, double dy );
00579 
00580 /* --------------------------------------------------------------- */
00594 void prmGetBox( Prm *prm, double *xmin, double *xmax, 
00595                           double *ymin, double *ymax );
00596 
00597 /* --------------------------------------------------------------- */
00612 int prmGetGlobalBox( double *xmin, double *xmax, 
00613                      double *ymin, double *ymax );
00614 
00615 /* --------------------------------------------------------------- */
00628 void prmDisplayBoundary( Prm *prm );
00629 
00630 /* --------------------------------------------------------------- */
00643 void prmDisplayInterior( Prm *prm );
00644 
00645 /* --------------------------------------------------------------- */
00655 void prmDisplaySolid( Prm *prm );
00656 
00657 /* --------------------------------------------------------------- */
00668 void prmHighltSolid( Prm *prm );
00669 
00670 /* --------------------------------------------------------------- */
00679 void prmDisplayZbuffer( Prm *prm );
00680 
00681 
00684 #endif
00685  edges of the prism and draws marks 
00686 ** at its vertices, all with the current color.  It uses OpenGL
00687 ** display functions.
00688 **
00689 **  @param prm     - pointer to target primitive              (in)
00690 */
00691 void prmHighltSolid( Prm *prm );
00692 
00693 /* --------------------------------------------------------------- */
00702 void prmDisplayZbuffer( Prm *prm );
00703 
00704 
00707 #endif

Generated on Tue Nov 8 10:58:00 2005 for Trab3 by doxygen1.2.18