gpc.h
Go to the documentation of this file.
00001 /*
00002  This file is part of the VRender library.
00003  Copyright (C) 2005 Cyril Soler (Cyril.Soler@imag.fr)
00004  Version 1.0.0, released on June 27, 2005.
00005 
00006  http://artis.imag.fr/Members/Cyril.Soler/VRender
00007 
00008  VRender is free software; you can redistribute it and/or modify
00009  it under the terms of the GNU General Public License as published by
00010  the Free Software Foundation; either version 2 of the License, or
00011  (at your option) any later version.
00012 
00013  VRender is distributed in the hope that it will be useful,
00014  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  GNU General Public License for more details.
00017 
00018  You should have received a copy of the GNU General Public License
00019  along with VRender; if not, write to the Free Software Foundation, Inc.,
00020  51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
00021 */
00022 
00023 /****************************************************************************
00024 
00025  Copyright (C) 2002-2013 Gilles Debunne. All rights reserved.
00026 
00027  This file is part of the QGLViewer library version 2.4.0.
00028 
00029  http://www.libqglviewer.com - contact@libqglviewer.com
00030 
00031  This file may be used under the terms of the GNU General Public License 
00032  versions 2.0 or 3.0 as published by the Free Software Foundation and
00033  appearing in the LICENSE file included in the packaging of this file.
00034  In addition, as a special exception, Gilles Debunne gives you certain 
00035  additional rights, described in the file GPL_EXCEPTION in this package.
00036 
00037  libQGLViewer uses dual licensing. Commercial/proprietary software must
00038  purchase a libQGLViewer Commercial License.
00039 
00040  This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00041  WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00042 
00043 *****************************************************************************/
00044 
00045 /*
00046 ===========================================================================
00047 
00048 Project:   Generic Polygon Clipper
00049 
00050            A new algorithm for calculating the difference, intersection,
00051            exclusive-or or union of arbitrary polygon sets.
00052 
00053 File:      gpc.h
00054 Author:    Alan Murta (email: gpc@cs.man.ac.uk)
00055 Version:   2.32
00056 Date:      17th December 2004
00057 
00058 Copyright: (C) 1997-2004, Advanced Interfaces Group,
00059            University of Manchester.
00060 
00061            This software is free for non-commercial use. It may be copied,
00062            modified, and redistributed provided that this copyright notice
00063            is preserved on all copies. The intellectual property rights of
00064            the algorithms used reside with the University of Manchester
00065            Advanced Interfaces Group.
00066 
00067            You may not use this software, in whole or in part, in support
00068            of any commercial product without the express consent of the
00069            author.
00070 
00071            There is no warranty or other guarantee of fitness of this
00072            software for any purpose. It is provided solely "as is".
00073 
00074 ===========================================================================
00075 */
00076 
00077 #ifndef __gpc_h
00078 #define __gpc_h
00079 
00080 #include <stdio.h>
00081 
00082 
00083 /*
00084 ===========================================================================
00085                                Constants
00086 ===========================================================================
00087 */
00088 
00089 /* Increase GPC_EPSILON to encourage merging of near coincident edges    */
00090 
00091 //#define GPC_EPSILON (DBL_EPSILON)
00092 #define GPC_EPSILON 1e-7
00093 
00094 #define GPC_VERSION "2.32"
00095 
00096 
00097 /*
00098 ===========================================================================
00099                            Public Data Types
00100 ===========================================================================
00101 */
00102 
00103 typedef enum                        /* Set operation type                */
00104 {
00105   GPC_DIFF,                         /* Difference                        */
00106   GPC_INT,                          /* Intersection                      */
00107   GPC_XOR,                          /* Exclusive or                      */
00108   GPC_UNION                         /* Union                             */
00109 } gpc_op;
00110 
00111 typedef struct                      /* Polygon vertex structure          */
00112 {
00113   double              x;            /* Vertex x component                */
00114   double              y;            /* vertex y component                */
00115 } gpc_vertex;
00116 
00117 typedef struct                      /* Vertex list structure             */
00118 {
00119   int                 num_vertices; /* Number of vertices in list        */
00120   gpc_vertex         *vertex;       /* Vertex array pointer              */
00121 } gpc_vertex_list;
00122 
00123 typedef struct                      /* Polygon set structure             */
00124 {
00125   int                 num_contours; /* Number of contours in polygon     */
00126   int                *hole;         /* Hole / external contour flags     */
00127   gpc_vertex_list    *contour;      /* Contour array pointer             */
00128 } gpc_polygon;
00129 
00130 typedef struct                      /* Tristrip set structure            */
00131 {
00132   int                 num_strips;   /* Number of tristrips               */
00133   gpc_vertex_list    *strip;        /* Tristrip array pointer            */
00134 } gpc_tristrip;
00135 
00136 
00137 /*
00138 ===========================================================================
00139                        Public Function Prototypes
00140 ===========================================================================
00141 */
00142 
00143 void gpc_read_polygon        (FILE            *infile_ptr,
00144                               int              read_hole_flags,
00145                               gpc_polygon     *polygon);
00146 
00147 void gpc_write_polygon       (FILE            *outfile_ptr,
00148                               int              write_hole_flags,
00149                               gpc_polygon     *polygon);
00150 
00151 void gpc_add_contour         (gpc_polygon     *polygon,
00152                               gpc_vertex_list *contour,
00153                               int              hole);
00154 
00155 void gpc_polygon_clip        (gpc_op           set_operation,
00156                               gpc_polygon     *subject_polygon,
00157                               gpc_polygon     *clip_polygon,
00158                               gpc_polygon     *result_polygon);
00159 
00160 void gpc_tristrip_clip       (gpc_op           set_operation,
00161                               gpc_polygon     *subject_polygon,
00162                               gpc_polygon     *clip_polygon,
00163                               gpc_tristrip    *result_tristrip);
00164 
00165 void gpc_polygon_to_tristrip (gpc_polygon     *polygon,
00166                               gpc_tristrip    *tristrip);
00167 
00168 void gpc_free_polygon        (gpc_polygon     *polygon);
00169 
00170 void gpc_free_tristrip       (gpc_tristrip    *tristrip);
00171 
00172 #endif
00173 
00174 
00175 /*
00176 ===========================================================================
00177                            End of file: gpc.h
00178 ===========================================================================
00179 */


octovis
Author(s): Kai M. Wurm , Armin Hornung
autogenerated on Thu Jun 6 2019 17:31:58