コード例 #1
0
 // Token: 0x0600043A RID: 1082 RVA: 0x00013196 File Offset: 0x00011396
 public static Segment2?IntersectionWith(this Triangle2 triangle, Segment2 segment)
 {
     return(segment.IntersectionWith(triangle));
 }
コード例 #2
0
 // Token: 0x0600043B RID: 1083 RVA: 0x0001319F File Offset: 0x0001139F
 public static ICollection <Vector2> IntersectionPointsWith(this Triangle2 triangle, Segment2 segment)
 {
     return(segment.IntersectionPointsWith(triangle));
 }
コード例 #3
0
        // Token: 0x06000469 RID: 1129 RVA: 0x000148E0 File Offset: 0x00012AE0
        private bool IntersectsSegment(Plane3 plane, Triangle3 triangle, Vector3 end0, Vector3 end1)
        {
            int    num  = 0;
            double num2 = Math.Abs(plane.Normal.X);
            double num3 = Math.Abs(plane.Normal.Y);

            if (num3 > num2)
            {
                num  = 1;
                num2 = num3;
            }
            num3 = Math.Abs(plane.Normal.Z);
            if (num3 > num2)
            {
                num = 2;
            }
            Triangle2 triangle2;
            Vector2   end2;
            Vector2   end3;

            if (num == 0)
            {
                triangle2 = new Triangle2(new Vector2(triangle.V0.Y, triangle.V0.Z), new Vector2(triangle.V1.Y, triangle.V1.Z), new Vector2(triangle.V2.Y, triangle.V2.Z));
                end2      = new Vector2(end0.Y, end0.Z);
                end3      = new Vector2(end1.Y, end1.Z);
            }
            else if (num == 1)
            {
                triangle2 = new Triangle2(new Vector2(triangle.V0.X, triangle.V0.Z), new Vector2(triangle.V1.X, triangle.V1.Z), new Vector2(triangle.V2.X, triangle.V2.Z));
                end2      = new Vector2(end0.X, end0.Z);
                end3      = new Vector2(end1.X, end1.Z);
            }
            else
            {
                triangle2 = new Triangle2(new Vector2(triangle.V0.X, triangle.V0.Y), new Vector2(triangle.V1.X, triangle.V1.Y), new Vector2(triangle.V2.X, triangle.V2.Y));
                end2      = new Vector2(end0.X, end0.Y);
                end3      = new Vector2(end1.X, end1.Y);
            }
            Segment2 segment = new Segment2(end2, end3);
            IntersectionSegment2Triangle2 intersectionSegment2Triangle = new IntersectionSegment2Triangle2(segment, triangle2);

            if (!intersectionSegment2Triangle.Find())
            {
                return(false);
            }
            Vector2[] array = new Vector2[2];
            if (intersectionSegment2Triangle.IntersectionType == Intersection.Type.IT_SEGMENT)
            {
                this.IntersectionType = Intersection.Type.IT_SEGMENT;
                this.Quantity         = 2;
                array[0] = intersectionSegment2Triangle.Point0;
                array[1] = intersectionSegment2Triangle.Point1;
            }
            else
            {
                MathBase.Assert(intersectionSegment2Triangle.IntersectionType == Intersection.Type.IT_POINT, "Triangle3Triangle3.IntersectsSegment(): intersection type is not point");
                this.IntersectionType = Intersection.Type.IT_POINT;
                this.Quantity         = 1;
                array[0] = intersectionSegment2Triangle.Point0;
            }
            if (num == 0)
            {
                double num4 = 1.0 / plane.Normal.X;
                for (int i = 0; i < this.Quantity; i++)
                {
                    this.Points[i].Y = array[i].X;
                    this.Points[i].Z = array[i].Y;
                    this.Points[i].X = num4 * (plane.Constant - plane.Normal.Y * this.Points[i].Y - plane.Normal.Z * this.Points[i].Z);
                }
            }
            else if (num == 1)
            {
                double num5 = 1.0 / plane.Normal.Y;
                for (int i = 0; i < this.Quantity; i++)
                {
                    this.Points[i].X = array[i].X;
                    this.Points[i].Z = array[i].Y;
                    this.Points[i].Y = num5 * (plane.Constant - plane.Normal.X * this.Points[i].X - plane.Normal.Z * this.Points[i].Z);
                }
            }
            else
            {
                double num6 = 1.0 / plane.Normal.Z;
                for (int i = 0; i < this.Quantity; i++)
                {
                    this.Points[i].X = array[i].X;
                    this.Points[i].Y = array[i].Y;
                    this.Points[i].Z = num6 * (plane.Constant - plane.Normal.X * this.Points[i].X - plane.Normal.Y * this.Points[i].Y);
                }
            }
            return(true);
        }
コード例 #4
0
 // Token: 0x06000439 RID: 1081 RVA: 0x0001318D File Offset: 0x0001138D
 public static bool Intersects(this Triangle2 triangle, Segment2 segment)
 {
     return(segment.Intersects(triangle));
 }
コード例 #5
0
 // Token: 0x060003EC RID: 1004 RVA: 0x00011A70 File Offset: 0x0000FC70
 public static Vector2?IntersectionWith(this Segment2 segment, Ray2 ray)
 {
     return(ray.IntersectionWith(segment));
 }
コード例 #6
0
        // Token: 0x060003ED RID: 1005 RVA: 0x00011A7C File Offset: 0x0000FC7C
        public static bool Intersects(this Segment2 segment, Box2 box)
        {
            IntersectionSegment2Box2 intersectionSegment2Box = new IntersectionSegment2Box2(segment, box, true);

            return(intersectionSegment2Box.Test());
        }
コード例 #7
0
 // Token: 0x060003EB RID: 1003 RVA: 0x00011A67 File Offset: 0x0000FC67
 public static bool Intersects(this Segment2 segment, Ray2 ray)
 {
     return(ray.Intersects(segment));
 }
コード例 #8
0
        // Token: 0x060003F0 RID: 1008 RVA: 0x00011B84 File Offset: 0x0000FD84
        public static bool Intersects(this Segment2 segment, Triangle2 triangle)
        {
            IntersectionSegment2Triangle2 intersectionSegment2Triangle = new IntersectionSegment2Triangle2(segment, triangle);

            return(intersectionSegment2Triangle.Test());
        }
コード例 #9
0
ファイル: IntersectionBox2.cs プロジェクト: mh-soft/mh-master
 // Token: 0x06000328 RID: 808 RVA: 0x0000CF16 File Offset: 0x0000B116
 public static ICollection <Vector2> IntersectionPointsWith(this Box2 box, Segment2 segment)
 {
     return(segment.IntersectionPointsWith(box));
 }
コード例 #10
0
ファイル: IntersectionBox2.cs プロジェクト: mh-soft/mh-master
 // Token: 0x06000326 RID: 806 RVA: 0x0000CF04 File Offset: 0x0000B104
 public static Segment2?IntersectionWith(this Box2 box, Segment2 segment)
 {
     return(segment.IntersectionWith(box));
 }
コード例 #11
0
ファイル: IntersectionBox2.cs プロジェクト: mh-soft/mh-master
 // Token: 0x06000324 RID: 804 RVA: 0x0000CEF2 File Offset: 0x0000B0F2
 public static bool Intersects(this Box2 box, Segment2 segment2)
 {
     return(segment2.Intersects(box));
 }