Arrangements and Duality Motivation: Ray-Tracing 6.838 Fall 2001, Lecture 9 Presented by Darius Jazayeri 10/4/01.

Slides:



Advertisements
Similar presentations
VC Dimension – definition and impossibility result
Advertisements

Two Segments Intersect?
On Complexity, Sampling, and -Nets and -Samples. Range Spaces A range space is a pair, where is a ground set, it’s elements called points and is a family.
Efficient access to TIN Regular square grid TIN Efficient access to TIN Let q := (x, y) be a point. We want to estimate an elevation at a point q: 1. should.
Map Overlay Algorithm. Birch forest Wolves Map 1: Vegetation Map 2: Animals.
Approximations of points and polygonal chains
2/14/13CMPS 3120 Computational Geometry1 CMPS 3120: Computational Geometry Spring 2013 Planar Subdivisions and Point Location Carola Wenk Based on: Computational.
Applications of Euler’s Formula for Graphs Hannah Stevens.
Brute-Force Triangulation
2/3/15CMPS 3130/6130 Computational Geometry1 CMPS 3130/6130 Computational Geometry Spring 2015 Triangulations and Guarding Art Galleries II Carola Wenk.
I. The Problem of Molding Does a given object have a mold from which it can be removed? object not removable mold 1 object removable Assumptions The object.
Convex Hulls in Two Dimensions Definitions Basic algorithms Gift Wrapping (algorithm of Jarvis ) Graham scan Divide and conquer Convex Hull for line intersections.
By Groysman Maxim. Let S be a set of sites in the plane. Each point in the plane is influenced by each point of S. We would like to decompose the plane.
Overlay of Two Subdivisions
Convex Hulls in 3-space Jason C. Yang.
Incidences and Many Faces via cuttings Sivanne Goldfarb
Query Processing in Databases Dr. M. Gavrilova.  Introduction  I/O algorithms for large databases  Complex geometric operations in graphical querying.
17. Computational Geometry Chapter 7 Voronoi Diagrams.
2. Voronoi Diagram 2.1 Definiton Given a finite set S of points in the plane , each point X of  defines a subset S X of S consisting of the points of.
Lecture 12 : Special Case of Hidden-Line-Elimination Computational Geometry Prof. Dr. Th. Ottmann 1 Special Cases of the Hidden Line Elimination Problem.
UMass Lowell Computer Science Advanced Algorithms Computational Geometry Prof. Karen Daniels Spring, 2001 Lecture 4 Chapter 6: Arrangements Monday,
Duality and Arrangements Computational Geometry, WS 2007/08 Lecture 6 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät.
Mark Waitser Computational Geometry Seminar December Iterated Snap Rounding.
Lecture 8 : Arrangements and Duality Computational Geometry Prof. Dr. Th. Ottmann 1 Duality and Arrangements Duality between lines and points Computing.
Lecture 6: Point Location Computational Geometry Prof. Dr. Th. Ottmann 1 Point Location 1.Trapezoidal decomposition. 2.A search structure. 3.Randomized,
Duality and Arrangements Computational Geometry, WS 2006/07 Lecture 7 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät.
The Art Gallery Problem
Brute-Force Triangulation
Efficient Partition Trees Jiri Matousek Presented By Benny Schlesinger Omer Tavori 1.
Delaunay Triangulations Presented by Glenn Eguchi Computational Geometry October 11, 2001.
9/7/06CS 6463: AT Computational Geometry1 CS 6463: AT Computational Geometry Fall 2006 Triangulations and Guarding Art Galleries Carola Wenk.
COMP 175: Computer Graphics March 24, 2015
UNC Chapel Hill M. C. Lin Point Location Reading: Chapter 6 of the Textbook Driving Applications –Knowing Where You Are in GIS Related Applications –Triangulation.
Triangulating a monotone polygon
UNC Chapel Hill M. C. Lin Linear Programming Reading: Chapter 4 of the Textbook Driving Applications –Casting/Metal Molding –Collision Detection Randomized.
UNC Chapel Hill M. C. Lin Line Segment Intersection Chapter 2 of the Textbook Driving Applications –Map overlap problems –3D Polyhedral Morphing.
Line Arrangement Chapter 6. Line Arrangement Problem: Given a set L of n lines in the plane, compute their arrangement which is a planar subdivision.
RA PRESENTATION Sublinear Geometric Algorithms B 張譽馨 B 汪牧君 B 李元翔.
Center for Graphics and Geometric Computing, Technion 1 Computational Geometry Chapter 8 Arrangements and Duality.
Planar Subdivision Induced by planar embedding of a graph. Connected if the underlying graph is. edge vertex disconnected subdivision Complexity = #vertices.
Splitting a Face Point edge already split new vertex two new faces one new vertex six new half-edges.
Center for Graphics and Geometric Computing, Technion 1 Computational Geometry Chapter 8 Arrangements and Duality.
Arrangements and Duality Sanjay Sthapit Comp290 10/6/98.
CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.
1 / 41 Convex Hulls in 3-space Jason C. Yang. 2 / 41 Problem Statement Given P: set of n points in 3-space Return: –Convex hull of P: CH (P) –Smallest.
Robert Pless, CS 546: Computational Geometry Lecture #3 Last Time: Plane Sweep Algorithms, Segment Intersection, + (Element Uniqueness)
UNC Chapel Hill M. C. Lin Computing Voronoi Diagram For each site p i, compute the common inter- section of the half-planes h(p i, p j ) for i  j, using.
UNC Chapel Hill M. C. Lin Delaunay Triangulations Reading: Chapter 9 of the Textbook Driving Applications –Height Interpolation –Constrained Triangulation.
Arrangements and Duality Supersampling in Ray Tracing.
UMass Lowell Computer Science Advanced Algorithms Computational Geometry Prof. Karen Daniels Spring, 2010 O’Rourke Chapter 6 with some material.
9/8/10CS 6463: AT Computational Geometry1 CS 6463: AT Computational Geometry Fall 2010 Triangulations and Guarding Art Galleries Carola Wenk.
Center for Graphics and Geometric Computing, Technion 1 Computational Geometry Chapter 9 Line Arrangements.
An Introduction to Computational Geometry: Arrangements and Duality Joseph S. B. Mitchell Stony Brook University Some images from [O’Rourke, Computational.
Polygon Triangulation
Computational Geometry
Rasterization, or “What is glBegin(GL_LINES) really doing?” Course web page: February 23, 2012  Lecture 4.
Arrangements and Duality
CMPS 3130/6130 Computational Geometry Spring 2017
3. Polygon Triangulation
Computational Geometry
Query Processing in Databases Dr. M. Gavrilova
WINDOWING AND CLIPPING
The Art Gallery Problem
Computational Geometry 2
The Art Gallery Problem
Depth Estimation via Sampling
I. The Problem of Molding
WINDOWING AND CLIPPING
Computational Geometry
Overlay of Two Subdivisions
Presentation transcript:

Arrangements and Duality Motivation: Ray-Tracing Fall 2001, Lecture 9 Presented by Darius Jazayeri 10/4/01

Ray-Tracing Render a scene by shooting a ray from the viewer through each pixel in the scene, and determining what object it hits. Straight lines will have visible jaggies. We need to supersample

Supersampling We shoot many rays through each pixel and average the results. How should we distribute the rays over the pixel? Regularly? Distributing rays regularly isn’t such a good idea. Small per-pixel error, but regularity in error across rows and columns. (Human vision is sensitive to this.)

Sample Point Set (4x zoom)Rendered Half-Plane Wow…that really makes a difference!

Supersampling We need to choose our sample points in a somewhat random fashion. Finding the ideal distribution of n sample points in the pixel is a very difficult mathematical problem. Instead we’ll generate several random samplings and measure which one is best. How do we measure how good a distribution is?

Big Picture To ray-trace a pixel realistically, we need pick a good distribution of sample points in the pixel. We need to be able to determine how good a distribution of sample points is. How do we do this?

Discrepancy We want to calculate the discrepancy of a distribution of sample points relative to possible scenes. Assume all objects project onto our screen as polygons. We’re really only interested in the simplest case: more complex cases don’t exhibit regularity of error.

Discrepancy Pixel: Unit square U = [0:1] x [0:1] U 1 1

Discrepancy Pixel: Unit square U = [0:1] x [0:1] Scene: H = (infinite) set of all possible half- planes h. U h U

Discrepancy Pixel: Unit square U = [0:1] x [0:1] Scene: H = set of all possible half-planes h. Distribution of sample points: set S S

Discrepancy Pixel: Unit square U = [0:1] x [0:1] Scene: H = set of all possible half-planes h. Distribution of sample points: set S Continuous Measure:  (h) = area of h  U (h)(h)

Discrepancy Pixel: Unit square U = [0:1] x [0:1] Scene: H = set of all possible half-planes h. Distribution of sample points: set S Continuous Measure:  (h) = area of h  U Discrete Measure:  S (h) = card(S  h) / card(S)

Discrepancy Pixel: Unit square U = [0:1] x [0:1] Scene: H = set of all possible half-planes h. Distribution of sample points: set S Continuous Measure:  (h) = area of h  U Discrete Measure:  S (h) = card(S  h) / card(S) Discrepancy of h wrt S:  S (h) = |  (h) -  S (h) |

Discrepancy Pixel: Unit square U = [0:1] x [0:1] Scene: H = set of all possible half-planes h. Distribution of sample points: set S Continuous Measure:  (h) = area of h  U Discrete Measure:  S (h) = card(S  h) / card(S) Discrepancy of h wrt S:  S (h) = |  (h) -  S (h) | Half-plane discrepancy of S :

Big Picture We’ve defined the discrepancy of a chosen set of sample points with respect to all possible scenes as: We want to pick S to minimize  H (S)

Computing the Discrepancy There are an infinite number of possible half-planes…We can’t just loop over all of them.

Computing the Discrepancy There are an infinite number of possible half-planes…We can’t just loop over all of them. But…the half-plane of maximum discrepancy must pass through one of the sample points.

Computing the Discrepancy The half-plane of maximum discrepancy must pass through at least one sample point. It may pass through exactly one point –The maximum discrepancy must be at a local extremum of the continuous measure. –There are an infinite number of h through point p, but only O(1) of them are local extrema. –We can calculate the discrepancies of all n points vs O(1) h each, in O(n 2 ) time.

Computing the Discrepancy The half-plane of maximum discrepancy must pass through at least one sample point. It may pass through exactly one point Or it may pass through two points –There are O(n 2 ) possible point pairs. –We need some new techniques if we want to be able to compute the discrepancy in O(n 2 ) time.

Big Picture We’ve defined the discrepancy of a chosen set of sample points with respect to all possible scenes,  H (S). We want to pick S to minimize  H (S). We need a way to compute O(n 2 ) discrete measures to find values of  S (h). We want to do this in O(n 2 ) time.

New Concept: Duality The concept: we can map between different ways of interpreting 2D values. Points (x,y) can be mapped in a one-to-one manner to lines (slope,intercept) in a different space. There are different ways to do this, called duality transforms.

Duality Transforms A duality transform is a mapping which takes an element e in the primal plane to element e* in the dual plane. One possible duality transform: point p: (p x,p y )  line p*: y = p x x – p y line l: y = mx + b  point l*: (m, -b)

Duality Transforms This duality transform takes –points to lines, lines to points –line segments to double wedges This duality transform preserves order –Point p lies above line l  point l* lies above line p* p l p* l* 

Back to the Discrepancy problem To determine our discrete measure, we need to: Determine how many sample points lie below a given line (in the primal plane).

Back to the Discrepancy problem To determine our discrete measure, we need to: Determine how many sample points lie below a given line (in the primal plane). dualizes to Given a point in the dual plane we want to determine how many sample lines lie above it. Is this easier to compute?  

Duality The dualized version of a problem is no easier or harder to compute than the original problem. But the dualized version may be easier to think about.

New Concept: Arrangements of Lines L is a set of n lines in the plane. L induces a subdivision of the plane that consists of vertices, edges, and faces. This is called the arrangement induced by L, denoted A(L) The complexity of an arrangement is the total number of vertices, edges, and faces.

Arrangments Number of vertices of A(L)  –Vertices of A(L) are intersections of l i,l j  L Number of edges of A(L)  n 2 –Number of edges on a single line in A(L) is one more than number of vertices on that line. Number of faces of A(L)  Inductive reasoning: add lines one by one Each edge of new line splits a face.  Total complexity of an arrangement is O(n 2 )

How Do We Store an Arrangement? Data Type: doubly-connected edge-list (DCEL) –Vertex: Coordinates, Incident Edge –Face: an Edge –Half-Edges Origin Vertex Twin Edge Incident Face Next Edge, Prev Edge

Building the Arrangement Iterative algorithm: put one line in at a time. Start with the first edge e that l i intersects. Split that edge, and move to Twin(e)

ConstructArrangement Algorithm Input: A set L of n lines in the plane Output: DCEL for the subdivision induced by the part of A(L) inside a bounding box 1.Compute a bounding box B(L) that contains all vertices of A(L) in its interior 2.Construct the DCEL for the subdivision induced by B(L) 3. for i=1 to n do 4.Find the edge e on B(L) that contains the leftmost intersection point of l i and A i 5.f = the bounded face incident to e 6.while f is not the face outside B(L) do 7.Split f, and set f to be the next intersected face

ConstructArrangement Algorithm -Running Time- We need to insert n lines. Each line splits O(n) edges. We may need to traverse O(n) Next(e) pointers to find the next edge to split.

The zone of a line l in an arrangement A(L) is the set of faces of A(L) whose closure intersects l. Note how this relates to the complexity of inserting a line into a DCEL… Zones l

Zone Complexity The complexity of a zone is defined as the total complexity of all the faces it consists of, i.e. the sum of the number of edges and vertices of those faces. The time it takes to insert line l i into a DCEL is linear in the complexity of the zone of l i in A({l 1,…,l i-1 }).

Zone Theorem The complexity of the zone of a line in an arrangement of m lines on the plane is O(m) We can insert a line into an arrangement in linear time. We can build an arrangement in O(n 2 ) time.

Proof of Zone Theorem Given an arrangement of m lines, A(L), and a line l. Change coordinate system so l is the x-axis. Assume (for now) no horizontal lines l

Proof of Zone Theorem Each edge in the zone of l is a left bounding edge and a right bounding edge. Claim: number of left bounding edges  5m Same for number of right bounding edges  Total complexity of zone(l) is linear

Proof of Zone Theorem -Base Case- When m=1, this is trivially true. (1 left bounding edge  5)

Proof of Zone Theorem -Inductive Case- Assume true for all but the rightmost line l r : i.e. Zone of l in A(L-{l r }) has at most 5(m-1) left bounding edges Assuming no other line intersects l at the same point as l r, add l r

Proof of Zone Theorem -Inductive Case- Assume true for all but the rightmost line l r : i.e. Zone of l in A(L-{l r }) has at most 5(m-1) left bounding edges Assuming no other line intersects l at the same point as l r, add l r

Proof of Zone Theorem -Inductive Case- Assume true for all but the rightmost line l r : i.e. Zone of l in A(L-{l r }) has at most 5(m-1) left bounding edges Assuming no other line intersects l at the same point as l r, add l r –l r has one left bounding edge with l (+1) +1

Proof of Zone Theorem -Inductive Case- Assume true for all but the rightmost line l r : i.e. Zone of l in A(L-{l r }) has at most 5(m-1) left bounding edges Assuming no other line intersects l at the same point as l r, add l r –l r has one left bounding edge with l (+1) –l r splits at most two left bounding edges (+2) +1

Proof of Zone Theorem Loosening Assumptions What if l r intersects l at the same point as another line, l i does? –l r has two left bounding edges (+2) –l i is split into two left bounding edges (+1) –As in simpler case, l r splits two other left bounding edges (+2) +2 +1

Proof of Zone Theorem Loosening Assumptions What if l r intersects l at the same point as another line, l i does? (+5) What if >2 lines (l i, l j, …) intersect l at the same point? –Like above, but l i, l j, … are already split in two (+4) +2 +1

Proof of Zone Theorem -Loosening Assumptions- What if there are horizontal lines in L? A horizontal line introduces less complexity into A(L) than a non-horizontal line. Done proving the Zone Theorem

Back to Discrepancy (Again) For every line between two sample points, we want to determine how many sample points lie below that line. -or- For every vertex in the dual plane, we want to determine how many sample lines lie above it. We build the arrangement A(S*) and use that to determine, for each vertex, how many lines lie above it. Call this the level of a vertex.

Levels and Discrepancy For each line l in S* –Compute the level of the leftmost vertex. O(n) Check, for all other lines l i,whether l i is above that vertex –Walk along l from left to right to visit the other vertices on l, using the DCEL. Walk along l, maintaining the level as we go (by inspecting the edges incident to each vertex we encounter). – O(n) per line

What did we just do? Given the level of a vertex in the (dualized) arrangement, we can compute the discrete measure of S wrt the h that vertex corresponds to in O(1) time. We can compute all the interesting discrete measures in O(n 2 ) time. Thus we can compute all  S (h), and hence  H (S), in O(n 2 ) time.

Summary Problem regarding points S in ray-tracing Dualize to a problem of lines L. Compute arrangement of lines A(L). Compute level of each vertex in A(L). Use this to compute discrete measures in primal space. We can determine how good a distribution of sample points is in O(n 2 ) time.

Further Zone Theorem has an analog in higher dimensions –Zone of a hyperplane in an arrangement of n hyperplanes in d-dimensional space has complexity O(n d-1 ) There are other point-line dualities –