40 Pages

intersections

Course: CPS 124, Fall 2009
School: Duke
Rating:
 
 
 
 
 

Word Count: 1242

Document Preview

Tracing CS Ray 465 Lecture 3 Cornell CS465 Fall 2004 Lecture 3 2004 Steve Marschner 1 Ray tracing idea Cornell CS465 Fall 2004 Lecture 3 2004 Steve Marschner 2 Ray tracing algorithm for each pixel { compute viewing ray intersect ray with scene compute illumination at visible point put result into image } Cornell CS465 Fall 2004 Lecture 3 2004 Steve Marschner 3 Pinhole camera Box with a tiny hole...

Register Now

Unformatted Document Excerpt

Coursehero >> North Carolina >> Duke >> CPS 124

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
Tracing CS Ray 465 Lecture 3 Cornell CS465 Fall 2004 Lecture 3 2004 Steve Marschner 1 Ray tracing idea Cornell CS465 Fall 2004 Lecture 3 2004 Steve Marschner 2 Ray tracing algorithm for each pixel { compute viewing ray intersect ray with scene compute illumination at visible point put result into image } Cornell CS465 Fall 2004 Lecture 3 2004 Steve Marschner 3 Pinhole camera Box with a tiny hole Image is inverted Perfect image if hole innitely small Pure geometric optics based on similar triangles No depth of eld issue Cornell CS465 Fall 2004 Lecture 3 2004 Steve Marschner 4 Camera Obscura Cornell CS465 Fall 2004 Lecture 3 2004 Steve Marschner 5 Abelardo Morell Photographer who turns hotel room into a camera obscura (pinhole optics) Cornell CS465 Fall 2004 Lecture 3 2004 Steve Marschner 6 Durers Ray casting machine Albrecht Durer, 16th century Cornell CS465 Fall 2004 Lecture 3 2004 Steve Marschner 8 Durers Ray casting machine Albrecht Durer, 16th century Cornell CS465 Fall 2004 Lecture 3 2004 Steve Marschner 9 Plane projection in drawing Cornell CS465 Fall 2004 Lecture 3 [CS 417 Spring 2002] 2004 Steve Marschner 10 Plane projection in photography This is another model for what we are doing applies more directly in realistic rendering Cornell CS465 Fall 2004 Lecture 3 2004 Steve Marschner 11 [CS 417 Spring 2002] Simplied pinhole camera Eye-image pyramid (frustum) Note that the distance/size of image are arbitrary Cornell CS465 Fall 2004 Lecture 3 2004 Steve Marschner 12 Generating eye rays Use window analogy directly Cornell CS465 Fall 2004 Lecture 3 2004 Steve Marschner 13 Vector math review Vectors and points Vector operations addition scalar product More products dot product cross product Cornell CS465 Fall 2004 Lecture 3 2004 Steve Marschner 14 Ray: a half line Standard representation: point p and direction d this is a parametric equation for the line lets us directly generate the points on the line if we restrict to t > 0 then we have a ray note replacing d with ad doesnt change ray (a > 0) Cornell CS465 Fall 2004 Lecture 3 2004 Steve Marschner 15 Generating eye rays Just need to compute the view plane point q: we wont worry about the details for now Cornell CS465 Fall 2004 Lecture 3 2004 Steve Marschner 16 Sphere equation Sphere equation (implicit): Assume unit dimensions, centered at origin Cornell CS465 Fall 2004 Lecture 3 2004 Steve Marschner 17 Explicit vs. implicit? Sphere equation is implicit Solution of an equation Does not tell us how to generate a point on the sphere Tells us how to check that a point is on the sphere Ray equation is explicit Parametric How to generate points Harder to verify that a point is on the ray Cornell CS465 Fall 2004 Lecture 3 2004 Steve Marschner 18 Ray-sphere intersection: algebraic Condition 1: point is on ray Condition 2: point is on sphere assume unit sphere Substitute: this is a quadratic equation in t Cornell CS465 Fall 2004 Lecture 3 2004 Steve Marschner 19 Ray-sphere intersection: algebraic Solution for t by quadratic formula: simpler form holds when d is a unit vector but we wont assume this in practice (reason later) Ill use the unit-vector form to make the geometric interpretation Cornell CS465 Fall 2004 Lecture 3 2004 Steve Marschner 20 Ray-sphere intersection: algebraic Cornell CS465 Fall 2004 Lecture 3 2004 Steve Marschner 21 Ray-sphere intersection: geometric What geometric information is important? Inside/outside Closest point Direction Geometric considerations can help shortcut calculations easy reject O r D Cornell CS465 Fall 2004 Lecture 3 R 2004 Steve Marschner 22 Ray-sphere intersection: geometric Find if the rays origin is outside the sphere R2>r2 If inside, it intersects If on the sphere, it does not intersect (avoid degeneracy) O r D Cornell CS465 Fall 2004 Lecture 3 R 2004 Steve Marschner 23 Ray-sphere intersection: geometric Find if the rays origin is outside the sphere Find the closest point to the sphere center tP=RO.D If tP<0, no hit O r Cornell CS465 Fall 2004 Lecture 3 P tP D R 2004 Steve Marschner 24 Ray-sphere intersection: geometric Find if the rays origin is outside the sphere Find the closest point to the sphere center If tP<0, no hit Else nd squared distance d2 Pythagoras: if d2=R2-tP2 d2> r2 no hit O d Cornell CS465 Fall 2004 Lecture 3 r P tP D R 2004 Steve Marschner 25 Ray-sphere intersection: geometric Find if the rays origin is outside the sphere Find the closest point to the sphere center If tP<0, no hit Else nd squared distance d2 if d2 > r2 no hit If outside t = tP-t t2+d2=r2 If inside t = tP+t O d P Cornell CS465 Fall 2004 Lecture 3 r t t tP D R 2004 Steve Marschner 26 Ray-sphere intersection: geometric Cornell CS465 Fall 2004 Lecture 3 2004 Steve Marschner 27 Geometric vs. algebraic Algebraic was more simple (and more generic) Geometric is more efcient Timely tests In particular for outside and pointing away Cornell CS465 Fall 2004 Lecture 3 2004 Steve Marschner 28 Image so far With eye ray generation and sphere intersection Surface s = new Sphere((0.0, 0.0, 0.0), 1.0); for 0 <= iy < ny for 0 <= ix < nx { ray = camera.getRay(ix, iy); if (s.intersect(ray, 0, +inf) < +inf) image.set(ix, iy, white); } Cornell CS465 Fall 2004 Lecture 3 2004 Steve Marschner 29 Ray-plane intersection Condition 1: point is on ray Condition 2: point is on plane Condition 3: point is on the inside of all edges First solve 1&2 (rayplane intersection) substitute and solve for t: Cornell CS417 Spring 2003 Lecture 33 2003 Steve Marschner 30 Ray-triangle intersection In plane, triangle is the intersection of 3 half spaces Cornell CS417 Spring 2003 Lecture 33 2003 Steve Marschner 31 Inside-edge test Need outside vs. inside Reduce to clockwise vs. counterclockwise vector of edge to vector to x Use cross product to decide Cornell CS417 Spring 2003 Lecture 33 2003 Steve Marschner 32 Ray-triangle intersection Cornell CS417 Spring 2003 Lecture 33 2003 Steve Marschner 33 Intersection against many shapes The basic idea is: hit (ray, tMin, tMax) { tBest = +inf; hitSurface = null; for surface in surfaceList { t = surface.intersect(ray, tMin, tMax); if t < tBest { tBest = t; hitSurface = surface; } } return hitSurface, t; } this is linear in the number of shapes but there are sublinear methods (acceleration structures) Cornell CS465 Fall 2004 Lecture 3 2004 Steve Marschner 34 Image so far With eye ray generation and scene intersection Geometry g = new Sphere((0.0, 0.0, 0.0), 1.0); for 0 <= iy < ny for 0 <= ix < nx { ray = camera.getRay(ix, iy); c = scene.trace(ray, 0, +inf); image.set(ix, iy, c); } trace(ray, tMin, tMax) { surface, t = hit(ray, tMin, tMax); if (surface != null) return surface.color(); else return black; } Cornell CS465 Fall 2004 Lecture 3 2004 Steve Marsc...

Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Duke - CPS - 182
Table of Contents 1. Overview 2. Anonymity and You 2.1 Implications of being Anonymous Online 2.2 Legal Considerations 2.3 Ethical Considerations 2.4 Evaluation of Future Policy 3. Encryption 3.1. Asymmetric Encryption 3.2. Public/Private Key Impleme
Duke - CPS - 182
Censorship in China Part 1 Background and Research I. II. Introduction A. Topic Explore terms, reasons, consequences, procedures, etc. of censorship in China Company Policies explanation of company censorship policies A. Google 1. Abide by the law
Duke - CPS - 182
4/17/06MMORPG's - Virtual Economies Spilling into the Real WorldThe main purpose of this paper is to show that the virtual economies that appear in MMORPG's (Massive Multiplayer Online Role Playing Games) are real economies that can and should be
Duke - CPS - 100
Tools: Solve Computational ProblemsAlgorithmic techniques Brute-force/exhaustive, greedy algorithms, dynamic programming, divide-and-conquer, Programming techniques Recursion, memo-izing, compute-once/lookup, tables, Java techniques java.util
Duke - CPS - 100
Printed by Owen L. Astrachan Jan 30, 08 8:27ArrayListHash.javaPage 1/2Jan 30, 08 8:2775ArrayListHash.javaint bucketIndex = getHash(key); ArrayList&lt;Combo&gt; list = myTable.get(bucketIndex); if (list = null){ list = new ArrayList&lt;Combo&gt;(); myTa
Duke - CPS - 100
Burrows Wheeler Transform BWT efficiency Michael Burrows and David Wheeler in 1994, BWT By itself it is NOT a compression scheme Its used to preprocess data, or transform data, to make it more amenable to compression like Huffman Coding Huf
Duke - APR - 100
Burrows Wheeler Transform BWT efficiency Michael Burrows and David Wheeler in 1994, BWT By itself it is NOT a compression scheme Its used to preprocess data, or transform data, to make it more amenable to compression like Huffman Coding Huf
Duke - CPS - 100
APTs and structuring data/informationAPTs and Class/OO/Java tradeoffsIs an element in an array, Where is an element in an array? DIY: use a loop Use Collections, several options public boolean contains(String[] list, Tradeoffs?If you searc
Duke - JAN - 100
APTs and structuring data/informationAPTs and Class/OO/Java tradeoffsIs an element in an array, Where is an element in an array? DIY: use a loop Use Collections, several options public boolean contains(String[] list, Tradeoffs?If you searc
Duke - CPS - 100
What is Computer Science at Duke?Big Ideas in Computer ScienceWhat we tell you it is A bunch of courses useful in some majors What you want it to be or imagine it to be Independent study, new courses, interdepartmental major Mathematics i
Duke - APR - 100
What is Computer Science at Duke?Big Ideas in Computer ScienceWhat we tell you it is A bunch of courses useful in some majors What you want it to be or imagine it to be Independent study, new courses, interdepartmental major Mathematics i
Duke - CPS - 100
Pieces in GalaxyTripStart with[&quot;, &quot;2 3&quot;, &quot;1 4&quot;, &quot;, &quot;2 5&quot; .]Another piece in GalaxyTripSupposed we have found all the connected components, accounting for all the vertices and we have these sizes: 1, 3, 5Machine 1 depends on 2 and 3 What if
Duke - APR - 100
Pieces in GalaxyTripStart with[&quot;, &quot;2 3&quot;, &quot;1 4&quot;, &quot;, &quot;2 5&quot; .]Another piece in GalaxyTripSupposed we have found all the connected components, accounting for all the vertices and we have these sizes: 1, 3, 5Machine 1 depends on 2 and 3 What if
Duke - CPS - 018
Random Numbers Create a random number generator Random generator; Initialize it generator = new Random(); Generate Random Numbers from 0 to 8 x = generator.nextInt(9); How do you get random numbers from 1 to 10?
Duke - PS - 214
CPS 214: Computer Networks Distributed SystemsJanuary 23, 2007Problem Set 1Instructor: Prof. Bruce Maggs Computer Science Department, Duke UniversityThis problem set has four questions, each with several parts. Answer them as clearly and conci
Duke - PS - 214
CPS 214February 18, 2007Problem Set 2Instructor: Prof. Bruce Maggs Computer Science Department, Duke UniversityThis problem set has three questions. Answer them as clearly and concisely as possible. You may discuss ideas with others in the cla
Duke - CPS - 049
Discussion Report: The Database of IntentionsShivnath Babu Duke University shivnath@cs.duke.eduThis report summarizes the class discussion on &quot;The Database of Intentions&quot;. The assigned reading for this discussion was the first chapter of the book
Duke - CPS - 049
CPS 49S Google: The Computer Science Within and its Impact on Society - Spring 2008 Homework 2 Due date: Friday, Feb 29, 2008, 5.00 PM. Late submissions will not be accepted (unless there are documented excuses from the dean). Submission: You shou
Duke - CPS - 049
CPS 49S Google: The Computer Science Within and its Impact on Society - Spring 2008 Homework 1 Due date: Thursday, Jan 31, 2008, 1.00 PM (before class). Late submissions will not be accepted (unless there are documented excuses from the dean). Sub
Duke - CPS - 049
CPS 49S Google: The Computer Science Within and its Impact on Society - Spring 2008 Exercise 1Question 1 Compute the PageRank of the pages in Figure 1.Page BPage APage CPage DFigure 1: Link graph for Question 1Question 2 Compute the Pag
Duke - CPS - 049
1Chapter 1 Introduction to Program DesignChapter OverviewWhat is a computer program? What are the parts of a program? How are they put together? What kinds of questions does a program designer ask?In this chapter you will learn how a compu
Duke - CPS - 271
Why Neural Networks? Maybe we should make our computers more brain-like:Computers BrainsNeural NetworksCPS 271 Ron ParrComputational Units Storage Units Cycle Time Bandwidth Compute Power108 gates/CPU 1011 neurons 109 bits RAM 1012 bits HD 1
Duke - CPS - 210
Dynamic Voltage ScalingThe question: at what clock rate/voltage should the CPU run in the next scheduling interval? Voltage scalable processors StrongARM SA-2 (500mW at 600MHz; 40mW at 150MHz)(adjust clock based on past window, no process reorde
Duke - CPS - 100
ADTs and vectors, towards linked listslltvector is a class-based implementation of a lower-level data type called an array tvector grows dynamically (doubles in size as needed) when elements inserted with push_back tvector protects against bad
Duke - CPS - 110
I/O Caching and Page ReplacementMemory/Storage Hierarchy 101Very fast 1ns clock Multiple Instructions per cycle&quot;CPU-DRAM gap&quot; memory system architecture (CPS 104) volatile &quot;I/O bottleneck&quot; VM and file caching (CPS 110)P $ SRAM, Fast, Small Expe
Duke - CPS - 271
The Problem Learning Probability DistributionsCPS 271 Ron Parr Observe a sequence of events Predict the probability of future events based upon observations Classical statistical problem Surprisingly subtle issues ariseEvent Spaces We first c
Duke - CPS - 108
Inheritance (language independent)qFirst view: exploit common interfaces in programming Iterator and Comparable in Java, see List/ArrayList/Vector Iterators in STL/C+ share interface by convention/templatesImplementation varies while interfac
Duke - CPS - 210
Tricks (mixed syntax)if (some_condition) / as a hint { LOCK m DO if (some_condition) /the truth {stuff} END Cheap to get info but must check for } correctness; always a slow wayMore TricksGeneral pattern:while (! required_conditions) wait (m, c)
Duke - CPS - 108
Software frameworks/cadaversExperience with OO programming and design shows that design patterns are useful Where do we get the experience? How do we impart experience? What can we use to illustrate patterns in practice? What patterns should we em
Duke - CPS - 210
Power-Aware Ad Hoc RoutingMobicom98 paper Power-Aware Routing in Ad Hoc Networks by Singh, Woo, and Raghavendra What is ad hoc routing? Routing through cooperating wireless nodes that may be mobile (topology changing). Goal: reduce the energy cons
Duke - CPS - 189
Thomas Finley An Empirical Study of Novice Program Comprehension in the Imperative and ObjectOriented Styles by Vennila Ramalingam and Susan Wiedenbeck The title says it all, does it not? The authors sought to determine what differences in comprehens
Duke - CPS - 100
Searching, Maps, HashingqSearching is a very important programming application Consider google.com and other search engines In general we search a collection for a key Vector/List, Tree: O(n) and O(log n) If we compare keys when searching we c
Duke - CPS - 100
Intersection, Union, MultisetsFinding the intersection of two sets requires examining all the elements of one set and determining if these are in the other How can we examine all the elements of a MultiSet? What mechanism exists for accessing ind
Duke - CPS - 100
What is Computer Science?What is it that distinguishes it from the separate subjects with which it is related? What is the linking thread which gathers these disparate branches into a single discipline? My answer to these questions is simple - it is
Duke - CPS - 100
Backtracking, Search, HeuristicsqMany problems require an approach similar to solving a maze Certain mazes can be solved using the &quot;right-hand&quot; rule Other mazes, e.g., with islands, require another approach If you have &quot;markers&quot;, leave them at
Duke - CPS - 100
Review of Data StructuresqWeve studied concrete data structures Vectors Homogeneous aggregates supporting random access Linked lists Collections supporting constant-time insertionTrees Combine efficiency of search/insert from vector/linke
Duke - CPS - 110
COMPSCI 110 Operating Systems Who - Introductions How - Policies and Administrative Details Why - Objectives and Expectations What - Our Topic: Operating SystemsHow COMPSCI 110 will work Its all explained on the webhttp:/www.cs.duke.edu/educa
Duke - CPS - 100
Intersection, Union, MultisetsAnatomy of IntersectionFinding the intersection of two sets requires examining all the elements of one set and determining if these are in the other How can we examine all the elements of a MultiSet? What mechanis
Duke - CPS - 100
Name: HW 1 - Linked Lists Instructions: This HW is due in-class on Oct. 16. Turn in your work stapled and with your name on every page. This assignment is worth 100 points. You should work on your own, but you can use books/notes. You should not use
Duke - CPS - 100
CPS 100E - Program Design and Analysis I Prof. Rodger Section: 2-3 Trees handout2-3 Treesleaf nodes contain data item all leaves on same level nonleaf node has 2 or 3 children two search values largest item in left subtree largest item in middle s
Duke - CPS - 100
CPS 100E - Program Design and Analysis I Prof. Rodger Section: Trees handout Read Chap 6.5-6.6, Chap 17. We will not use the class implementation of trees in the book, but you should read about them. General Tree set of nodes vertices set of edges no
Duke - CPS - 100
CPS 100E - Program Design and Analysis I Prof. Rodger Section: Red Black Trees handoutRed-Black TreeBinary search tree properties every node is red or black every leaf is a NULL node and black the root is black If node is red, then its children ar
Duke - CPS - 100
The PlanGraphical User Interfaces GUIs Components Flat Layouts Hierarchical Layouts Designing a GUI Coding a GUIGUI.1GUI.2Components JLabel text/image display JTextField single line for text input/output JTextArea multiple lines for te
Duke - CPS - 100
Java: Base Types All information has a type or class designation Built-in TypesCalled : primitive types or base types boolean, char, bye, short, int, long, float, double Primarily use: int, double, booleanNeed to declare before using; defined
Duke - CPS - 100
On the Limits of ComputingExistence of Noncomputable FunctionsReasons for Failure1.Approach Matching up Programs and Functions E.g., assume 3 functions, only 2 programs Without details, conclude one function has no programRuns too long
Duke - CPS - 100
Intro to SortingSelection Sorting Example Sorting &quot;Ideal&quot; Computer Science Topic Theory and Practice meet Efficient Sorting Saves MoneyFirst look at some simple (quick and dirty?) algorithms Selection Sort1. 2. 3. Find smalle
Duke - CPS - 100
Creating HeapsArray-based heap Heap is an array-based implementation of a binary tree used for implementing priority queues, supports:insert, findmin, deletemin: complexities?store &quot;node values&quot; in array beginning at index 1 for node with
Duke - CPS - 100
Binary TreesFrom doubly-linked lists to binary treesLinked lists: efficient insertion/deletion, inefficient search ArrayList: search can be efficient, insertion/deletion not Binary trees: efficient insertion, deletion, and search trees used i
Duke - CPS - 100
Big Oh Again AgainRecognizing Common Recurrences Have taken the attitude that mostly you can look things up Now need to be able to do your own derivations Extend our menu of solutions to common recurrence Lets look at previously shown tableBe
Duke - CPS - 100
Searching, Maps,Tries (hashing)From Google to MapsSearching is a fundamentally important operation We want to search quickly, very very quickly Consider searching using Google, ACES, issues? In general we want to search in a collection for
Duke - CPS - 100
Intro to GraphsDefinitions and VocabularyA graph consists of a set of vertices (or nodes) and a set of edges (or arcs) where each edge connects a pair of vertices. If the pair of vertices defining an edge is ordered, then it is a directed graph.
Duke - CPS - 100
Data CompressionCompression is a high-profile application.zip, .mp3, .jpg, .gif, .gz, What property of MP3 was a significant factor in what made Napster work (why did Napster ultimately fail?)Why do we care?Secondary storage capacity double
Duke - CPS - 100
Searching, Maps,Tries (hashing)Searching is a fundamentally important operationWe want to search quickly, very very quickly Consider searching using Google, ACES, issues? In general we want to search in a collection for a keyWe've searched us
Duke - CPS - 100
Memory ModelCost of Disk I/OFor this course: Assume Uniform Access Time All elements in an array accessible with same time cost Reality is somewhat different Registers On (cpu) chip cache memory Off chip cache memory Main memory Virtual memo
Duke - CPS - 100
Inheritance and Interfaces Single inheritance in JavaInheritance models an &quot;is-a&quot; relationshipA class can extend only one class in Java A dog is a mammal, an ArrayList is a List, a square is a shape, Write general programs to understand
Duke - CPS - 100
Inheritance and Interfaces Inheritance models an &quot;is-a&quot; relationshipA dog is a mammal, an ArrayList is a List, a square is a shape, Write general programs to understand the abstraction, advantages?void doShape(Shape s) { System.out.println(s.a
Duke - CPS - 100
Other N log N SortsBinary Tree SortBasic Recipe o Insert into binary search tree (BST) o Do Inorder Traversal Complexity o Create: O(N log N) o Traversal O(N) Not usually used for sorting unless you need BST for other reasonsCompSci 100E28.1
Duke - CPS - 100
Java: Base Types Java: Operators for Base TypesAll information has a type or class designation Built-in TypesCalled : primitive types or base types boolean, char, bye, short, int, long, float, double Primarily use: int, double, booleanFami
Duke - CPS - 100
Java Basics Arrays!Java Basics Arrays!Should be a very familiar idea&quot;!Problem: Deal with exam grades in a course o!Could have variable for each student o!Would need unique name for each variable o!Need lots of custom code o!Instead, assume
Duke - CPS - 100
Dropping Glass BallsTower with N Floors ! Given 2 glass balls ! Want to determine the lowest floor from which a ball can be dropped and will break ! How?!Glass balls revisited (more balls)! !1.! 2.! 3.! 4.! 5.! 6.! 7.! 8.! 9.! 10.!What is th
Duke - CPS - 100
Data CompressionYear Scheme 1967 ASCII 1950 Huffman 1977 Lempel-Ziv (LZ77) 1984 Lempel-Ziv-Welch (LZW) Unix compress 1987 (LZH) used by zip and unzip 1987 Move-to-front 1987 gzip 1995 Burrows-Wheeler 1997 BOA (statistical data compression)CompSci