VisiLibity1 Frequently Asked Questions

I am getting computation errors. What should I do?

Programs may crash if (1) the robustness constant ε is chosen poorly, or (2) the environment model is not ε-valid (see answer to next question). Before reporting a bug, try varying ε by a few orders of magnitude in both directions or checking evironment ε-validity using the Environment::is_valid method. Note ε should never be set to 0.0 except when performing certain debugging procedures on the VisiLibity code itself. To start, try setting ε to a number a few orders of magnitude smaller than the smallest feature in the environment. For example, if the closest distance between any vertices is 0.01, try double epsilon = 0.0000001;. This means you must include an ε in all function calls, i.e., do not use the default argument ε=0.0. For example, you need to add ε at Visibility_Polygon(observer, environment, epsilon).

Will VisiLibity work for polygonal environments where the edges of distinct polygons intersect?

No, VisiLibity1 is not meant to operate on environments where edges of distinct polygons intersect. For correctness of computation, in addition to choosing suitable ε, the environment must be ε-valid. This can be checked using the Environment::is_valid() method. An environment is ε-valid if none of its outer boundary or holes intersect each other, there is a distance at least ε between any features (vertices and edges), and there can be no redundant vertices (e.g. don't list the first vertex redundantly also as the last) in the polygon vertex lists.

If your environment is not ε-valid and you want VisiLibity to work for your application, then you must perform preprocessing to enforce ε-validity. We may remove the ε-validity precondition in a future version of VisiLibity.

Should I cache a Visibility_Graph if I'm performing many shortest path queries in the same Environment?

Yes. Here's how:
// Define a small epsilon. This is very important, otherwise there are
// robustness/degeneracy problems.
double epsilon = 0.000000001;

// Construct environment.
VisiLibity::Environment environment(filename);

// Construct the visibility graph.
VisiLibity::Visibility_Graph visibility_graph(environment, epsilon);

// Make path queries.
Polyline path = environment.shortest_path(startpoint, endpoint, visibility_graph, epsilon);

I am unable to compile VisiLibity under Microsoft Windows. What should I do?

VisiLibity1 uses definitions which do not exist in the Microsoft Visual Studio compilers. To add these definitions, uncomment these lines in the header visilibity.hpp.
//Uncomment these lines when compiling under
//Microsoft Visual Studio
#define NAN std::numeric_limits<double>::quiet_NaN()
#define INFINITY std::numeric_limits<double>::infinity()
#define M_PI 3.141592653589793238462643
#define and &&
#define or ||

Alternatively, you could get a Gnu compiler working on your machine. Some helpful hints on getting a Gnu complier running on a Windows machine can be found under Notes on Matlab Interface under Windows.

How do I make VisiLibity work on a 64-bit machine?

To compile VisiLibity on a pure 64-bit system, add -fPIC to the CXXFLAGS in the makefile. Also, if Matlab does not link to the correct libraries, try changing the symlinks in /usr/local/MATLAB/R2010b/sys/os/glnxa64/ to the correct ones in /usr/lib/.