HOME

TheInfoList



OR:

The General Polygon Clipper (GPC) is a software library providing for computing the results of clipping operations on sets of
polygon In geometry, a polygon () is a plane figure that is described by a finite number of straight line segments connected to form a closed ''polygonal chain'' (or ''polygonal circuit''). The bounded plane region, the bounding circuit, or the two toge ...
s. It generalises the computer graphics clipping problem of intersecting polygons with polygons. The first release of GPC was designed and implemented in 1997 by Alan Murta. the final GPC release was version 2.32. The core GPC library is written in the
C programming language ''The C Programming Language'' (sometimes termed ''K&R'', after its authors' initials) is a computer programming book written by Brian Kernighan and Dennis Ritchie, the latter of whom originally designed and implemented the language, as well as ...
but the library has also been ported to work with several other languages.


Availability

Since August 2020, GPC is no longer officially distributed by the author. In December 2021 a copy of the GPC code (v2.32) was placed on
GitHub GitHub, Inc. () is an Internet hosting service for software development and version control using Git. It provides the distributed version control of Git plus access control, bug tracking, software feature requests, task management, continuous ...
under the
MIT License The MIT License is a permissive free software license originating at the Massachusetts Institute of Technology (MIT) in the late 1980s. As a permissive license, it puts only very limited restriction on reuse and has, therefore, high license comp ...
by
Paint.NET Paint.net (stylized as Paint.NET or paint.net) is a freeware raster graphics editor program for Microsoft Windows, developed on the .NET Framework. Paint.net was originally created by Rick Brewster as a Washington State University student project, ...
author Rick Brewster.


Licensing

Developers may use GPC for any purpose without paid licensing restrictions.


Features of GPC

The following summarises the features and operations on polygons supported by GPC. GPC can compute the following clip operations: difference, intersection, exclusive-or and union. Polygons may comprise multiple disjoint contours. Contour vertices may be specified as clockwise or anticlockwise. Contours may be convex, concave or self-intersecting. Contours may be nested. In other words, polygons may have holes. The clip operation output from GPC is a set of polygon contours or tristrips. Holes and external contours are differentiated in GPC's output. Coincident edges and degenerate regions are handled correctly.


Examples of GPC operations on sets of polygons

The following four images show examples of GPC computing operations between two polygon sets. The first polygon set comprises outlines of the United Kingdom and Ireland. The second polygon set comprises the four large inward-pointing arrows. In each example, the areas resulting from the GPC operation between the two sets of polygons are rendered in colour. This example shows difference between the two sets: This example shows intersection between the two sets: This example shows union between the two sets: This example shows exclusive-or between the two sets:


Ports and language bindings

The core GPC code is written in C, but the GPC user community has contributed a number of ports and bindings (or wrappers) for various other languages ( Action Script 3,
Borland Delphi Delphi is a general-purpose programming language and a software product that uses the Delphi dialect of the Object Pascal programming language and provides an integrated development environment (IDE) for rapid application development of desktop, ...
, C#,
GNU Octave GNU Octave is a high-level programming language primarily intended for scientific computing and numerical computation. Octave helps in solving linear and nonlinear problems numerically, and for performing other numerical experiments using a langu ...
,
Haxe Haxe is an open source high-level cross-platform programming language and compiler that can produce applications and source code, for many different computing platforms from one code-base. It is free and open-source software, released under the ...
,
Haskell Haskell () is a general-purpose, statically-typed, purely functional programming language with type inference and lazy evaluation. Designed for teaching, research and industrial applications, Haskell has pioneered a number of programming lang ...
,
Java Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's List ...
,
Lua Lua or LUA may refer to: Science and technology * Lua (programming language) * Latvia University of Agriculture * Last universal ancestor, in evolution Ethnicity and language * Lua people, of Laos * Lawa people, of Thailand sometimes referred t ...
,
Pascal Pascal, Pascal's or PASCAL may refer to: People and fictional characters * Pascal (given name), including a list of people with the name * Pascal (surname), including a list of people and fictional characters with the name ** Blaise Pascal, Fren ...
,
Perl Perl is a family of two high-level, general-purpose, interpreted, dynamic programming languages. "Perl" refers to Perl 5, but from 2000 to 2019 it also referred to its redesigned "sister language", Perl 6, before the latter's name was offici ...
,
Python Python may refer to: Snakes * Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia ** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia * Python (mythology), a mythical serpent Computing * Python (pro ...
,
VB.Net Visual Basic, originally called Visual Basic .NET (VB.NET), is a multi-paradigm, object-oriented programming language, implemented on .NET, Mono, and the .NET Framework. Microsoft launched VB.NET in 2002 as the successor to its original Visua ...
). All of these ports and bindings are freely available.


References

{{reflist


External links


Maintained Java version
Graphics libraries