Exemplo n.º 1
0
        public static double DistancePointLine3D(clsPoint3d p1, clsLine3d l1)
        {
            //Distance between 3D point and truncated 3D line
            clsPoint3d p3d = new clsPoint3d();
            double     l   = 0;

            p3d = ProjectPoint(p1, l1);
            l   = l1.Lambda(p3d);
            if (l < 0)
            {
                return(p1.Dist(l1.P1));
            }
            if (l > 1)
            {
                return(p1.Dist(l1.P2));
            }
            return(p1.Dist(p3d));
        }
Exemplo n.º 2
0
        public double DistanceToShortLine(clsPoint3d pt1)
        {
            clsPoint3d pt2 = default(clsPoint3d);

            pt2 = mdlGeometry.ProjectPoint(pt1, this);
            if (Lambda(pt2) < 0)
            {
                pt2 = P1;
            }
            if (Lambda(pt2) > 1)
            {
                pt2 = P2;
            }
            if (mdlGeometry.IsSameDbl(Length, 0))
            {
                pt2 = P1;
            }
            return(pt1.Dist(pt2));
        }