// Token: 0x06000414 RID: 1044 RVA: 0x000125F0 File Offset: 0x000107F0 public static bool Intersects(this Segment3 segment, Triangle3 triangle) { IntersectionSegment3Triangle3 intersectionSegment3Triangle = new IntersectionSegment3Triangle3(segment, triangle); return(intersectionSegment3Triangle.Test()); }
// Token: 0x06000464 RID: 1124 RVA: 0x00013F08 File Offset: 0x00012108 public bool Test() { Vector3[] array = new Vector3[] { this.triangle0.V1 - this.triangle0.V0, this.triangle0.V2 - this.triangle0.V1, this.triangle0.V0 - this.triangle0.V2 }; UnitVector3 axis; if (!array[0].TryGetUnitCross(array[1], out axis)) { 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); return(intersectionSegment3Triangle.Test()); } double num2 = axis.Dot(this.triangle0.V0); double num3; double num4; IntersectionTriangle3Triangle3.ProjectOntoAxis(this.triangle1, axis, out num3, out num4); if (num2 < num3 || num2 > num4) { return(false); } Vector3[] array2 = new Vector3[] { this.triangle1.V1 - this.triangle1.V0, this.triangle1.V2 - this.triangle1.V1, this.triangle1.V0 - this.triangle1.V2 }; UnitVector3 unitVector; if (!array2[0].TryGetUnitCross(array2[1], out unitVector)) { int num5 = IntersectionUtility3.MaxIndex(array2[0].SquaredLength, array2[1].SquaredLength, array2[2].SquaredLength); Segment3 segment2 = new Segment3(this.triangle1[num5], this.triangle1[(num5 + 1) % 3]); IntersectionSegment3Triangle3 intersectionSegment3Triangle2 = new IntersectionSegment3Triangle3(segment2, this.triangle0); return(intersectionSegment3Triangle2.Test()); } Vector3 vector = new Vector3(); if (axis.Cross(unitVector).Dot(vector) >= 1E-08) { double num6 = unitVector.Dot(this.triangle1.V0); double num7; double num8; IntersectionTriangle3Triangle3.ProjectOntoAxis(this.triangle0, unitVector, out num7, out num8); if (num6 < num7 || num6 > num8) { return(false); } for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { UnitVector3 axis2; if (array[j].TryGetUnitCross(array2[i], out axis2)) { IntersectionTriangle3Triangle3.ProjectOntoAxis(this.triangle0, axis2, out num7, out num8); IntersectionTriangle3Triangle3.ProjectOntoAxis(this.triangle1, axis2, out num3, out num4); if (num8 < num3 || num4 < num7) { return(false); } } } } } else { for (int j = 0; j < 3; j++) { UnitVector3 axis3; if (axis.TryGetUnitCross(array[j], out axis3)) { double num7; double num8; IntersectionTriangle3Triangle3.ProjectOntoAxis(this.triangle0, axis3, out num7, out num8); IntersectionTriangle3Triangle3.ProjectOntoAxis(this.triangle1, axis3, out num3, out num4); if (num8 < num3 || num4 < num7) { return(false); } } } for (int i = 0; i < 3; i++) { UnitVector3 axis4; if (unitVector.TryGetUnitCross(array2[i], out axis4)) { double num7; double num8; IntersectionTriangle3Triangle3.ProjectOntoAxis(this.triangle0, axis4, out num7, out num8); IntersectionTriangle3Triangle3.ProjectOntoAxis(this.triangle1, axis4, out num3, out num4); if (num8 < num3 || num4 < num7) { return(false); } } } } return(true); }