Muvicado HD
Loading...
Searching...
No Matches
gpc.h
Go to the documentation of this file.
1/*
2===========================================================================
3
4Project: Generic Polygon Clipper
5
6 A new algorithm for calculating the difference, intersection,
7 exclusive-or or union of arbitrary polygon sets.
8
9File: gpc.h
10Author: Alan Murta (email: gpc@cs.man.ac.uk)
11Version: 2.32
12Date: 17th December 2004
13
14Copyright: (C) Advanced Interfaces Group,
15 University of Manchester.
16
17 This software is free for non-commercial use. It may be copied,
18 modified, and redistributed provided that this copyright notice
19 is preserved on all copies. The intellectual property rights of
20 the algorithms used reside with the University of Manchester
21 Advanced Interfaces Group.
22
23 You may not use this software, in whole or in part, in support
24 of any commercial product without the express consent of the
25 author.
26
27 There is no warranty or other guarantee of fitness of this
28 software for any purpose. It is provided solely "as is".
29
30===========================================================================
31*/
32
33#ifndef __gpc_h
34#define __gpc_h
35
36#include <stdio.h>
37
38
39/*
40===========================================================================
41 Constants
42===========================================================================
43*/
44
45/* Increase GPC_EPSILON to encourage merging of near coincident edges */
46
47#define GPC_EPSILON (DBL_EPSILON)
48
49#define GPC_VERSION "2.32"
50
51
52/*
53===========================================================================
54 Public Data Types
55===========================================================================
56*/
57
58typedef enum /* Set operation type */
59{
60 GPC_DIFF, /* Difference */
61 GPC_INT, /* Intersection */
62 GPC_XOR, /* Exclusive or */
63 GPC_UNION /* Union */
64} gpc_op;
65
66typedef struct /* Polygon vertex structure */
67{
68 double x; /* Vertex x component */
69 double y; /* vertex y component */
71
72typedef struct /* Vertex list structure */
73{
74 int num_vertices; /* Number of vertices in list */
75 gpc_vertex *vertex; /* Vertex array pointer */
77
78typedef struct /* Polygon set structure */
79{
80 int num_contours; /* Number of contours in polygon */
81 int *hole; /* Hole / external contour flags */
82 gpc_vertex_list *contour; /* Contour array pointer */
84
85typedef struct /* Tristrip set structure */
86{
87 int num_strips; /* Number of tristrips */
88 gpc_vertex_list *strip; /* Tristrip array pointer */
90
91
92/*
93===========================================================================
94 Public Function Prototypes
95===========================================================================
96*/
97
98void gpc_read_polygon (FILE *infile_ptr,
99 int read_hole_flags,
100 gpc_polygon *polygon);
101
102void gpc_write_polygon (FILE *outfile_ptr,
103 int write_hole_flags,
104 gpc_polygon *polygon);
105
106void gpc_add_contour (gpc_polygon *polygon,
107 gpc_vertex_list *contour,
108 int hole);
109
110void gpc_polygon_clip (gpc_op set_operation,
111 gpc_polygon *subject_polygon,
112 gpc_polygon *clip_polygon,
113 gpc_polygon *result_polygon);
114
115void gpc_tristrip_clip (gpc_op set_operation,
116 gpc_polygon *subject_polygon,
117 gpc_polygon *clip_polygon,
118 gpc_tristrip *result_tristrip);
119
121 gpc_tristrip *tristrip);
122
123void gpc_free_polygon (gpc_polygon *polygon);
124
125void gpc_free_tristrip (gpc_tristrip *tristrip);
126
127#endif
128
129/*
130===========================================================================
131 End of file: gpc.h
132===========================================================================
133*/
void gpc_polygon_to_tristrip(gpc_polygon *polygon, gpc_tristrip *tristrip)
Definition gpc.c:1766
gpc_op
Definition gpc.h:59
@ GPC_INT
Definition gpc.h:61
@ GPC_XOR
Definition gpc.h:62
@ GPC_DIFF
Definition gpc.h:60
@ GPC_UNION
Definition gpc.h:63
void gpc_polygon_clip(gpc_op set_operation, gpc_polygon *subject_polygon, gpc_polygon *clip_polygon, gpc_polygon *result_polygon)
Definition gpc.c:1117
void gpc_tristrip_clip(gpc_op set_operation, gpc_polygon *subject_polygon, gpc_polygon *clip_polygon, gpc_tristrip *result_tristrip)
Definition gpc.c:1777
void gpc_write_polygon(FILE *outfile_ptr, int write_hole_flags, gpc_polygon *polygon)
Definition gpc.c:1057
void gpc_add_contour(gpc_polygon *polygon, gpc_vertex_list *contour, int hole)
Definition gpc.c:1077
void gpc_free_polygon(gpc_polygon *polygon)
Definition gpc.c:1018
void gpc_free_tristrip(gpc_tristrip *tristrip)
Definition gpc.c:1755
void gpc_read_polygon(FILE *infile_ptr, int read_hole_flags, gpc_polygon *polygon)
Definition gpc.c:1030
int num_contours
Definition gpc.h:80
gpc_vertex_list * contour
Definition gpc.h:82
int * hole
Definition gpc.h:81
int num_strips
Definition gpc.h:87
gpc_vertex_list * strip
Definition gpc.h:88
gpc_vertex * vertex
Definition gpc.h:75
int num_vertices
Definition gpc.h:74
double y
Definition gpc.h:69
double x
Definition gpc.h:68