Exemple #1
0
        // Token: 0x06000293 RID: 659 RVA: 0x0000ABF0 File Offset: 0x00008DF0
        public bool Find()
        {
            this.Quantity = 0;
            IntersectionLine2Circle2 intersectionLine2Circle = new IntersectionLine2Circle2(new Line2(this.ray.Origin, this.ray.Direction), this.circle);

            if (intersectionLine2Circle.Find())
            {
                if (intersectionLine2Circle.Quantity == 2)
                {
                    if (intersectionLine2Circle.Parameter0 >= 0.0 && intersectionLine2Circle.Parameter1 >= 0.0)
                    {
                        this.Point0   = intersectionLine2Circle.Point0;
                        this.Point1   = intersectionLine2Circle.Point1;
                        this.Quantity = 2;
                    }
                    else if (intersectionLine2Circle.Parameter0 < 0.0 && intersectionLine2Circle.Parameter1 >= 0.0)
                    {
                        this.Point0   = intersectionLine2Circle.Point1;
                        this.Quantity = 1;
                    }
                }
                else if (intersectionLine2Circle.Parameter0 >= 0.0)
                {
                    this.Point0   = intersectionLine2Circle.Point0;
                    this.Quantity = 1;
                }
            }
            this.IntersectionType = ((this.Quantity > 0) ? Intersection.Type.IT_POINT : Intersection.Type.IT_EMPTY);
            return(this.IntersectionType > Intersection.Type.IT_EMPTY);
        }
Exemple #2
0
        public static ICollection <Vector2> IntersectionPointsWith(this Line2 line, Circle2 circle)
        {
            IntersectionLine2Circle2 intersectionLine2Circle = new IntersectionLine2Circle2(line, circle);

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

            Vector2[] array = new Vector2[]
            {
                intersectionLine2Circle.Point0,
                intersectionLine2Circle.Point1
            };
            for (int i = 0; i < intersectionLine2Circle.Quantity; i++)
            {
                list.Add(array[i]);
            }
            return(list);
        }
Exemple #3
0
        // Token: 0x060002F2 RID: 754 RVA: 0x0000BC68 File Offset: 0x00009E68
        public bool Find()
        {
            int quantity;

            double[] array;
            bool     flag = IntersectionLine2Circle2.Find(this.line.Origin, this.line.Direction, this.circle.Center, this.circle.Radius, out quantity, out array);

            this.Quantity = quantity;
            if (flag)
            {
                this.Point0     = this.line.Origin + array[0] * this.line.Direction;
                this.Parameter0 = array[0];
                if (this.Quantity == 2)
                {
                    this.Point1     = this.line.Origin + array[1] * this.line.Direction;
                    this.Parameter1 = array[1];
                }
            }
            this.IntersectionType = ((this.Quantity > 0) ? Intersection.Type.IT_POINT : Intersection.Type.IT_EMPTY);
            return(this.IntersectionType > Intersection.Type.IT_EMPTY);
        }
        // Token: 0x060002DD RID: 733 RVA: 0x0000B900 File Offset: 0x00009B00
        public bool Find()
        {
            int num;

            double[] array;
            bool     flag = IntersectionLine2Circle2.Find(this.line.Origin, this.line.Direction, this.arc.Circle.Center, this.arc.Circle.Radius, out num, out array);

            this.Quantity = 0;
            if (flag)
            {
                Vector2 vector  = this.line.Origin + this.line.Direction * array[0];
                Vector2 vector2 = this.line.Origin + this.line.Direction * array[1];
                if (IntersectionArc2Arc2.Contains(this.arc, vector))
                {
                    this.Point0     = vector;
                    this.Parameter0 = array[0];
                    int quantity = this.Quantity;
                    this.Quantity = quantity + 1;
                    if (num == 2 && IntersectionArc2Arc2.Contains(this.arc, vector2))
                    {
                        this.Point1     = vector2;
                        this.Parameter1 = array[1];
                        quantity        = this.Quantity;
                        this.Quantity   = quantity + 1;
                    }
                }
                else if (num == 2 && IntersectionArc2Arc2.Contains(this.arc, vector2))
                {
                    this.Point0     = vector2;
                    this.Parameter0 = array[1];
                    int quantity = this.Quantity;
                    this.Quantity = quantity + 1;
                }
            }
            this.IntersectionType = ((this.Quantity > 0) ? Intersection.Type.IT_POINT : Intersection.Type.IT_EMPTY);
            return(this.IntersectionType > Intersection.Type.IT_EMPTY);
        }
Exemple #5
0
        /// <summary>
        /// 线和圆形相交
        /// </summary>
        /// <param name="line"></param>
        /// <param name="circle"></param>
        /// <returns></returns>
        public static bool Intersects(this Line2 line, Circle2 circle)
        {
            IntersectionLine2Circle2 intersectionLine2Circle = new IntersectionLine2Circle2(line, circle);

            return(intersectionLine2Circle.Find());
        }