Ray Polygon Interception: Cyrus Beck Algorithm Mengxia Zhu Fall 2007.

Slides:



Advertisements
Similar presentations
Rezanje črt in poligonov. World window & viewport window viewport screen window world window.
Advertisements

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam September 30, D Clipping 1/14 Clipping (pages , )
Vector Calculus Mengxia Zhu Fall Objective Review vector arithmetic Distinguish points and vectors Relate geometric concepts to their algebraic.
CSE 681 Bounding Volumes. CSE 681 Bounding Volumes Use simple volume enclose object(s) tradeoff for rays where there is extra intersection test for object.
Geometry Primer Lines and rays Planes Spheres Frustums Triangles Polygon Polyhedron.
10/10/02 (c) 2002 University of Wisconsin, CS 559 Last Time Finished viewing: Now you know how to: –Define a region of space that you wish to view – the.
CHAPTER 12 Height Maps, Hidden Surface Removal, Clipping and Level of Detail Algorithms © 2008 Cengage Learning EMEA.
CS 551 / 645: Introductory Computer Graphics Clipping Lines and Polygons.
CS 445 / 645 Introduction to Computer Graphics Lecture 9 Clipping Clipping.
Computer Graphics, KKU. Lecture 81 Clipping on a Raster Display.
David Breen, William Regli and Maxim Peysakhov
1 Clipping. 2 Transformation Sequence X Y Z X Y Z X Y Z X Y Z Object Coords. Eye Coords. Clip Coords. Normalized Device Coords. Screen Coords. Implementation:
Two-Dimensional Viewing Jehee Lee Seoul National University.
Clipping CSE 403 Computer Graphics Cohen Sutherland Algorithm (Line)
March 1, 2009Dr. Muhammed Al-Mulhem1 ICS 415 Computer Graphics Clipping Dr. Muhammed Al-Mulhem March 1, 2009 Dr. Muhammed Al-Mulhem March 1, 2009.
Advanced Topics in Algorithms and Data Structures Lecture 7.1, page 1 An overview of lecture 7 An optimal parallel algorithm for the 2D convex hull problem,
Chi-Cheng Lin, Winona State University CS430 Computer Graphics Vectors Part IV Polygon Intersection.

Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
Computer Graphics using OpenGL, 3 rd Edition F. S. Hill, Jr. and S. Kelley Chapter Vector Tools for Graphics S. M. Lea University of North Carolina.
Informationsteknologi Thursday, November 22, 2007Computer Graphics - Class 111 Today’s class Clipping Parametric and point-normal form of lines Intersecting.
Vertices and Fragments I CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Computer Graphics - Class 14
Visibility culling – Clipping. The visibility problem What polygons are visible? There are few visible polygons. –Avoid redundant processing Three classes.
Graphics Pipeline Clipping CMSC 435/634. Graphics Pipeline Object-order approach to rendering Sequence of operations – Vertex processing – Transforms.
Week 13 - Wednesday CS361.
CSE53111 Computational Geometry TOPICS q Preliminaries q Point in a Polygon q Polygon Construction q Convex Hulls Further Reading.
Vector Exercise. Parametric form for a line Passing two points.
Mathematical fundamentals of 3D computer graphics 1.1 Manipulating three-dimensional structures 1.2 Vectors and computer graphics 1.3 Rays and computer.
2-Dimension Viewing and Clipping
Clipping Apart from clipping to the view volume, clipping is a basic operation in many other algorithms –Breaking space up into chunks –2D drawing and.
2003CS Hons RW778 Graphics1 Chapter 4: Vector Tools 4.5 Representation of Key Geometric Objects 4.5 Representation of Key Geometric Objects –4.5.1 Coordinate.
Introduction to 3D Graphics Lecture 4: Scenes and Scene Graphs Anthony Steed University College London.
COMP 175: Computer Graphics March 24, 2015
Modeling Shapes with Polygonal Meshes. 3D Modeling Polygonal meshes capture the shape of complex 3D objects in simple data structures.
CS 325 Introduction to Computer Graphics 03 / 08 / 2010 Instructor: Michael Eckmann.
1 Ray Tracing Polyhedra ©Anthony Steed
Vertex – A point at which two or more edges meet Edge – A line segment at which two faces intersect Face – A flat surface Vertices, Edges, Faces.
Collision handling: detection and response
Part 6: Graphics Output Primitives (4) 1.  Another useful construct,besides points, straight line segments, and curves for describing components of a.
UNC Chapel Hill M. C. Lin Linear Programming Reading: Chapter 4 of the Textbook Driving Applications –Casting/Metal Molding –Collision Detection Randomized.
Clipping Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006 (Slide set originally by David Luebke)
Visible-Surface Detection Jehee Lee Seoul National University.
1 CS 430/536 Computer Graphics I Curve Drawing Algorithms Week 4, Lecture 8 David Breen, William Regli and Maxim Peysakhov Geometric and Intelligent Computing.
Computer Graphics Chapter 6 Andreas Savva. 2 Interactive Graphics Graphics provides one of the most natural means of communicating with a computer. Interactive.
12.1 – Explore Solids.
1 Dr. Scott Schaefer Intersecting Simple Surfaces.
Basic Ray Tracing CMSC 435/634.
CS 325 Introduction to Computer Graphics 03 / 29 / 2010 Instructor: Michael Eckmann.
Vertices, Edges and Faces By Jordan Diamond. Vertices In geometry, a vertices is a special kind of point which describes the corners or intersections.
10/19/04© University of Wisconsin, CS559 Fall 2004 Last Time Clipping –Why we care –Sutherland-Hodgman –Cohen-Sutherland –Intuition for Liang-Barsky Homework.
In the name of God Computer Graphics Bastanfard. Curve Function(2) Other method is approximate it using a poly-line. Just locate a set of points along.
3D Object Representations 2011, Fall. Introduction What is CG?  Imaging : Representing 2D images  Modeling : Representing 3D objects  Rendering : Constructing.
Computer Graphics I, Fall 2010 Implementation II.
Chi-Cheng Lin, Winona State University CS430 Computer Graphics Vectors Part III Intersections.
Clipping Primitives. Clipping line Clipping rectangle: – x min to x max – y min to y max A point (x,y) lies within a clip rectangle and thus displayed.
CS 551/651: Advanced Computer Graphics
Graphics Graphics & Graphical Programming Lecture 23 - Viewing & Clipping.
Section 12-1 Exploring Solids. Polyhedron Three dimensional closed figure formed by joining three or more polygons at their side. Plural: polyhedra.
1 Planes, Polygons and Objects ©Anthony Steed
CSE 681 Object Intersection. CSE 681 Object Representation Implicit forms F(x,y,z) = 0 Explicit forms Analytic form x = F(y,z) testing generating Parametric.
Bigyan Ankur Mukherjee University of Utah. Given a set of Points P sampled from a surface Σ,  Find a Surface Σ * that “approximates” Σ  Σ * is generally.
3D Rendering 2016, Fall.
University of North Carolina at Greensboro
Computer Graphics CC416 Week 13 Clipping.
Transformations contd.
CS 551 / 645: Introductory Computer Graphics
Intersecting Simple Surfaces
CSCE 441 Computer Graphics: Clipping Polygons Jinxiang Chai
Object Intersection CSE 681.
Presentation transcript:

Ray Polygon Interception: Cyrus Beck Algorithm Mengxia Zhu Fall 2007

Polygon and Polyhedron Polygon and Polyhedron are fundamental objects in 2D or 3D graphics. In 2D, straight lines make a polygon, in 3D, an object if often modeled as a polygonal “mesh”: a collection of polygons that fit together. If the skin forms a closed surface, the mesh is called polyhedron. P

Ray Polygon Intersection In order to analyze or render them, we usually need to solve the intersection problem. The general case of intersecting a line with a polygon and polyhedron is quite complex. We study convex forms with bounding lines or bounding planes first. Solve how a ray intersects a convex polygon or convex polyhedron is an essential technique in viewing 3D objects.  Is a given point P inside or outside the object  Where does a given ray first intersect the object  Which part of a given line lies inside the object?

Ray Casting Ray Tracing examples coolhead1small2rot.png www-evasion.imag.fr/.../ecs177.html

Parametric Line Revisited P 0 is the starting point P 1 another point on the line P linear interpolation between P 0 and P 1 Affine combination, Convex combination

Dot Product Revisited

Point inside or outside?

Direction for Ray that Strikes Plane the ray is aimed “along with” the normal the ray is parallel to the plane the ray is aimed “counter to” the normal r n r

Cyrus-Beck Algorithm Developed by Cyrus and Beck in 1978 Clip line against convex polygon/polyhedron Completely described by a set of “bounding lines or planes” Find a value of t for intersection of line and clipping edges. Use simple comparison of t values to find actual clipping segment.

Where a Ray intersects a line(2D) or plane(3D) A point normal form of edge or plane A parametric equation of line: Find t such that PLPL NLNL P(t) Inside Outside

Cyrus-Beck Algorithm (Cont’) Classify the relative position of the ray to intercepting edge or plane  If: ray parallel to the edge of line or plane  If: ray exiting polygon  If : ray entering polygon Entering Exiting P1 P0

Each Bounding Line or Plane We should find:  The hit time of the ray with the bounding line or bounding plane  Whether the ray is entering or exiting the polygon or polyhedron.

Compute PE with largest t: max (t in, 0) Compute PL with smallest t: min ( t out, 1) Clip to these two points Cyrus-Beck Algorithm (Cont’) PE PL P1P1 PE P0P0

Cyrus-Beck Algorithm (Cont’) Initialize the candidate interval to [0,1] For each bounding line, find the hit time of t hit and determine whether it is an entering or exiting hit  If t_ hit is an entering hit, set t_ in = max (t in, t hit )  If t_ hit is an exiting hit, set t_ out = min (t out, t hit ) If at any point tin becomes greater than t_out, the ray misses P entirely, and testing is terminated. If the candidate interval is not empty, then the segment between tin and tout lies inside P.

Clipping Against Arbitrary Polygons Polygon is no longer bounded by a collection of infinite bounding lines in point normal form. We have to work with N finite segments P1 P2

Clipping Against Arbitrary Polygons Represent edge of P parametrically  For example, segment P 3 P 4 is represented as: P 3 + e 3* u, where e 3 =P 4 -P 3, u ranges from 0 to 1.  Ray intersection with above segment is represented as: R + c*t = P 3 + e 3* u Find all of the hits of the ray with all edges of P and place them in a list of the hit times. The smallest value of t in hit-list is the first hit Take the t values in pairs. The ray enters P at the first time in each pair and exits from P at the second time of each pair

Exercises Draw an icosahedron by using the following drawing routine to use vertex arrays. Icosahedron approximate a sphere by using 20 polygons. After finish it, try to use recursive method to further divide each triangle to get more triangles to better approximate the sphere. #define x #define z void display (void) {static GLfloatv data[12][3] = { {-x,0.0,z},{x,0.0,z}, {-x,0.0,-z},{x,0.0,- z},{0.0,z,x},{0.0,z,-x},{0.0,-z,x}, {0.0,-z,-x},{z,x,0.0},{-z,x,0.0},{z,-x,0.0},{-z,-x,0.0} }; static GLuinttindices[20][3] = { {0,4,1},{0,9,4},{9,5,4},{4,5,8},{4,8,1},{8,10,1},{8,3,10},{5,3,8},{5,2,3},{2,7,3},{7,10,3},{7, 6,10},{7,11,6},{11,0,6},{0,1,6},{6,1,10},{9,0,11},{9,11,2},{9,2,5}, {7,2,11} };

Exercises Implement a 2D/3D Cyrus-Beck Algorithm for convex polygon or polyhedron by prompt user to input a ray and a sequence of bounding lines/bounding plane. Output the enter point and exit point.

Exercises for (i = 0; i < 20; i++) { glVertex3fv(&vdata[tindices[i][0]][0]); glVertex3fv(&vdata[tindices[i][1]][0]); glVertex3fv(&vdata[tindices[i][2]][0]); }