rRay

alias rRay = Ray!real

Examples

auto r1 = fRay( vec3(1,2,3), vec3(2,3,4) );
auto r2 = fRay( vec3(4,5,6), vec3(5,2,3) );
auto rs = fRay( vec3(5,7,9), vec3(7,5,7) );
assertEq( r1 + r2, rs );
1 auto s = fRay( vec3(2,0,0), vec3(-4,4,0) );
2 auto p = vec3( 0,0,0 );
3 auto r = s.altitude(p);
4 assertEq( p, r.end );
5 assertEq( r.pos, vec3(1,1,0) );
1 auto s1 = fRay( vec3(-2,0,0), vec3(1,0,0) );
2 auto s2 = fRay( vec3(0,0,2), vec3(0,1,-1) );
3 
4 auto a1 = s1.altitude(s2);
5 assert( eq_seg( a1, fRay(vec3(0,0,0), vec3(0,1,1)) ) );
auto s1 = fRay( vec3(0,0,0), vec3(2,2,0) );
auto s2 = fRay( vec3(2,0,0), vec3(-4,4,0) );
assertEq( s1.intersect(s2), s2.intersect(s1) );
assertEq( s1.intersect(s2), vec3(1,1,0) );

Meta