ArticleslgStudy

computer science

Visibility polygon

Visibility polygon is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Visibility polygon rather than just read about it. In short: In computational geometry, the visibility polygon or visibility region for a point p in the plane among obstacles is the possibly unbounded polygonal region of all points of the plane visible from p. The visibility polygon can also be defined for visibility from a segment, or a polygon.

Visibility polygon — main illustration
Visibility polygon — illustration

Key takeaways

  • Visibility polygon belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Visibility polygon to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Visibility polygon from memory before moving on to harder problems.

Reference excerpt

In computational geometry, the visibility polygon or visibility region for a point p in the plane among obstacles is the possibly unbounded polygonal region of all points of the plane visible from p. The visibility polygon can also be defined for visibility from a segment, or a polygon. Visibility polygons are useful in robotics, video games, and in various optimization problems such as the facility location problem and the art gallery problem. If the visibility region is bounded then it is a star-shaped polygon. A visibility polygon is bounded if all rays shooting from the point eventually terminate in some obstacle. This is the case, e.g., if the obstacles are the edges of a simple polygon and p is inside the polygon. In the latter case the visibility polygon may be found in linear time.

Definitions Formally, we can define the planar visibility polygon problem as such. Let S be a set of obstacles (either segments, or polygons) in ℝ2. Let p be a point in ℝ2 that is not within an obstacle. Then, the point visibility polygon V is the set of points in ℝ2, such that for every point q in V, the segment pq does not intersect any obstacle in S. Likewise, the segment visibility polygon or edge visibility polygon is the portion visible to any point along a line segment.

Applications Visibility polygons are useful in robotics. For example, in robot localization, a robot using sensors such as a lidar will detect obstacles that it can see, which is similar to a visibility polygon. They are also useful in video games, with numerous online tutorials explaining simple algorithms for implementing it.

Algorithms for point visibility polygons

Optimal algorithms for a point in a simple polygon

Given a simple polygon 𝒫 and a point p, a linear time algorithm is optimal for computing the region in 𝒫 that is visible from p. Such an algorithm was first proposed in 1981. However, it is quite complicated. In 1983, a conceptually simpler algorithm was proposed, which had a minor error that was corrected in 1987. The latter algorithm will be briefly explained here. It simply walks around the boundary of the polygon 𝒫, processing the vertices in the order in which they appear, while maintaining a stack of vertices 𝒮=s0,s1,⋯,st where st is the top of the stack. The stack constitutes the vertices encountered so far which are visible to p. If, later during the execution of the algorithm, some new vertices are encountered that obscure part of 𝒮, then the obscured vertices in 𝒮 will be popped from the stack. By the time the algorithm terminates, 𝒮 will consist of all the visible vertices, i.e. the desired visibility polygon. An efficient implementation was published in 2014.

Optimal algorithms for a point in a polygon with holes For a point in a polygon with h holes and n vertices in total, it can be shown that in the worst case, a Θ(n+hlog⁡h) algorithm is optimal. Such an algorithm was proposed in 1995 together with its proof of optimality. However, it relies on the linear time polygon triangulation algorithm by Chazelle, which is extremely complex.

Optimal algorithms for a point among segments

Segments that do not intersect except at their endpoints

For a point among a set of n segments that do not intersect except at their endpoints, it can be shown that in the worst case, a Θ(nlog⁡n) algorithm is optimal. This is because a visibility polygon algorithm must output the vertices of the visibility polygon in sorted order, hence the problem of sorting can be reduced to computing a visibility polygon. Notice that any algorithm that computes a visibility polygon for a point among segments can be used to compute a visibility polygon for all other kinds of polygonal obstacles, since any polygon can be decomposed into segments.

Divide and conquer A divide-and-conquer algorithm to compute the visibility polygon was proposed in 1987.

Angular sweep An angular sweep, i.e. rotational plane sweep algorithm to compute the visibility polygon was proposed in 1985 and 1986. The idea is to first sort all the segment endpoints by polar angle, and then iterate over them in that order. During the iteration, the event line is maintained as a heap. An efficient implementation was published in 2014.

Generally intersecting segments For a point among generally intersecting segments, the visibility polygon problem is reducible, in linear time, to the lower envelope problem. By the Davenport–Schinzel argument, the lower envelope in the worst case has Θ(nα(n)) number of vertices, where α(n) is the inverse Ackermann function. A worst case optimal divide-and-conquer algorithm running in Θ(nlog⁡n) time was created by John Hershberger in 1989.

References

External links http://web.informatik.uni-bonn.de/I/GeomLab/VisPolygon/index.html.en (visibility in simple polygons - applets)

Software VisiLibity: A free open source C++ library for visibility computations in planar polygonal environments. visibility-polygon-js: A public domain Javascript library for computing a visibility polygon for a point among segments using the angular sweep method.

Illustrations

Visibility polygon: Visibility polygon shown in yellow. Four obstacles are shown in blue.
Visibility polygon shown in yellow. Four obstacles are shown in blue.
Visibility polygon: A visibility polygon for a point in the center (shown in white) inside a simple polygon, outlined in black.
A visibility polygon for a point in the center (shown in white) inside a simple polygon, outlined in black.
Visibility polygon: A visibility polygon for a point in the center (shown in white) amongst a set of arbitrary line segments in the plane, allowed to intersect only at their endpoints, acting as obstacles (shown in black).
A visibility polygon for a point in the center (shown in white) amongst a set of arbitrary line segments in the plane, allowed to intersect only at their endpoints, acting as obstacles (shown in black).

Worked examples

Example 1 — a first encounter with Visibility polygon

Start with the simplest possible case. Write down what Visibility polygon claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Visibility polygon before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Visibility polygon ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Visibility polygon

In research
Visibility polygon appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Visibility polygon in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Visibility polygon is common in secondary-school and first-year university syllabi. It links to neighbouring topics Geometric algorithms, Polygons, so understanding it makes those chapters shorter.
In everyday life
Look for Visibility polygon outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Visibility polygon” →

How to study Visibility polygon in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Visibility polygon means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Visibility polygon out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Visibility polygon in simple terms?

In computational geometry, the visibility polygon or visibility region for a point p in the plane among obstacles is the possibly unbounded polygonal region of all points of the plane visible from p. The visibility polygon can also be defined for visibility from a segment, or a polygon.

Why does Visibility polygon matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Visibility polygon?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Visibility polygon.

Tags

  • Geometric algorithms
  • Polygons

Keep exploring