intersecting an a a cube
Download
Skip this Video
Download Presentation
Intersecting an A-A Cube

Loading in 2 Seconds...

play fullscreen
1 / 6

Intersecting an A-A Cube - PowerPoint PPT Presentation


  • 83 Views
  • Uploaded on

Intersecting an A-A Cube. ?. Axis-Aligned Cube. x,y = +/- 0.5. Axis-Aligned Cube. float s[3],d[3]; // R(t) = s + t*d float toutin[3],tinout[3]; // hold 3 intersections (t values) Int inout,outin; // indices into t arrays. Axis-Aligned Cube.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Intersecting an A-A Cube' - clayton-bryan


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
axis aligned cube

?

Axis-Aligned Cube

x,y = +/- 0.5

axis aligned cube1
Axis-Aligned Cube

float s[3],d[3]; // R(t) = s + t*d

float toutin[3],tinout[3]; // hold 3 intersections (t values)

Int inout,outin; // indices into t arrays

axis aligned cube2
Axis-Aligned Cube

For each boundary plane

inout = outin = 0;

if (fabs(d[0]) > epsilon) {

t = (-0.5 - s[0])/d[0];

if (s[0]<-0.5) toutin[outin++] = t;

else tinout[inout++] = t;

}

else { // ray parallel to plane

if (s[0] < -0.5) <no intersection at all>

else <ignore this limit>

}

axis aligned cube3
Axis-Aligned Cube

in 3D, up to 3 intersections

tinout[3]

toutin[3]

// find largest out-to-in, smallest in-to-out

toi = toutin[0];

If ((outin==2)&&(toutin[1] > toi)) toi = toutin[1];

Tio = tinout[0];

If ((inout==2)&&(tinout[1] > tio)) tio = tinout[1];

If (toi < tio) t = toi;

axis aligned cube4
Axis-Aligned Cube

If start inside, need first in-to-out intersection

With this code, how do you tell if you started inside?

ad