Arrangements and Duality סידור נקודות ודואליות חסן דרויש ולאא מוסמאר
Super-sampling in Ray Tracing - Intro Computer generated images of 3-dimensional scenes: Looks more realistic. Can’t distinguish from photographs. How the screen of the computer monitor determine visible objects? In case there are several objects which is visible at that pixel? Now a days when technology advancing so fast that 3d computer generated images look so real and one can’t distinguish from real photographs pops up the questions (first one) and the second one.
Super-sampling in Ray Tracing –Intro Determining the visible object at each pixel: In ray tracing method we shoot a ray through each pixel. The first object being hit is the one that is visible at the current pixel. Simple idea to determine the visible object at each pixel is to use ray tracing method at each pixel, this is the first approach and intuitive way to do this, we will explain more after the next slide
Super-sampling in Ray Tracing – A problem PIXEL ?! Pixel isn’t a point, but a small square area
Super-sampling in Ray Tracing – Pixel problem Generally most pixels are covered completely by an object. Shooting a ray through the pixel center will identify the object. What if an edge of an object only covers part of this pixel ?!
Super-sampling in Ray Tracing – Pixel solution Shooting more than one ray through one pixel Example: Shooting 100 rays per pixel. If only 35 rays hits an object in this pixel. Then the object only covers 35% of this pixel. This is called supersampling: instead of taking one sample per point or pixel, we take many.
Super-sampling in Ray Tracing How can we distribute the shoot rays over the pixel to make this work efficiently? Obvious choice: Regular distribution! But there is a disadvantage to choosing a regular sample pattern: “although the error at each particular pixel will be small, there will be a certain regularity across rows (and columns) of pixels. Regularity in the errors triggers the human visual system, and as a result we see annoying artifacts.” Computational Geometry – algorithm and applications. Talk about the error.
Super-sampling in Ray Tracing Since regular sample pattern isn’t an optimal idea. It would be better if choose the sample points randomly! not every random sampling pattern is an optimal. At the end define the discrepancy of the sample set with respect to the object
Super-sampling in Ray Tracing Sample point set rendered half plane 4x zoom
Discrepancy – אי התאמה The difference between the percentage of hits for an object and the percentage of the pixel area where that object is visible, is small. The last mentioned difference is called the discrepancy of the sample set with respect to the object. Since we can’t know which object is visible in the pixel. Let’s be prepared for the worst-case scenario. (how?!) By requiring the maximum discrepancy over all the possible ways that an object can be visible inside the pixel to be small. That depends on the type of objects in the scene.
Computing Discrepancy Let U := [0 : 1]×[0 : 1] be the unit square—U models a pixel. U 1
Computing Discrepancy Let U := [0 : 1]×[0 : 1] be the unit square—U models a pixel. Let H denote the (infinite) set of all possible closed half-planes. h A
Computing Discrepancy Let U := [0 : 1]×[0 : 1] be the unit square—U models a pixel. Let H denote the (infinite) set of all possible closed half-planes. Let S be a set of n sample points in U. S
Computing Discrepancy Let U := [0 : 1]×[0 : 1] be the unit square—U models a pixel. Let H denote the (infinite) set of all possible closed half-planes. Let S be a set of n sample points in U. We denote The continuous measure by μ(h) where a half-plane h ∈ H is defined as the area of h∩U. m(h)
Computing Discrepancy Let U := [0 : 1]×[0 : 1] be the unit square—U models a pixel. Let H denote the (infinite) set of all possible closed half-planes. Let S be a set of n sample points in U. We denote The continuous measure by μ(h) where a half-plane h ∈ H is defined as the area of h∩U. The discrete measure of h, which we denote as μS(h), is defined as the fraction of the sample points that is contained in h, so μS(h) := card(S∩h)/card(S), where card(・) denotes the cardinality of a set.
Computing Discrepancy ΔS(h) is the discrepancy of h with respect to the sample set S. ΔS(h) := the absolute difference between the continuous and the discrete measure. ΔS(h) := |μ(h)−μS(h)|. Still we need to calculate the half-plane discrepancy of S, which defined as the supremum of discrepancies over all possible half-planes: mS(h) m(h) We shall not explain how exactly to calculate it but we will give the running time of the algorithm, for 1 line crossing one point and two points. ( no enough time to do so) The supremum of the discrepancy over all closed half-planes equals the maximum discrepancy over all open or closed half-planes
Computing Discrepancy Problem: there are infinite possible half-planes. “Lemma”: the line L that bounds the half-plane that generates the maximum discrepancy with respect to S. it’s either passes at least two points of S or passes through one point of S, and this point is the midpoint of the line segment between the L∩U. Not the original lemma, but an intuitive one.
Computing Discrepancy – Line passes through one point The line could pass through exactly one point. The local extremum in the continuous measure function is (in) the local maximum. There are infinite half-planes, which has a boundary line passes through one point P, but O(1) of these could achieve a local maximum by rotating. The number of candidates (half-planes) is O(n), and they can be found in O(n) time for each of the O(n) half-planes we compute their continuous measure in constant time, and their discrete measure in O(n) time. This way the maximum of the discrepancies of these half-planes can be computed in O( 𝑛 2 ) time.
Computing Discrepancy – Line passes through two points There are O( 𝑛 2 ) possibilities to find a pair of points. thus we need new techniques to compute all discrete measures in O( 𝑛 2 ) time. The goal is to prove this theorem: The half-plane discrepancy of a set S of n points in the unit square can be computed in O( 𝑛 2 ) time.
Duality - Definitions A point in the plane has two parameters: its x-coordinate and its y-coordinate. (x,y) A (non-vertical) line in the plane also has two parameters: its slope and its intersection with the y-axis. (y = mx + b) Mapping a set of points to a set of lines, and vice versa, in a one-to-one manner. We can do this mapping in several duality transforms. For instance, three points on a line become three lines through a point.
Duality - Definitions Duality transforms are several different mappings that translate certain properties of the set of points to certain other properties for the set of lines. The image of an object under a duality transform is called the dual of the object. p∗: y = pxx − py L : y = mx+b Let p := (px, py) be a point in the plane. The dual of p, denoted p∗, is the line defined as p∗ := (y = pxx− py). The dual of a line : y = mx+b is the point p such that p∗ = . In other words, L∗ := (m,−b). The duality transform is not defined for vertical lines. In most cases vertical lines can be handled separately, so this is not a problem. Another solution is to rotate the scene so that there are no vertical lines. L∗ := (m,−b) p := (px, py)
Duality The duality transform maps objects from the primal plane to the dual plane. Certain properties that hold in the primal plane also hold in the dual plane: Let p be a point in the plane and let L be a non-vertical line in the plane. The duality transform o → o∗ has the following properties. It is incidence preserving: p ∈ L if and only if L∗ ∈ p∗. It is order preserving: p lies above L if and only if L∗ lies above p∗. This way we can know what’s the discrete measures
Duality – back to the main problem Given a set S of n points, we need to compute the discrete measure of every half-plane bounded by a line through two of the points. We are going to show an algorithm using arrangement of lines that does that in O( 𝑛 2 ) time. Given a set S of n points, compute the discrete measure of every half-plane bounded by a line through two of the points. When we dualize the set S of points we get a set S∗ := {p∗ : p ∈ S} of lines. Let (p,q) denote the line through two points p,q ∈ S. The dual of this line is the intersection point of the two lines p∗,q∗ ∈ S∗. Consider the open half-plane bounded by and below (p,q). The discrete measure of this half-plane is the number of points strictly below (p,q). This means that in the dual plane we are interested in the number of lines strictly above (p,q)∗. For the closed half-plane below (p,q) we must also take the lines through (p,q)∗ into account. Similarly, for the half-plane bounded by and above (p,q) we are interested in the number of lines below (p,q)∗. In the next section we study sets of lines, and we give an efficient algorithm to compute the number of lines above every intersection point, through every intersection point, and below every intersection point. When we apply this algorithm to S∗ we get all the information we need to compute the discrete. (from the book page 179)
Arrangement of Lines Let L be a set of n lines in the plane. The set L induces a subdivision of the plane that consists of vertices, edges, and faces. This subdivision is usually referred to as the arrangement induced by L, and it is denoted by A(L). An arrangement is called simple if no three lines pass through the same point and no two lines are parallel. The (combinatorial) complexity of an arrangement is the total number of vertices, edges, and faces of the arrangement. Some of the edges and faces are unbounded.
Arrangement of Lines Theorem: Let L be a set of n lines in the plane, and let A(L) be the arrangement induced by L. The number of vertices of A(L) is at most n(n−1)/2. The number of edges of A(L) is at most 𝑛 2 . The number of faces of A(L) is at most 𝑛 2 /2 + n/2 + 1. Equality holds in these three statements if and only if A(L) is simple. The complexity of this arrangement takes O( 𝑛 2 ) . Arrangements of lines and their higher dimensional counterparts occur frequently in computational geometry. Often a problem that is defined on a set of points is dualized and turned into a problem on arrangements. This is done because the structure of a line arrangement is more apparent than the structure of a point set. A line through a pair of points in the primal plane, for instance, becomes a vertex in the dual arrangement—a much more explicit feature. The extra structure in an arrangement does not come for free: constructing a full arrangement is a time- and storage-consuming task, because the combinatorial complexity of an arrangement is high.
Arrangement of Lines – Using DCEL We’re going to show that we can arrange the lines and build DCEL in O( 𝑛 2 ) time! Let’s explain the data structure for the arrangement and the algorithm (using DCEL)
Arrangement of Lines – Using DCEL An incremental construction algorithm. A bounding box B(L) that contains all vertices of A(L) in its interior . compute all intersection points of pairs of lines, and choose the leftmost one, the rightmost one, the bottom one, and the top one. An axis-parallel rectangle that contains these four points contains all vertices of the arrangement. Simple traversing on the number of intersection points is quadratic, the algorithm would run in O(n2 logn) time. Not bad, but not optimal. So let’s try another approach that may come to mind: an incremental construction algorithm. A bounding box B(L) that contains all vertices of A(L) in its interior can easily be computed in quadratic time: compute all intersection points of pairs of lines, and choose the leftmost one, the rightmost one, the bottom one, and the top one. An axis-parallel rectangle that contains these four points contains all vertices of the arrangement.
Arrangement of Lines – Using DCEL The algorithm adds n lines one after the other and updates the doubly-connected edge List after each addition. Let Ai be the subdivision of the plane induced by the bounding box B(L) and the part of A({1, . . . , i}) inside B(L). The incremental algorithm adds the lines 1,2, . . . , n one after the other and updates the doubly-connected edge list after each addition. Let Ai denote the subdivision of the plane induced by the bounding box B(L) and the part of A({1, . . . , i}) inside B(L).
Arrangement of Lines – Using DCEL (adding Lines) We split the faces in Ai−1 which intersected with line Li. Finding these faces can be done easily through walking along Li from left to right.
Arrangement of Lines - Zones The zone of a line L in the arrangement A(L) induced by a set L of lines in the plane is the set of faces of A(L) whose closure intersects L. The complexity of a zone is defined as the total complexity of all faces it consists of, that is, the sum of the number of edges and vertices of these faces. The time needed to insert a line Li is linear in the complexity of the zone of Li in A({L1, . . . , Li}). The complexity of a zone is defined as the total complexity of all faces it consists of, that is, the sum of the number of edges and vertices of these faces. The Zone Theorem tells us that this quantity is linear
Arrangement of Lines – Zone Theorem Zone Theorem: The complexity of the zone of a line in an arrangement of m lines in the plane is O(m). We have seen that the time needed to insert Li is linear in the complexity of the zone of Li in A({L1, . . . , Li−1}). By the Zone Theorem this is O(Li), so the time required to insert all lines is 𝑂( 𝑛 2 )= 𝑘=1 𝑛 𝑂(𝑘)
Levels and Discrepancy What we’ve done yet?! Dualized the set S of n sample points into a set S∗ of n lines. And we needed to compute for every vertex of A(S∗) how many lines lie above it, pass through it, and lie below it. Level of a point in an arrangement of lines is the number of lines strictly above it. For each vertex, these three numbers add up to exactly n, so it is sufficient to compute two of the numbers. After we have constructed a doubly-connected edge list for A(S∗) we know how many lines pass through each vertex. We define the level of a point in an arrangement of lines to be the number of lines strictly above it. We next show how to compute the level of each vertex in A(S∗).
Levels and Discrepancy – computing levels We compute the level of the leftmost vertex on L in O(n). (how?) We walk along L from left to right to visit the other vertices on L. (how?) 1. by checking for each of the remaining lines whether it lies strictly above that vertex. 2. using the doubly-connected edge list. It is easy to maintain the level while we walk: the level only changes at a vertex, and the change can be computed by inspecting the edges incident to the vertex that is encountered. More explanation in page 186, need to explained by details in class
Levels and Discrepancy - Summary The time needed to compute the levels of the vertices on L is O(n). Levels of all vertices of A(S∗) can be computed in 𝑂( 𝑛 2 ) time. The number of lines goes around and through each vertex of A(S*) gives us all the information we need to solve our main problem. Discrete measures can be computed in 𝑂( 𝑛 2 ) time.
Summary - Applications Ham Sandwich Cut. Maximum Stabbing Line. Hough transform.
Bibliography Mark de Berg, Otfried Cheiong, Marc van Kreveld, Mark Overmars. Computational Geometry- 3rd edition, 1998,Chapter 8. David Mount, Computational geometry. The Big Brother = GOOGLE!
Thanks for paying attention