Example #1
0
        public ContainmentType Contains(AABox2D box)
        {
            //test if all corner is in the same side of a face by just checking min and max
            if (box.Max.X < Min.X ||
                box.Min.X > Max.X ||
                box.Max.Y < Min.Y ||
                box.Min.Y > Max.Y)
            {
                return(ContainmentType.Disjoint);
            }

            if (box.Min.X >= Min.X &&
                box.Max.X <= Max.X &&
                box.Min.Y >= Min.Y &&
                box.Max.Y <= Max.Y)
            {
                return(ContainmentType.Contains);
            }

            return(ContainmentType.Intersects);
        }
Example #2
0
 public AABox2D Merge(AABox2D box)
 => new AABox2D(Min.Min(box.Min), Max.Max(box.Max));
Example #3
0
 public bool Intersects(AABox2D box)
 => Intersects(this, box);
Example #4
0
 public static bool Intersects(AABox2D box1, AABox2D box2)
 => box1.Min.X <= box2.Max.X &&
 box1.Max.X >= box2.Min.X &&
 box1.Min.Y <= box2.Max.Y &&
 box1.Max.Y >= box2.Min.Y;
Example #5
0
 public bool Intersects(AABox2D thisBox, Line2D otherLine, AABox2D otherBox)
 => thisBox.Intersects(otherBox) &&
 TouchesOrCrosses(otherLine) &&
 otherLine.TouchesOrCrosses(this);
Example #6
0
 public AABox2D BoundingBox() => AABox2D.Create(A, B);