// Token: 0x06000407 RID: 1031 RVA: 0x00011FA8 File Offset: 0x000101A8
        public bool Test()
        {
            double[] dist = new double[3];
            int[]    sign = new int[3];
            int      num;
            int      num2;
            int      num3;

            IntersectionLine2Triangle2.TriangleLineRelations(this.segment.Origin, this.segment.Direction, this.triangle, ref dist, ref sign, out num, out num2, out num3);
            if (num == 3 || num2 == 3)
            {
                this.IntersectionType = Intersection.Type.IT_EMPTY;
            }
            else
            {
                double[] array = new double[2];
                IntersectionLine2Triangle2.GetInterval(this.segment.Origin, this.segment.Direction, this.triangle, dist, sign, ref array);
                Intersector1 intersector = new Intersector1(array[0], array[1], -this.segment.Extent, this.segment.Extent);
                intersector.Find();
                this.Quantity = intersector.Quantity;
                if (this.Quantity == 2)
                {
                    this.IntersectionType = Intersection.Type.IT_SEGMENT;
                }
                else if (this.Quantity == 1)
                {
                    this.IntersectionType = Intersection.Type.IT_POINT;
                }
                else
                {
                    this.IntersectionType = Intersection.Type.IT_EMPTY;
                }
            }
            return(this.IntersectionType > Intersection.Type.IT_EMPTY);
        }
Exemplo n.º 2
0
 // Token: 0x0600029B RID: 667 RVA: 0x0000AD58 File Offset: 0x00008F58
 public bool Find()
 {
     double[] array = new double[2];
     this.IntersectionType = IntersectionLine2Line2.Classify(this.ray.Origin, this.ray.Direction, this.segment.Origin, this.segment.Direction, 1E-08, ref array);
     if (this.IntersectionType == Intersection.Type.IT_POINT)
     {
         if (array[0] >= 0.0 && Math.Abs(array[1]) <= this.segment.Extent)
         {
             this.Point0 = this.ray.Origin + array[0] * this.ray.Direction;
         }
         else
         {
             this.IntersectionType = Intersection.Type.IT_EMPTY;
         }
     }
     else if (this.IntersectionType == Intersection.Type.IT_LINE)
     {
         double       num         = this.ray.Direction.Dot(this.segment.Origin - this.ray.Origin);
         double       v           = num - this.segment.Extent;
         double       v2          = num + this.segment.Extent;
         Intersector1 intersector = new Intersector1(0.0, double.MaxValue, v, v2);
         intersector.Find();
         int quantity = intersector.Quantity;
         if (quantity == 2)
         {
             this.IntersectionType = Intersection.Type.IT_SEGMENT;
             this.Point0           = this.ray.Origin + intersector.Overlap0 * this.ray.Direction;
             this.Point1           = this.ray.Origin + intersector.Overlap1 * this.ray.Direction;
         }
         else if (quantity == 1)
         {
             this.IntersectionType = Intersection.Type.IT_POINT;
             this.Point0           = this.ray.Origin;
         }
         else
         {
             this.IntersectionType = Intersection.Type.IT_EMPTY;
         }
     }
     return(this.IntersectionType > Intersection.Type.IT_EMPTY);
 }
Exemplo n.º 3
0
        // Token: 0x0600035E RID: 862 RVA: 0x0000E530 File Offset: 0x0000C730
        public bool Find()
        {
            double[] dist = new double[3];
            int[]    sign = new int[3];
            int      num;
            int      num2;
            int      num3;

            IntersectionLine2Triangle2.TriangleLineRelations(this.line.Origin, this.line.Direction, this.triangle, ref dist, ref sign, out num, out num2, out num3);
            if (num == 3 || num2 == 3)
            {
                this.Quantity         = 0;
                this.IntersectionType = Intersection.Type.IT_EMPTY;
            }
            else
            {
                double[] array = new double[2];
                IntersectionLine2Triangle2.GetInterval(this.line.Origin, this.line.Direction, this.triangle, dist, sign, ref array);
                Intersector1 intersector = new Intersector1(array[0], array[1], double.MinValue, double.MaxValue);
                intersector.Find();
                this.Quantity = intersector.Quantity;
                if (this.Quantity == 2)
                {
                    this.IntersectionType = Intersection.Type.IT_SEGMENT;
                    this.Point0           = this.line.Origin + intersector.Overlap0 * this.line.Direction;
                    this.Point1           = this.line.Origin + intersector.Overlap1 * this.line.Direction;
                }
                else if (this.Quantity == 1)
                {
                    this.IntersectionType = Intersection.Type.IT_POINT;
                    this.Point0           = this.line.Origin + intersector.Overlap0 * this.line.Direction;
                }
                else
                {
                    this.IntersectionType = Intersection.Type.IT_EMPTY;
                }
            }
            return(this.IntersectionType > Intersection.Type.IT_EMPTY);
        }