home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / System / Mesa-3.1 / src-glu / tess_heap.h < prev    next >
C/C++ Source or Header  |  1999-11-30  |  2KB  |  78 lines

  1. /* $Id: tess_heap.h,v 1.7.2.3 1999/11/29 18:16:12 gareth Exp $ */
  2.  
  3. /*
  4.  * Mesa 3-D graphics library
  5.  * Version:  3.1
  6.  *
  7.  * Copyright (C) 1999  Brian Paul   All Rights Reserved.
  8.  *
  9.  * Permission is hereby granted, free of charge, to any person obtaining a
  10.  * copy of this software and associated documentation files (the "Software"),
  11.  * to deal in the Software without restriction, including without limitation
  12.  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  13.  * and/or sell copies of the Software, and to permit persons to whom the
  14.  * Software is furnished to do so, subject to the following conditions:
  15.  *
  16.  * The above copyright notice and this permission notice shall be included
  17.  * in all copies or substantial portions of the Software.
  18.  *
  19.  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  20.  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  21.  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
  22.  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  23.  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  24.  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  25.  */
  26.  
  27. /*****************************************************************************
  28.  *
  29.  * GLU 1.3 Polygon Tessellation - Implementation of priority queue
  30.  *
  31.  * Gareth Hughes <garethh@bell-labs.com>, April 1999
  32.  *
  33.  *****************************************************************************/
  34.  
  35. #ifndef __GLU_TESS_HEAP_H__
  36. #define __GLU_TESS_HEAP_H__
  37.  
  38. #include "tess_typedefs.h"
  39.  
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43.  
  44. #define HEAP_ALLOC        8
  45.  
  46. #define HEAP_VERTEX( v )    ((tess_vertex_t *) (v)->ptr)
  47.  
  48. typedef struct heap_elt_s
  49. {
  50.     GLint        index;
  51.     GLdouble        value;
  52.     void        *ptr;
  53.     struct heap_elt_s    *next, *prev;
  54. } heap_elt_t;
  55.  
  56. typedef struct heap_s
  57. {
  58.     GLint        length;
  59.     GLint        size;
  60.     GLint        flags;
  61.     heap_elt_t        **elements;
  62. } heap_t;
  63.  
  64. heap_t        *heap_init();
  65. void        heap_build( heap_t *heap );
  66. GLboolean    heap_insert( heap_t *heap, heap_elt_t *element );
  67. heap_elt_t    *heap_extract_max( heap_t *heap );
  68. heap_elt_t    *heap_delete( heap_t *heap, GLint n );
  69. heap_elt_t    *heap_delete_ptr( heap_t *heap, void *ptr );
  70.  
  71. void        heap_cleanup( heap_t **heap );
  72.  
  73. #ifdef __cplusplus
  74. }
  75. #endif
  76.  
  77. #endif /* __GLU_TESS_HEAP_H__ */
  78.