Página principal   Lista alfabética   Lista de componentes   Lista de archivos   Miembros de las clases   Archivos de los miembros  

pt_poly.h

Ir a la documentación de este archivo.
00001 #include <stdio.h>
00002 
00003 
00009     /* polygon vertex definition */
00010 typedef struct vertex_struct {
00011   double x,y;                   /* coordinate values */
00012   struct vertex_struct  *next;  /* circular singly linked list from poly */
00013   } vtx, *vtx_ptr;
00014 
00020     /* polygon definition */
00021 typedef struct polygon_struct {
00022   char name[100];
00023   vtx_ptr last;         /* pointer to end of circular vertex list */
00024   } polygon, *polygon_ptr;
00025 
00026     /* return next vertex in polygon list of vertices */
00027 #define polygon_get_vertex(poly, vertex)                    \
00028     ((vertex == NULL) ? poly->last->next : vertex->next)
00029 
00030     /* create and insert new polygon vertex */
00031 #define polygon_new_vertex(poly, xx, yy, new_vertex) {  \
00032     new_vertex  = (vtx_ptr) malloc (sizeof(vtx));           \
00033     new_vertex->x = xx;                                     \
00034     new_vertex->y = yy;                                     \
00035     if (poly->last != NULL) {                               \
00036       new_vertex->next = poly->last->next;                  \
00037       poly->last->next = new_vertex;                        \
00038       }                                                     \
00039     else {                                                  \
00040       new_vertex->next = new_vertex;                        \
00041       }                                                     \
00042     poly->last = new_vertex;                                \
00043     }
00044 
00045     /* create new polygon */
00046 #define polygon_create(poly)                                \
00047     poly = (polygon_ptr) malloc(sizeof (polygon));          \
00048     poly->last = NULL;
00049 
00050         /* quadrant id's, incremental angles, accumulated angle values */
00051 typedef short quadrant_type;
00052 
00053         /* result value from point in polygon test */
00054 typedef enum pt_poly_relation {DENTRO, FUERA} pt_poly_relation;
00055 
00056 pt_poly_relation point_in_poly(polygon_ptr poly, double x, double y);
00057 int point_on_edge(vtx_ptr vertex1, vtx_ptr vertex2, double x, double y);

Generado el Tue Apr 24 06:55:48 2001 para Dllcontrol por doxygen1.2.6 escrito por Dimitri van Heesch, © 1997-2001