Ray Tracing Simulation 2 - PowerPoint PPT Presentation

1 / 7
About This Presentation
Title:

Ray Tracing Simulation 2

Description:

Boolean operators. Union. Intersection. difference. Ray Tracing CSG Objects. S1. S2 ... Intersecting Rays with Boolean Object. Union? logical operators ... – PowerPoint PPT presentation

Number of Views:93
Avg rating:3.0/5.0
Slides: 8
Provided by: xp92
Category:

less

Transcript and Presenter's Notes

Title: Ray Tracing Simulation 2


1
Ray Tracing Simulation (2)
2
COMPOUND OBJECTBOOLEAN OPERATIONS ON OBJECTS
  • Constructive solid geometry(CSG)
  • Boolean operators
  • Union
  • Intersection
  • difference

3
Ray Tracing CSG Objects
4
Data Structure for Boolean Objects
class Boolean public GeomObj public GeomObj
left, right Boolean()left(NULL),right(NULL)
virtual bool hit(Ray r, Intersection
inter)return false virtual void
makeExtentPoints(PointCluster clust) virtual
void drawOpenGL() // just draw its
children if(left)left-gtdrawOpenGL() if(right)
right-gtdrawOpenGL()
5
Intersecting Rays with Boolean Object
  • Union? logical operators
  • combInside lftInside rtInside
  • Intersection? logical operators
  • combInside lftInside rtInside
  • Difference? logical operators
  • combInside lftInside !rtInside

6
Building and Using Extents for CSG Object
  • During a preprocessing step, the tree for the CSG
    object is scanned and extents are built for each
    node and stored within the node itself.
  • Making Box Extents
  • Union
  • Intersection
  • Difference

Cuboid UnionBool makeBoxExtent() Cuboid lft
left -gt makeBoxExtent() Cuboid rt right -gt
makeBoxExtent() Cuboid tmp tmp.left
min(lft.left, rt.left) //form the
union tmp.top max(lft.top, rt.top) //etc.
for the other four values worldBoxExtent tmp
//store it in the object return tmp
7
Cuboid UnionBool makeBoxExtent() Cuboid lft
left -gt makeBoxExtent() Cuboid rt right -gt
makeBoxExtent() Cuboid tmp tmp.left
min(lft.left, rt.left) //form the
union tmp.top max(lft.top, rt.top) //etc.
for the other four values worldBoxExtent tmp
//store it in the object return tmp
Write a Comment
User Comments (0)
About PowerShow.com