7 #ifndef __solve_RayCylinderIntersect_h__ 8 #define __solve_RayCylinderIntersect_h__ 39 const T range,
const T along,
58 cross3(n,direction,axis);
59 const T nlength=magnitude(n);
66 const T d=fabs(dot(RC,n));
74 T t= -dot(tmp,n)/nlength;
77 T range=t-fabs(sqrtf(radius*radius-d*d)/dot(direction,tmp));
79 const T axislength2=magnitudeSquared(axis);
80 intersection=origin+range*direction;
81 along=dot(axis,intersection-base)/axislength2;
85 return (along>0 && along<1.0f)? range: T(-1);
93 const T range,
const T along,
97 normal=(intersection-centerAlong)/radius;
kernel
Definition: namespace.dox:3
Find intersection between ray and cylinder.
Definition: RayCylinderIntersect.h:26