Skip to Content
GPU Pro 7
book

GPU Pro 7

by Wolfgang Engel
March 2016
Intermediate to advanced
320 pages
9h 14m
English
A K Peters/CRC Press
Content preview from GPU Pro 7
2. Interactive Sparse Eulerian Fluid 295
float2 IntersectBox ( Ray r , float3 boxmin , float3 boxmax)
{
// Compute i n t e r s e c t i o n o f ray with a l l s i x bounding box p la ne s .
float3 invR =1.0 /r . d ;
float3 tbot = invR ( boxmin . xyz r . o );
float3 ttop = invR ( boxmax . xyz r . o );
// Reorder intersections to find smallest and largest on
// each axis .
float3 tmin = min ( ttop , tbot );
float3 tmax = max ( ttop , tbot );
// Find the largest tmin and the smallest tmax.
float2 t0 = max ( tmin . xx , tmin . yz );
tnear = max ( t0 . x , t0 . y );
t0 = min ( tmax . xx , tmax . yz );
tfar = min ( t0 . x , t0 . y );
return float2 ( tnear ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

GPU Pro 4

GPU Pro 4

Wolfgang Engel
GPU Pro 5

GPU Pro 5

Wolfgang Engel
GPU Pro 6

GPU Pro 6

Wolfgang Engel
GPU PRO 3

GPU PRO 3

Wolfgang Engel

Publisher Resources

ISBN: 9781498742542