Exemplo n.º 1
0
        public bool ClosestPoint(
            int[] objectIndexArray, int firstIndex, int indexCount, V3d queryPoint,
            Func <IIntersectableObjectSet, int, bool> ios_index_objectFilter,
            Func <IIntersectableObjectSet, int, int, ObjectClosestPoint, bool> ios_index_part_ocp_pointFilter,
            ref ObjectClosestPoint closestPoint)
        {
            bool result = false;
            var  pa     = m_positionArray;

            for (int i = firstIndex, e = firstIndex + indexCount; i < e; i++)
            {
                int    li = objectIndexArray[i];
                V3d    p  = queryPoint.GetClosestPointOnLine(pa[li], pa[li + 1]);
                double d2 = V3d.DistanceSquared(queryPoint, p);
                if (d2 < closestPoint.DistanceSquared)
                {
                    result = closestPoint.Set(d2, p, this, li);
                }
            }
            return(result);
        }