CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
avgpc.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2022, Open Design Alliance (the "Alliance").
3// All rights reserved.
4//
5// This software and its documentation and related materials are owned by
6// the Alliance. The software may only be incorporated into application
7// programs owned by members of the Alliance, subject to a signed
8// Membership Agreement and Supplemental Software License Agreement with the
9// Alliance. The structure and organization of this software are the valuable
10// trade secrets of the Alliance and its suppliers. The software is also
11// protected by copyright law and international treaty provisions. Application
12// programs incorporating this software must include the following statement
13// with their copyright notices:
14//
15// This application incorporates Open Design Alliance software pursuant to a license
16// agreement with Open Design Alliance.
17// Open Design Alliance Copyright (C) 2002-2022 by Open Design Alliance.
18// All rights reserved.
19//
20// By use of this software, its documentation or related materials, you
21// acknowledge and accept the above terms.
23
24/*
25===========================================================================
26
27Project: Generic Polygon Clipper
28
29 A new algorithm for calculating the difference, intersection,
30 exclusive-or or union of arbitrary polygon sets.
31
32File: gpc.h
33Author: Alan Murta (email: gpc@cs.man.ac.uk)
34Version: 2.32
35Date: 17th December 2004
36
37Copyright: (C) Advanced Interfaces Group,
38 University of Manchester.
39
40 This software is free for non-commercial use. It may be copied,
41 modified, and redistributed provided that this copyright notice
42 is preserved on all copies. The intellectual property rights of
43 the algorithms used reside with the University of Manchester
44 Advanced Interfaces Group.
45
46 You may not use this software, in whole or in part, in support
47 of any commercial product without the express consent of the
48 author.
49
50 There is no warranty or other guarantee of fitness of this
51 software for any purpose. It is provided solely "as is".
52
53ODA Notice: This software has been licensed by the Open Design Alliance. Any
54 use outside of ODA Platform-based member applications requires the user
55 to obtain a separate license.
56
57===========================================================================
58*/
59
60#ifndef __gpc_h
61#define __gpc_h
62
63#include <stdio.h>
64#include "Ge/GeExport.h"
65
66#ifdef __cplusplus
67extern "C"
68{
69#endif
70
71/*
72===========================================================================
73 Constants
74===========================================================================
75*/
76
77/* Increase GPC_EPSILON to encourage merging of near coincident edges */
78
79#define GPC_EPSILON (DBL_EPSILON)
80
81#define GPC_VERSION "2.32"
82
83//DOM-IGNORE-BEGIN
84/*
85===========================================================================
86 Public Data Types
87===========================================================================
88*/
89
90typedef enum /* Set operation type */
91{
92 GPC_DIFF, /* Difference */
93 GPC_INT, /* Intersection */
94 GPC_XOR, /* Exclusive or */
95 GPC_UNION /* Union */
97
98typedef struct /* Polygon vertex structure */
99{
100 double x; /* Vertex x component */
101 double y; /* vertex y component */
102} gpc_vertex;
103
104typedef struct /* Vertex list structure */
105{
106 int num_vertices; /* Number of vertices in list */
107 gpc_vertex *vertex; /* Vertex array pointer */
109
110typedef struct /* Polygon set structure */
111{
112 int num_contours; /* Number of contours in polygon */
113 int *hole; /* Hole / external contour flags */
114 gpc_vertex_list *contour; /* Contour array pointer */
116
117typedef struct /* Tristrip set structure */
118{
119 int num_strips; /* Number of tristrips */
120 gpc_vertex_list *strip; /* Tristrip array pointer */
122
123
124/*
125===========================================================================
126 Public Function Prototypes
127===========================================================================
128*/
129//DD:EXPORT_ON
130
131void GE_TOOLKIT_EXPORT gpc_read_polygon (FILE *infile_ptr,
132 int read_hole_flags,
133 gpc_polygon *polygon);
134
135void GE_TOOLKIT_EXPORT gpc_write_polygon (FILE *outfile_ptr,
136 int write_hole_flags,
137 gpc_polygon *polygon);
138
140 gpc_vertex_list *contour,
141 int hole);
142
144 gpc_polygon *subject_polygon,
145 gpc_polygon *clip_polygon,
146 gpc_polygon *result_polygon);
147
148/* ODA extension
149Returns 1 if returned result_polygon is the same as one of operands (depending on set_operation)
150*/
152 gpc_polygon *subject_polygon,
153 gpc_polygon *clip_polygon,
154 gpc_polygon *result_polygon);
155
157 gpc_polygon *subject_polygon,
158 gpc_polygon *clip_polygon,
159 gpc_tristrip *result_tristrip);
160
162 gpc_tristrip *tristrip);
163
165
167
168#ifdef __cplusplus
169} // extern "C"
170
171#include "OdAlloc.h"
172/* ODA extension
173Allocate memory for polygon elements (compatible with gpc_free_polygon function).
174*/
175template <class Type>
176Type *gpc_alloc(int num_structs)
177{ return (Type*)::odrxAlloc(sizeof(Type) * num_structs); }
178
179#endif
180
181//DD:EXPORT_OFF
182
183//DOM-IGNORE-END
184#endif // __gpc_h
185
186/*
187===========================================================================
188 End of file: gpc.h
189===========================================================================
190*/
#define GE_TOOLKIT_EXPORT
Definition: GeExport.h:49
ALLOCDLL_EXPORT void * odrxAlloc(size_t nBytes)
void GE_TOOLKIT_EXPORT gpc_free_tristrip(gpc_tristrip *tristrip)
void GE_TOOLKIT_EXPORT gpc_free_polygon(gpc_polygon *polygon)
int GE_TOOLKIT_EXPORT gpc_polygon_clip_ex(gpc_op set_operation, gpc_polygon *subject_polygon, gpc_polygon *clip_polygon, gpc_polygon *result_polygon)
void GE_TOOLKIT_EXPORT gpc_polygon_to_tristrip(gpc_polygon *polygon, gpc_tristrip *tristrip)
void GE_TOOLKIT_EXPORT gpc_add_contour(gpc_polygon *polygon, gpc_vertex_list *contour, int hole)
gpc_op
Definition: avgpc.h:91
@ GPC_INT
Definition: avgpc.h:93
@ GPC_XOR
Definition: avgpc.h:94
@ GPC_DIFF
Definition: avgpc.h:92
@ GPC_UNION
Definition: avgpc.h:95
void GE_TOOLKIT_EXPORT gpc_read_polygon(FILE *infile_ptr, int read_hole_flags, gpc_polygon *polygon)
void GE_TOOLKIT_EXPORT gpc_tristrip_clip(gpc_op set_operation, gpc_polygon *subject_polygon, gpc_polygon *clip_polygon, gpc_tristrip *result_tristrip)
void GE_TOOLKIT_EXPORT gpc_polygon_clip(gpc_op set_operation, gpc_polygon *subject_polygon, gpc_polygon *clip_polygon, gpc_polygon *result_polygon)
void GE_TOOLKIT_EXPORT gpc_write_polygon(FILE *outfile_ptr, int write_hole_flags, gpc_polygon *polygon)
int num_contours
Definition: avgpc.h:112
gpc_vertex_list * contour
Definition: avgpc.h:114
int * hole
Definition: avgpc.h:113
int num_strips
Definition: avgpc.h:119
gpc_vertex_list * strip
Definition: avgpc.h:120
gpc_vertex * vertex
Definition: avgpc.h:107
int num_vertices
Definition: avgpc.h:106
double y
Definition: avgpc.h:101
double x
Definition: avgpc.h:100