Exemplo n.º 1
0
        /// <summary>
        /// Calculates the affine coordinates of a cross point of a infinitly line.
        /// To calculate the cross point use: pt = A + (B - A) * Lam + (C - A) * mue
        /// </summary>
        /// <param name="L">Infinitly line</param>
        /// <param name="Lam">affine coordinate relatively to (B - A)</param>
        /// <param name="Mue">affine coordinate relatively to (C - A)</param>
        /// <returns></returns>
        public bool AffinCoordOfCross(LineType L, ref double Lam, ref double Mue)
        {
            Lam = 0;
            Mue = 0;
            Plane  plane = this.GetPlane();
            double dummy, a, b, c, d;
            xyz    P, AB, AC, AP;

            plane.Cross(L, out dummy, out P);

            AB = B - A;
            AC = C - A;
            AP = P - A;
            a  = AB.x; b = AC.x; c = AB.y; d = AC.y;

            xyz Det  = AB & AC;
            xyz Det1 = AP & AB;
            xyz Det2 = AP & AC;

            if ((Det * plane.NormalUnit) < 0.0000000001)
            {
                return(false);
            }
            Lam = (Det2 * plane.NormalUnit / (Det * plane.NormalUnit));
            Mue = -(Det1 * plane.NormalUnit / (Det * plane.NormalUnit));
            xyz T = AB * Lam + AC * Mue;

            if (AP.dist(T) > 0.0001)
            {
            }
            return(true);
        }