Exemple #1
0
        private Vector3 GetClosestPoint(Vector3 k)
        {
            Vector3 vK1 = k - _p1;
            float   tx  = Vector3.Dot(vK1, _v41) / _v41Squared;
            float   tz  = Vector3.Dot(vK1, _v21) / _v21Squared;

            tx = ExtMathf.SetBetween(tx, 0, 1);
            tz = ExtMathf.SetBetween(tz, 0, 1);

            Vector3 closestPoint = tx * _v41 + tz * _v21 + _p1;

            return(closestPoint);
        }