Exemplo n.º 1
0
        bool intersectPlaneWithLine(SnapItem Plane, SnapItem Line, xyzArray LineArray, ref double Lam, ref xyz Result)
        {
            TriangleF T = Plane.GetTriangle();

            if (T == null)
            {
                return(false);
            }
            xyz N1 = ((T.B - T.A) & (T.C - T.A)).Toxyz();

            if (LineArray == null)
            {
            }
            xyz N2 = LineArray.cross();

            if ((N1 & N2).length() < 0.00001)   // Parallel
            {
                xyzArray A = Plane.getxyzArray();
                if (A != null)
                {
                    xyzArray         B = LineArray;
                    List <CrossTag1> L = CrossTag1.GetCrossList(A, B);

                    for (int i = 0; i < L.Count; i++)
                    {
                        if (A.Value(L[i].Lam1).dist(Plane.Point) <= SnapItem.Snapdist)
                        {
                            Lam = L[i].Lam1;

                            Result = A.Value(L[i].Lam1);
                            return(true);
                        }
                    }
                }
            }

            int Object = StoredSnapItems.IndexOf(Plane);
            int siz    = SnapDistance * 2 + 1;

            //  int siz = SnapDistance;
            Drawing3d.PrimIdObj[,] P = SubArray(Device.MousePos.X - siz / 2, (int)Device.ViewPort.Height - Device.MousePos.Y - siz / 2, siz, siz);
            List <TriangleF> LT = GetTriangles(P, Object);

            Lam = -1;



            bool R = Cross(LT, LineArray, ref Lam, ref Result);

            return(R);
        }
Exemplo n.º 2
0
        bool IntersectLines(xyzArray A, xyzArray B, xyz NearPoint, ref xyz CrossPoint)
        {
            List <CrossTag1> L = CrossTag1.GetCrossList(A, B);

            for (int i = 0; i < L.Count; i++)
            {
                if (A.Value(L[i].Lam1).dist(NearPoint) <= SnapItem.Snapdist)
                {
                    CrossPoint = A.Value(L[i].Lam1);

                    return(true);
                }
            }
            return(false);
        }
Exemplo n.º 3
0
        void IntersectLines(List <xyzArray> Arrays, List <SnapItem> Snap)
        {
            xyzArray         A = Arrays[0];
            xyzArray         B = Arrays[1];
            List <CrossTag1> L = CrossTag1.GetCrossList(A, B);

            for (int i = 0; i < L.Count; i++)
            {
                if (A.Value(L[i].Lam1).dist(Snap[0].Point) <= SnapItem.Snapdist)
                {
                    Snap[0].Point   = A.Value(L[i].Lam1);
                    Snap[1].Point   = Snap[0].Point;
                    Snap[0].Crossed = true;
                    Snap[1].Crossed = true;
                    break;
                }
            }
        }