Esempio n. 1
0
        public static ParallelResult ParallelCheck(
            Point pta, Vector da,          //bod a vektor prvni primky
            Point ptb, Vector db,          //bod a vektor druhe primky
            out Point retRel,              // vraci relativni souradnice ( x = begin, y = end) na prvni primce
            out bool direct)               // smer vektoru primek, true stejny smer, false opacny smer
        {
            retRel = new Point();
            direct = false;
            var rr = Funcs2D.IsParallel(da, db);

            if (rr == 0)
            {
                return(ParallelResult.Nothing);
            }
            direct = rr > 0;

            retRel.X = Funcs2D.PointToLine(pta, da, ptb);
            retRel.Y = Funcs2D.PointToLine(pta, da, ptb.Plus(db));

            if (Funcs2D.IsThreePointsOnLine(pta, pta.Plus(da), ptb))
            {
                return(ParallelResult.ParallelOn);
            }
            else
            {
                return(ParallelResult.ParallelOut);
            }
        }
Esempio n. 2
0
        public static List <int> PolygonParallelEdges(IPolygonReader poly, bool closed, Vector v)
        {
            List <int> r = new List <int>();

            Point[] p = new BoxArrayPoint(poly).Value;
            for (int i = 0, j; i < p.Length; i++)
            {
                if (i == p.Length - 1)
                {
                    j = 0;
                }
                else
                {
                    j = i + 1;
                }
                if (Funcs2D.IsParallel(v, p[j].Minus(p[i])) != 0)
                {
                    r.Add(i);
                }
            }
            return(r);
        }