Exemplo n.º 1
0
        // Token: 0x0600033D RID: 829 RVA: 0x0000DDAC File Offset: 0x0000BFAC
        public static bool Intersects(this Line2 line, AxisAlignedBox2 axisAlignedBox)
        {
            Box2 box = new Box2(axisAlignedBox.Center, UnitVector2.UnitX, UnitVector2.UnitY, axisAlignedBox.ExtentX, axisAlignedBox.ExtentY);
            IntersectionLine2Box2 intersectionLine2Box = new IntersectionLine2Box2(line, box);

            return(intersectionLine2Box.Test());
        }
Exemplo n.º 2
0
        /// <summary>
        /// 线和BOX相交
        /// </summary>
        /// <param name="line"></param>
        /// <param name="box"></param>
        /// <returns></returns>
        public static Segment2?IntersectionWith(this Line2 line, Box2 box)
        {
            IntersectionLine2Box2 intersectionLine2Box = new IntersectionLine2Box2(line, box);
            bool flag = intersectionLine2Box.Find();

            if (flag && intersectionLine2Box.IntersectionType == Intersection.Type.IT_SEGMENT)
            {
                return(new Segment2?(new Segment2(intersectionLine2Box.Point0, intersectionLine2Box.Point1)));
            }
            if (flag && intersectionLine2Box.IntersectionType == Intersection.Type.IT_POINT)
            {
                return(new Segment2?(new Segment2(intersectionLine2Box.Point0, line.Direction, 0.0)));
            }
            return(null);
        }
Exemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="line"></param>
        /// <param name="axisAlignedBox"></param>
        /// <returns></returns>
        public static Segment2?IntersectionWith(this Line2 line, AxisAlignedBox2 axisAlignedBox)
        {
            Box2 box = new Box2(axisAlignedBox.Center, UnitVector2.UnitX, UnitVector2.UnitY, axisAlignedBox.ExtentX, axisAlignedBox.ExtentY);
            IntersectionLine2Box2 intersectionLine2Box = new IntersectionLine2Box2(line, box);
            bool flag = intersectionLine2Box.Find();

            if (flag && intersectionLine2Box.IntersectionType == Intersection.Type.IT_SEGMENT)
            {
                return(new Segment2?(new Segment2(intersectionLine2Box.Point0, intersectionLine2Box.Point1)));
            }
            if (flag && intersectionLine2Box.IntersectionType == Intersection.Type.IT_POINT)
            {
                return(new Segment2?(new Segment2(intersectionLine2Box.Point0, line.Direction, 0.0)));
            }
            return(null);
        }
Exemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="line"></param>
        /// <param name="box"></param>
        /// <returns></returns>
        public static ICollection <Vector2> IntersectionPointsWith(this Line2 line, Box2 box)
        {
            IntersectionLine2Box2 intersectionLine2Box = new IntersectionLine2Box2(line, box);

            intersectionLine2Box.Find();
            List <Vector2> list = new List <Vector2>();

            Vector2[] array = new Vector2[]
            {
                intersectionLine2Box.Point0,
                intersectionLine2Box.Point1
            };
            for (int i = 0; i < intersectionLine2Box.Quantity; i++)
            {
                list.Add(array[i]);
            }
            return(list);
        }
Exemplo n.º 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="line"></param>
        /// <param name="axisAlignedBox"></param>
        /// <returns></returns>
        public static ICollection <Vector2> IntersectionPointsWith(this Line2 line, AxisAlignedBox2 axisAlignedBox)
        {
            Box2 box = new Box2(axisAlignedBox.Center, UnitVector2.UnitX, UnitVector2.UnitY, axisAlignedBox.ExtentX, axisAlignedBox.ExtentY);
            IntersectionLine2Box2 intersectionLine2Box = new IntersectionLine2Box2(line, box);

            intersectionLine2Box.Find();
            List <Vector2> list = new List <Vector2>();

            Vector2[] array = new Vector2[]
            {
                intersectionLine2Box.Point0,
                intersectionLine2Box.Point1
            };
            for (int i = 0; i < intersectionLine2Box.Quantity; i++)
            {
                list.Add(array[i]);
            }
            return(list);
        }
Exemplo n.º 6
0
        // Token: 0x0600033C RID: 828 RVA: 0x0000DD8C File Offset: 0x0000BF8C
        public static bool Intersects(this Line2 line, Box2 box)
        {
            IntersectionLine2Box2 intersectionLine2Box = new IntersectionLine2Box2(line, box);

            return(intersectionLine2Box.Test());
        }