Exemplo n.º 1
0
        public override List <LineSeg> GetLineSegs()
        {
            List <LineSeg> lineSeg = new List <LineSeg>();

            foreach (Hitable hitable in Substraction)
            {
                lineSeg.AddRange(hitable.GetLineSegs());
            }
            for (int i = 0; i < lineSeg.Count; i++)
            {
                LineSeg seg = lineSeg[i];
                seg.Normal = -lineSeg[i].Normal;
                lineSeg[i] = seg;
            }
            lineSeg.AddRange(Minuend.GetLineSegs());
            lineSeg = LineSeg.DivideByIntersection(lineSeg);
            for (int i = 0; i < lineSeg.Count; i++)
            {
                if (!Minuend.IsInside(lineSeg[i].Position) || IsInSubstraction(lineSeg[i].Position))
                {
                    lineSeg.RemoveAt(i--);
                }
            }
            return(lineSeg);
        }
Exemplo n.º 2
0
        public override List <LineSeg> GetLineSegs()
        {
            List <LineSeg> lineSeg1 = new List <LineSeg>();
            List <LineSeg> lineSeg2 = new List <LineSeg>();
            List <LineSeg> lineSeg  = new List <LineSeg>();

            lineSeg1.AddRange(O1.GetLineSegs());
            lineSeg1 = LineSeg.DivideByIntersection(lineSeg1);
            for (int i = 0; i < lineSeg1.Count; i++)
            {
                if (O2.IsInside(lineSeg1[i].Position))
                {
                    lineSeg.Add(lineSeg1[i]);
                }
            }
            lineSeg2.AddRange(O2.GetLineSegs());
            lineSeg2 = LineSeg.DivideByIntersection(lineSeg2);
            for (int i = 0; i < lineSeg2.Count; i++)
            {
                if (O1.IsInside(lineSeg2[i].Position))
                {
                    lineSeg.Add(lineSeg2[i]);
                }
            }
            return(lineSeg);
        }
Exemplo n.º 3
0
        public override List <LineSeg> GetLineSegs()
        {
            List <LineSeg> lineSeg = new List <LineSeg>();

            lineSeg.AddRange(O1.GetLineSegs());
            lineSeg.AddRange(O2.GetLineSegs());
            lineSeg = LineSeg.DivideByIntersection(lineSeg);
            //for (int i = 0; i < lineSeg.Count; i++)
            //    if (O1.IsInside(lineSeg[i].Position) && O1.IsOnBoundary(lineSeg[i].Position) ||
            //        O2.IsInside(lineSeg[i].Position) && O2.IsOnBoundary(lineSeg[i].Position)) lineSeg.RemoveAt(i);
            return(lineSeg);
        }