blob: 0dac305fe1ff2d33837df87a00ea2bcef5d95177 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
#include "UnityPrefix.h"
#include "Ray.h"
float Ray::SqrDistToPoint(const Vector3f& P) const {
//ΚΚΚ Vector v = L.P1 - L.P0;
Vector3f v = m_Direction;
// Vector3f w = P - L.P0;
Vector3f w = P - m_Origin;
float c1 = Dot(w,v);
float c2 = Dot(v,v);
float b = c1 / c2;
//ΚΚΚ Point Pb = L.P0 + b * v;
Vector3f Pb = GetPoint (b);
return SqrMagnitude(P - Pb);
}
|