// Token: 0x06000415 RID: 1045 RVA: 0x00012610 File Offset: 0x00010810 public static Vector3?IntersectionWith(this Segment3 segment, Triangle3 triangle) { IntersectionSegment3Triangle3 intersectionSegment3Triangle = new IntersectionSegment3Triangle3(segment, triangle); if (intersectionSegment3Triangle.Find() && intersectionSegment3Triangle.IntersectionType != Intersection.Type.IT_EMPTY) { return(new Vector3?(segment.Origin + intersectionSegment3Triangle.SegmentParameter * segment.Direction)); } return(null); }
// Token: 0x06000465 RID: 1125 RVA: 0x000142D4 File Offset: 0x000124D4 public bool Find() { Vector3[] array = new Vector3[] { this.triangle0.V1 - this.triangle0.V0, this.triangle0.V2 - this.triangle0.V1, this.triangle0.V0 - this.triangle0.V2 }; UnitVector3 unitVector; if (!array[0].TryGetUnitCross(array[1], out unitVector)) { int num = IntersectionUtility3.MaxIndex(array[0].SquaredLength, array[1].SquaredLength, array[2].SquaredLength); Segment3 segment = new Segment3(this.triangle0[num], this.triangle0[(num + 1) % 3]); IntersectionSegment3Triangle3 intersectionSegment3Triangle = new IntersectionSegment3Triangle3(segment, this.triangle1); bool result = intersectionSegment3Triangle.Find(); if (intersectionSegment3Triangle.IntersectionType == Intersection.Type.IT_POINT) { this.Points[0] = segment.Origin + intersectionSegment3Triangle.SegmentParameter * segment.Direction; this.Quantity = 1; this.IntersectionType = Intersection.Type.IT_POINT; } return(result); } Plane3 plane = new Plane3(this.triangle0.V0, this.triangle0.V1, this.triangle0.V2); int[] array2 = new int[3]; double[] array3 = new double[3]; int num2; int num3; int num4; IntersectionTriangle3Triangle3.TrianglePlaneRelations(this.triangle1, plane, ref array3, ref array2, out num2, out num3, out num4); if (num2 == 3 || num3 == 3) { return(false); } if (num4 == 3) { return(this.ReportCoplanarIntersections && this.GetCoplanarIntersection(plane, this.triangle0, this.triangle1)); } if (num2 == 0 || num3 == 0) { if (num4 == 2) { for (int i = 0; i < 3; i++) { if (array2[i] != 0) { int num5 = (i + 2) % 3; int num6 = (i + 1) % 3; return(this.IntersectsSegment(plane, this.triangle0, this.triangle1[num5], this.triangle1[num6])); } } } else { for (int i = 0; i < 3; i++) { if (array2[i] == 0) { return(this.ContainsPoint(this.triangle0, plane, this.triangle1[i])); } } } } if (num4 == 0) { int num7 = (num2 == 1) ? 1 : -1; for (int i = 0; i < 3; i++) { if (array2[i] == num7) { int num5 = (i + 2) % 3; int num6 = (i + 1) % 3; double scalar = array3[i] / (array3[i] - array3[num5]); Vector3 vector = this.triangle1[i] + scalar * (this.triangle1[num5] - this.triangle1[i]); scalar = array3[i] / (array3[i] - array3[num6]); Vector3 end = this.triangle1[i] + scalar * (this.triangle1[num6] - this.triangle1[i]); return(this.IntersectsSegment(plane, this.triangle0, vector, end)); } } } for (int i = 0; i < 3; i++) { if (array2[i] == 0) { int num5 = (i + 2) % 3; int num6 = (i + 1) % 3; double scalar = array3[num5] / (array3[num5] - array3[num6]); Vector3 vector = this.triangle1[num5] + scalar * (this.triangle1[num6] - this.triangle1[num5]); return(this.IntersectsSegment(plane, this.triangle0, this.triangle1[i], vector)); } } MathBase.Assert(false, "Triangle3Triangle3.Find(): should not be here"); return(false); }