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 {\displaystyle S} be a set of obstacles (either segments, or polygons) in R 2 {\displaystyle \mathbb {R} ^{2}} . Let p {\displaystyle p} be a point in R 2 {\displaystyle \mathbb {R} ^{2}} that is not within an obstacle. Then, the point visibility polygon V {\displaystyle V} is the set of points in R 2 {\displaystyle \mathbb {R} ^{2}} , such that for every point q {\displaystyle q} in V {\displaystyle V} , the segment p q {\displaystyle pq} does not intersect any obstacle in S {\displaystyle 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 P {\displaystyle {\mathcal {P}}} and a point p {\displaystyle p} , a linear time algorithm is optimal for computing the region in P {\displaystyle {\mathcal {P}}} that is visible from p {\displaystyle 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 P {\displaystyle {\mathcal {P}}} , processing the vertices in the order in which they appear, while maintaining a stack of vertices S = s 0 , s 1 , ⋯ , s t {\displaystyle {\mathcal {S}}=s_{0},s_{1},\cdots ,s_{t}} where s t {\displaystyle s_{t}} is the top of the stack. The stack constitutes the vertices encountered so far which are visible to p {\displaystyle p} . If, later during the execution of the algorithm, some new vertices are encountered that obscure part of S {\displaystyle {\mathcal {S}}} , then the obscured vertices in S {\displaystyle {\mathcal {S}}} will be popped from the stack. By the time the algorithm terminates, S {\displaystyle {\mathcal {S}}} 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 {\displaystyle h} holes and n {\displaystyle n} vertices in total, it can be shown that in the worst case, a Θ ( n + h log ⁡ h ) {\displaystyle \Theta (n+h\log 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

… excerpt ends here. Continue reading the full article.

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.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

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