예제 #1
0
        public bool IsOnShortLine(clsPoint3d pt1, double aTol = 0, bool excludeEnds = false)
        {
            clsLine3d l1 = default(clsLine3d);
            clsLine3d l2 = default(clsLine3d);
            double    d  = 0;

            if (aTol == 0)
            {
                aTol = mdlGeometry.myTol;
            }
            if (Abs(DistanceToPoint(pt1)) > aTol)
            {
                return(false);
            }
            l1 = new clsLine3d(P1, pt1);
            l2 = Copy();
            l2.Normalise();
            d = l1.Dot(l2);
            if (d < -aTol)
            {
                return(false);
            }
            if (d > Length + aTol)
            {
                return(false);
            }
            if (excludeEnds && (P1 == pt1 | P2 == pt1))
            {
                return(false);
            }
            return(true);
        }
예제 #2
0
        public clsPoint3d DistanceAlongLine(double d)
        {
            clsLine3d l1 = default(clsLine3d);

            l1 = Copy();
            l1.Normalise();
            return(new clsPoint3d(X1 + d * l1.DX(), Y1 + d * l1.DY(), Z1 + d * l1.DZ()));
        }
예제 #3
0
        public double Lambda(clsPoint3d pt1)
        {
            clsLine3d l1 = default(clsLine3d);
            clsLine3d l2 = default(clsLine3d);

            l1 = new clsLine3d(P1, pt1);
            l2 = Copy();
            l2.Normalise();
            return(l1.Dot(l2) / Length);
        }
예제 #4
0
        public static clsPoint3d ProjectPoint(clsPoint3d p1, clsLine3d l1)
        {
            double    d1 = 0;
            clsLine3d l2 = new clsLine3d();
            clsLine3d l3 = new clsLine3d();

            l2 = l1.Copy();
            l2.Normalise();
            l3        = new clsLine3d(l1.P1, p1);
            d1        = l2.Dot(l3);
            l2.Length = d1;
            return(l2.P2);
        }
예제 #5
0
        public double DistanceToPoint(clsPoint3d aPt)
        {
            double    d1 = 0;
            double    d2 = 0;
            clsLine3d l2 = default(clsLine3d);
            clsLine3d l3 = default(clsLine3d);

            l2 = Copy();
            l2.Normalise();
            l3 = new clsLine3d(P1, aPt);
            d1 = l2.Dot(l3);
            d2 = l3.Length;
            return(Sqrt(Pow(d2, 2) - Pow(d1, 2)));
        }
예제 #6
0
        public static double Dist3d(clsPoint3d p1, clsLine3d l1)
        {
            double    d1 = 0;
            double    d2 = 0;
            clsLine3d l2 = new clsLine3d();
            clsLine3d l3 = new clsLine3d();

            l2 = l1.Copy();
            l2.Normalise();
            l3 = new clsLine3d(l1.P1, p1);
            d1 = l2.Dot(l3);
            d2 = l3.Length;
            return(Sqrt(Pow(d2, 2) - Pow(d1, 2)));
        }