Esempio n. 1
0
        public override Base GetBase()
        {
            Base B = Base.UnitBase;

            B.BaseO = Point;
            int      id       = -1;
            xyArray  A        = null;
            LineType ViewLine = Device.FromScr(Device.MousePos);
            xyz      P        = ModelMatrix * ViewLine.P;
            xyz      Q        = ModelMatrix * ViewLine.Q;

            ViewLine = new LineType(P, Q);
            for (int i = 1; i < Loca.Count; i++)
            {
                A = Loca[i].getxyArray();
                A = ModelMatrix * A;


                double Dummy = -1;
                double di    = A.Distance(ViewLine, Snapdist * 8, out Lam, out Dummy);
                if (di <= Snapdist)
                {
                    id = i;
                    // break;
                }
            }
            if (id >= 0)

            {
                if (id == 1)
                {
                }
                if (Lam >= 0)
                {
                    double L = Lam;
                    Lam = Loca[id].xyArrayIndexToCurveArrayIndex(Lam);
                    xyz D = Loca[id].Direction(Lam).toXYZ();
                    B = Base.DoComplete(A.Value(L).toXYZ(), D, new xyz(0, 0, 1) & D);
                }
            }
            else
            {
                B       = ModelMatrix.toBase();
                B.BaseO = Point;
            }
            return(B);
        }
Esempio n. 2
0
        protected internal override xyz Cross(LineType ViewLine)
        {
            double Dummy = -1;

            double di = Poly.Distance(ViewLine, 2 * Snapdist, out Lam, out Dummy);

            if (di <= 2 * Snapdist)
            {
                return(Poly.Value(Lam).toXYZ());
            }
            else
            {
                Lam = -1;
            }
            xyz    Result  = new xyz(0, 0, 0);
            double LineLam = -1;

            new Plane(new xyz(0, 0, 0), new xyz(0, 0, 1)).Cross(ViewLine, out LineLam, out Result);



            return(Result);
        }