VisiLibity 1 for Planar Visibility Computations


License, Links


VisiLibity Release 1 is a free open source C++ library for 2D floating-point visibility algorithms, path planning, and supporting data types. It is intended for use in robot and sensor network design software. Other possible applications include, e.g., manufacturing, facility location, architectural/urban planning, games, and education. The entire library consists only of a single compilation unit (one .hpp + one .cpp file) with no dependence on third party libraries. It is therefore suitable for applications where simple visibility and path planning computations are needed but the power of a larger computational geometry library is not necessary.

Current Functionality of VisiLibity (R-1) in planar polygonal environments with polygonal holes:

  • visibility polygons
  • visibility graphs
  • Euclidean shortest paths for a point
Exact/arbitrary precision arithmetic is avoided and robustness is achieved by considering two points to be colocated whenever the Euclidean distance between them is less or equal to a user defined tolerance ε called the robustness constant. If the robustness constant is chosen poorly or the scale of environment features varies too dramatically, library functions can and will return errors. However, provided the user tunes the robustness constant appropriately, we find the library works well for a large range of useful environments. Examples of environments and a Matlab interface (via MEX-files) are available with the download package below.


The following set of files includes the VisiLibity source code as well as some other files, one of which is a README with more detailed instructions:

Version 2016:12:26 (gzip'd tarball)

To use VisiLibity in your C++ program, you simply need to

1. Extract and unzip, e.g., with the terminal command line
    tar -xzf VisiLibity.yyyy_mm_dd.tgz
2. place an #include "visilibity.hpp" directive at the beginning of your program, and
3. link your program with visilibity.cpp when compiling.

Here is the source code documentation.

When possible, please cite VisiLibity. For your convenience, here is a BibTeX item

	   author =       {K. J. Obermeyer and Contributors},
	   title =        {The {VisiLibity} Library},
	   howpublished = {\texttt{}},
	   year =         2008,
	   note =         {Release 1},
	   abstract =     {A C++ library for planar visibility computations},
Also, I would be very interested to learn what projects VisiLibity has been used for, so if you like, send me an email.

Help and Contributions: To report a bug/bugfix or ask a question, send me an email, but please be sure to check Frequently Asked Questions first. Any other comments you may have are also very welcome, e.g., on overall organization/style of the library, possible future functionality, etc..

Contribution Thanks to
SWIG/Python Bindings Stefanie T. of MIT, United States
Python Bindings with Example Ramiro C. of UNC, Argentina
SWIG/Ruby Bindings Brad E. of Madriska Media Group, United States
Notes on Matlab Interface under Windows Lu L. of TUM, Germany and Bruno H. of CMU, United States
Compiling with MS Visual Studio Derek K. of AFRL, United States
Using a 64-bit Machine Claus C. of Georgia Tech, United States
Misc. Minor Bug Fixes Generous people worldwide


VisiLibity uses the C++ double type. In this floating-point system, a discrete string of bits represents a number from the continuum of real numbers. One indicator of how precisely a floating point system can represent a real number is the machine epsilon (aka machine precision or unit roundoff) defined as the difference between 1 and the smallest exactly representable number greater than one. In the IEEE 754 Standard for Binary Floating-Point Arithmetic, machine epsilon for double precision on a 32-bit machine is 2^-52 (roughly 2.22x10^-16). Despite this small value, it is well known that the inexact nature of floating-point representation can lead to many problems, e.g.,

  • overflow, underflow, round-off error
  • divide by zero
  • complex values
  • loss of significance when subtracting nearly equal numbers
  • addition and multiplication are both commutative, but not necessarily associative
  • computational sequences that are analytically equal may produce different values
  • small errors can grow very large during an iterative process
  • evaluation of transcentental functions is approximate.
More details on problems associated with floating-point arithmetic can be found, e.g., in ``What Every Computer Scientist Should Know About Floating Point Arithmetic".

So why use floating-point arithmetic? As Chee K. Yap wrote in the ``Handbook of Discrete and Computational Geometry" (2nd Edition, p. 930),

`` floating-point hardware has become a de facto standard in every computer. If we can make our geometric algorithms robust within machine arithmetic, we are assured of the fastest possible implementation..."
To achieve robustness using floating-point arithmetic, VisiLibity operates using a technique called ε-geometry (AKA interval geometry) in which geometric primitives are fattened by very small amount ε. This involves the use of fuzzy comparisons in which equality tests such as x==y are replaced by fabs(x-y) ≤ ε. When using VisiLibity, ε should typically be chosen somewhere between machine epsilon and the smallest dimension of any feature in the environment geometry at hand.

The aglorithms and methods used in VisiLibity come mostly from these sources: VisiLibity.bib (BibTeX file)

VisiLibity R-1 was developed originally as part of research funded by NSF award 0626457 and ARO award W911NF-05-1-0219.


VisiLibity is licensed under version 3 of the GNU Lesser General Public License.

Here are some other software packages you may find useful, though none of these are officially associated with the VisiLibity project.

CGAL: Computational Geometry Algorithms Library
LEDA: Library of Efficient Data types and Algorithms; VISPAK: Visibility algorithms in LEDA
MSL: Motion Strategy Library
MPK: Motion Planning Kit
RRT/RRT* implementation in C
Generic Geometry Library (part of Boost)
Stony-Brook Algorithms Repository
DIR3: Delaunay Incremental Refinement in 3D
Goemetry Junkyard

Karl J. Obermeyer