Esempio n. 1
0
 public Poly2dWithExtraStuff(List <xy> m)
 {
     loops = new List <List <xy> >();
     loops.Add(m);
     bb   = BoundingBox2d.FromArrayOfPoints(loops[0]);
     segs = seg2d.Convert(loops);
 }
Esempio n. 2
0
        public static BoundingBox2d FromArrayOfPoints(List <xy> a)
        {
            BoundingBox2d bb = new BoundingBox2d();

            foreach (xy v in a)
            {
                bb.xmin = Math.Min(bb.xmin, v.x);
                bb.ymin = Math.Min(bb.ymin, v.y);
                bb.xmax = Math.Max(bb.xmax, v.x);
                bb.ymax = Math.Max(bb.ymax, v.y);
            }
            return(bb);
        }
Esempio n. 3
0
        public static void SplitAll(Poly2dWithExtraStuff p1, Poly2dWithExtraStuff p2)
        {
            p1.info = new List <seginfo2d>();

            if (!BoundingBox2d.intersect(p1.bb, p2.bb))
            {
                foreach (seg2d s1 in p1.segs)
                {
                    p1.info.Add(new seginfo2d(s1, SegmentInfo.Outside));
                }
            }
            else
            {
                foreach (seg2d s1 in p1.segs)
                {
                    SplitSegment(p1.info, s1, p2);
                }
            }
        }
Esempio n. 4
0
 public static bool intersect(BoundingBox2d bb1, BoundingBox2d bb2)
 {
     if (fp.lt_inches(bb1.xmax, bb2.xmin))
     {
         return(false);
     }
     if (fp.lt_inches(bb2.xmax, bb1.xmin))
     {
         return(false);
     }
     if (fp.lt_inches(bb1.ymax, bb2.ymin))
     {
         return(false);
     }
     if (fp.lt_inches(bb2.ymax, bb1.ymin))
     {
         return(false);
     }
     return(true);
 }
Esempio n. 5
0
 public Poly2dWithExtraStuff(List <List <xy> > oops)
 {
     loops = oops;
     bb    = BoundingBox2d.FromArrayOfPoints(loops[0]);
     segs  = seg2d.Convert(loops);
 }