1 / 19

CS430 Computer Graphics

CS430 Computer Graphics. Vectors Part IV Polygon Intersection. Topics. Polygon Intersection Problems Convex Polygons and Polyhedra Ray Intersection and Clipping Cyrus-Beck Clipping Algorithm. Polygon Intersection Problems. Polygons are fundamental objects in both 2D and 3D graphics

rasul
Download Presentation

CS430 Computer Graphics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS430 Computer Graphics Vectors Part IV Polygon Intersection Chi-Cheng Lin, Winona State University

  2. Topics • Polygon Intersection Problems • Convex Polygons and Polyhedra • Ray Intersection and Clipping • Cyrus-Beck Clipping Algorithm

  3. Polygon Intersection Problems • Polygons are fundamental objects in both 2D and 3D graphics • A polygonal mesh can be used to model a 3D graphics object • Polyhedron • A polygonal mesh which forms a closed surface that encloses some space

  4. Polygon Intersection Problems • Is a given point P inside or outside the object? • Where does a given ray R first intersect the object? • Which part of a given line L lies inside/outside the object?

  5. Polygon Intersection Problems

  6. Convex Polygons and Polyhedra • General case of polygon/polyhedron intersection problems is complex • Convex polygons/polyhedra are easier to deal with • 2D: a convex polygon can be completely described by a set of “bounding lines” • 3D: a convex polyhedron can be completely described by a set of “bounding planes”  Deal with bounding lines/planes

  7. Convex Polygons and Polyhedra

  8. Convex Polygons and Polyhedra • Outward normal • Every bounding line of a 2D convex polygon • Every bounding plane of a 3D convex polyhedron

  9. Convex Polygons and Polyhedra • Outside half-space • Polyhedron • Intersection of all the inside half-spaces Outside half-space Inside half-space L1

  10. Ray Intersection • A Intersection problem: when does a ray enter and exit a convex polygon? • A ray A + ct hits a convex polygon P exactly twice • Entering hit point: A + ctin • Exiting hit point: A + ctout • The ray is inside P for all t  [tin, tout] c A P

  11. Clipping • Clipping problem: given points A and C, which part of line segment AC lies inside a convex polygon P ? • A’ = A + c max(0, tin) C’ = A + c min(tout, 1) tout tout 1 1 tin 0 tin C 0 C A A P tout 1 tin 0 C A

  12. Clipping • How aretin and tout computed? • We must find the intersection of the ray and each bounding line in turn • Assume a bounding line is represented as {B, n}, where • B: some point on the line • n: outward normal

  13. Clipping • If nc > 0, ray is exiting from P If nc = 0, ray is parallel to P If nc < 0, ray is entering P • For each bounding line, find • Hit time of the ray with bounding line • Whether the ray is entering or exiting n1 n2 c B1 B2 A

  14. Clipping • Approach • Candidate interval of t : [tin, tout ] • Keep track of the maximum entering time tin • Keep track of the minimum exit time tout • We want to chop the interval at each iteration • Can stop as soon as tin > tout (what does this mean?)

  15. Clipping - Algorithm Initialize [tin, tout]  [0, 1] for each boundary find the hit time thit if entering then tin = max(tin, thit) else tout = min(tout, thit) if tin > tout then no intersection  stop segment from A + ctin to A + ctout lies inside P (We found: endpoints of clipped lines entering and exiting points of ray)

  16. Clipping - Example Updates on tin and tout: Line test tintout 0 0 0.83 1 0 0.66 2 0 0.66 3 0 0.66 4 0.2 0.66 5 0.28 0.66 @0 L5 @.2 L0 A @.28 @.83 @1 @.66 L4 C L1 @-4.7 @3.4 L3 L2

  17. Cyrus-Beck Clipping Algorithm • Clip a line segment against any convex polygon • Input parameters • Line segment • List of bounding lines • Output parameter • Clipped line segment • Return value • 1, if part of segment lies in P • 0, otherwise

More Related