gpc.h
Go to the documentation of this file.
1 /*
2  This file is part of the VRender library.
3  Copyright (C) 2005 Cyril Soler (Cyril.Soler@imag.fr)
4  Version 1.0.0, released on June 27, 2005.
5 
6  http://artis.imag.fr/Members/Cyril.Soler/VRender
7 
8  VRender is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 2 of the License, or
11  (at your option) any later version.
12 
13  VRender is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with VRender; if not, write to the Free Software Foundation, Inc.,
20  51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
21 */
22 
23 /****************************************************************************
24 
25  Copyright (C) 2002-2013 Gilles Debunne. All rights reserved.
26 
27  This file is part of the QGLViewer library version 2.4.0.
28 
29  http://www.libqglviewer.com - contact@libqglviewer.com
30 
31  This file may be used under the terms of the GNU General Public License
32  versions 2.0 or 3.0 as published by the Free Software Foundation and
33  appearing in the LICENSE file included in the packaging of this file.
34  In addition, as a special exception, Gilles Debunne gives you certain
35  additional rights, described in the file GPL_EXCEPTION in this package.
36 
37  libQGLViewer uses dual licensing. Commercial/proprietary software must
38  purchase a libQGLViewer Commercial License.
39 
40  This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
41  WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
42 
43 *****************************************************************************/
44 
45 /*
46 ===========================================================================
47 
48 Project: Generic Polygon Clipper
49 
50  A new algorithm for calculating the difference, intersection,
51  exclusive-or or union of arbitrary polygon sets.
52 
53 File: gpc.h
54 Author: Alan Murta (email: gpc@cs.man.ac.uk)
55 Version: 2.32
56 Date: 17th December 2004
57 
58 Copyright: (C) 1997-2004, Advanced Interfaces Group,
59  University of Manchester.
60 
61  This software is free for non-commercial use. It may be copied,
62  modified, and redistributed provided that this copyright notice
63  is preserved on all copies. The intellectual property rights of
64  the algorithms used reside with the University of Manchester
65  Advanced Interfaces Group.
66 
67  You may not use this software, in whole or in part, in support
68  of any commercial product without the express consent of the
69  author.
70 
71  There is no warranty or other guarantee of fitness of this
72  software for any purpose. It is provided solely "as is".
73 
74 ===========================================================================
75 */
76 
77 #ifndef __gpc_h
78 #define __gpc_h
79 
80 #include <stdio.h>
81 
82 
83 /*
84 ===========================================================================
85  Constants
86 ===========================================================================
87 */
88 
89 /* Increase GPC_EPSILON to encourage merging of near coincident edges */
90 
91 //#define GPC_EPSILON (DBL_EPSILON)
92 #define GPC_EPSILON 1e-7
93 
94 #define GPC_VERSION "2.32"
95 
96 
97 /*
98 ===========================================================================
99  Public Data Types
100 ===========================================================================
101 */
102 
103 typedef enum /* Set operation type */
104 {
105  GPC_DIFF, /* Difference */
106  GPC_INT, /* Intersection */
107  GPC_XOR, /* Exclusive or */
108  GPC_UNION /* Union */
109 } gpc_op;
110 
111 typedef struct /* Polygon vertex structure */
112 {
113  double x; /* Vertex x component */
114  double y; /* vertex y component */
115 } gpc_vertex;
116 
117 typedef struct /* Vertex list structure */
118 {
119  int num_vertices; /* Number of vertices in list */
120  gpc_vertex *vertex; /* Vertex array pointer */
122 
123 typedef struct /* Polygon set structure */
124 {
125  int num_contours; /* Number of contours in polygon */
126  int *hole; /* Hole / external contour flags */
127  gpc_vertex_list *contour; /* Contour array pointer */
128 } gpc_polygon;
129 
130 typedef struct /* Tristrip set structure */
131 {
132  int num_strips; /* Number of tristrips */
133  gpc_vertex_list *strip; /* Tristrip array pointer */
134 } gpc_tristrip;
135 
136 
137 /*
138 ===========================================================================
139  Public Function Prototypes
140 ===========================================================================
141 */
142 
143 void gpc_read_polygon (FILE *infile_ptr,
144  int read_hole_flags,
145  gpc_polygon *polygon);
146 
147 void gpc_write_polygon (FILE *outfile_ptr,
148  int write_hole_flags,
149  gpc_polygon *polygon);
150 
151 void gpc_add_contour (gpc_polygon *polygon,
152  gpc_vertex_list *contour,
153  int hole);
154 
155 void gpc_polygon_clip (gpc_op set_operation,
156  gpc_polygon *subject_polygon,
157  gpc_polygon *clip_polygon,
158  gpc_polygon *result_polygon);
159 
160 void gpc_tristrip_clip (gpc_op set_operation,
161  gpc_polygon *subject_polygon,
162  gpc_polygon *clip_polygon,
163  gpc_tristrip *result_tristrip);
164 
165 void gpc_polygon_to_tristrip (gpc_polygon *polygon,
166  gpc_tristrip *tristrip);
167 
168 void gpc_free_polygon (gpc_polygon *polygon);
169 
170 void gpc_free_tristrip (gpc_tristrip *tristrip);
171 
172 #endif
173 
174 
175 /*
176 ===========================================================================
177  End of file: gpc.h
178 ===========================================================================
179 */
void gpc_read_polygon(FILE *infile_ptr, int read_hole_flags, gpc_polygon *polygon)
double y
Definition: gpc.h:114
gpc_op
Definition: gpc.h:103
Definition: gpc.h:105
gpc_vertex_list * contour
Definition: gpc.h:127
Definition: gpc.h:106
Definition: gpc.h:107
void gpc_polygon_clip(gpc_op set_operation, gpc_polygon *subject_polygon, gpc_polygon *clip_polygon, gpc_polygon *result_polygon)
Definition: gpc.cpp:1192
void gpc_add_contour(gpc_polygon *polygon, gpc_vertex_list *contour, int hole)
Definition: gpc.cpp:1152
void gpc_polygon_to_tristrip(gpc_polygon *polygon, gpc_tristrip *tristrip)
Definition: gpc.cpp:1843
void gpc_free_tristrip(gpc_tristrip *tristrip)
Definition: gpc.cpp:1832
gpc_vertex * vertex
Definition: gpc.h:120
int num_contours
Definition: gpc.h:125
int * hole
Definition: gpc.h:126
int num_vertices
Definition: gpc.h:119
int num_strips
Definition: gpc.h:132
Definition: gpc.h:108
void gpc_free_polygon(gpc_polygon *polygon)
Definition: gpc.cpp:1093
void gpc_write_polygon(FILE *outfile_ptr, int write_hole_flags, gpc_polygon *polygon)
Definition: gpc.cpp:1132
void gpc_tristrip_clip(gpc_op set_operation, gpc_polygon *subject_polygon, gpc_polygon *clip_polygon, gpc_tristrip *result_tristrip)
Definition: gpc.cpp:1854
double x
Definition: gpc.h:113
gpc_vertex_list * strip
Definition: gpc.h:133


octovis
Author(s): Kai M. Wurm , Armin Hornung
autogenerated on Mon Jun 10 2019 14:00:25