1 / 6

Intersecting an A-A Cube

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.

Download Presentation

Intersecting an A-A Cube

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. Intersecting an A-A Cube

  2. ? Axis-Aligned Cube x,y = +/- 0.5

  3. 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

  4. 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> }

  5. 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;

  6. Axis-Aligned Cube If start inside, need first in-to-out intersection With this code, how do you tell if you started inside?

More Related