| 63 | using namespace IceMaths; |
| 64 | |
| 65 | float Ray::SquareDistance(const Point& point, float* t) const |
| 66 | { |
| 67 | Point Diff = point - mOrig; |
| 68 | float fT = Diff | mDir; |
| 69 | |
| 70 | if(fT<=0.0f) |
| 71 | { |
| 72 | fT = 0.0f; |
| 73 | } |
| 74 | else |
| 75 | { |
| 76 | fT /= mDir.SquareMagnitude(); |
| 77 | Diff -= fT*mDir; |
| 78 | } |
| 79 | |
| 80 | if(t) *t = fT; |
| 81 | |
| 82 | return Diff.SquareMagnitude(); |
| 83 | } |
no outgoing calls
no test coverage detected