// Token: 0x06000447 RID: 1095 RVA: 0x00013838 File Offset: 0x00011A38 public static bool Intersects(this Triangle3 triangle, AxisAlignedBox3 axisAlignedBox) { Box3 box = new Box3(axisAlignedBox.Center, UnitVector3.UnitX, UnitVector3.UnitY, UnitVector3.UnitZ, axisAlignedBox.ExtentX, axisAlignedBox.ExtentY, axisAlignedBox.ExtentZ); IntersectionTriangle3Box3 intersectionTriangle3Box = new IntersectionTriangle3Box3(triangle, box); return(intersectionTriangle3Box.Test()); }
// Token: 0x06000467 RID: 1127 RVA: 0x0001474C File Offset: 0x0001294C private static void TrianglePlaneRelations(Triangle3 triangle, Plane3 plane, ref double[] signedDistances, ref int[] signs, out int positive, out int negative, out int zero) { positive = 0; negative = 0; zero = 0; for (int i = 0; i < 3; i++) { signedDistances[i] = plane.Normal.Dot(triangle[i]) - plane.Constant; if (signedDistances[i] > 1E-08) { signs[i] = 1; positive++; } else if (signedDistances[i] < -1E-08) { signs[i] = -1; negative++; } else { signedDistances[i] = 0.0; signs[i] = 0; zero++; } } }
// Token: 0x0600015F RID: 351 RVA: 0x000070DC File Offset: 0x000052DC public DistanceRay3Triangle3(Ray3 ray, Triangle3 triangle) { this = default(DistanceRay3Triangle3); Line3 line = new Line3(ray.Origin, ray.Direction); DistanceLine3Triangle3 distanceLine3Triangle = new DistanceLine3Triangle3(line, triangle); if (distanceLine3Triangle.LineParameter >= 0.0) { this.SquaredDistance = distanceLine3Triangle.SquaredDistance; this.ClosestPointOnRay = distanceLine3Triangle.ClosestPointOnLine; this.ClosestPointOnTriangle = distanceLine3Triangle.ClosestPointOnTriangle; this.RayParameter = distanceLine3Triangle.LineParameter; this.TriangleBary0 = distanceLine3Triangle.TriangleBary0; this.TriangleBary1 = distanceLine3Triangle.TriangleBary1; this.TriangleBary2 = distanceLine3Triangle.TriangleBary2; return; } DistanceVector3Triangle3 distanceVector3Triangle = new DistanceVector3Triangle3(ray.Origin, triangle); this.SquaredDistance = distanceVector3Triangle.SquaredDistance; this.ClosestPointOnRay = ray.Origin; this.ClosestPointOnTriangle = distanceVector3Triangle.ClosestPointOnTriangle; this.RayParameter = 0.0; this.TriangleBary0 = distanceVector3Triangle.TriangleBary0; this.TriangleBary1 = distanceVector3Triangle.TriangleBary1; this.TriangleBary2 = distanceVector3Triangle.TriangleBary2; }
// Token: 0x06000454 RID: 1108 RVA: 0x000139BF File Offset: 0x00011BBF public IntersectionTriangle3Box3(Triangle3 triangle, Box3 box) { this = default(IntersectionTriangle3Box3); this.Points = new Vector3[7]; this.triangle = triangle; this.box = box; }
// Token: 0x06000466 RID: 1126 RVA: 0x000146E8 File Offset: 0x000128E8 private static void ProjectOntoAxis(Triangle3 tri, UnitVector3 axis, out double min, out double max) { double num = axis.Dot(tri.V0); double num2 = axis.Dot(tri.V1); double num3 = axis.Dot(tri.V2); min = num; max = min; if (num2 < min) { min = num2; } else if (num2 > max) { max = num2; } if (num3 < min) { min = num3; return; } if (num3 > max) { max = num3; } }
// Token: 0x0600046D RID: 1133 RVA: 0x000155B4 File Offset: 0x000137B4 public static void GetProjection(Vector3 axis, Triangle3 triangle, out double min, out double max) { double[] array = new double[] { axis.Dot(triangle.V0), axis.Dot(triangle.V1), axis.Dot(triangle.V2) }; min = array[0]; max = min; if (array[1] < min) { min = array[1]; } else if (array[1] > max) { max = array[1]; } if (array[2] < min) { min = array[2]; return; } if (array[2] > max) { max = array[2]; } }
// Token: 0x0600045B RID: 1115 RVA: 0x00013E97 File Offset: 0x00012097 public IntersectionTriangle3Triangle3(Triangle3 triangle0, Triangle3 triangle1) { this = default(IntersectionTriangle3Triangle3); this.Points = new Vector3[6]; this.triangle0 = triangle0; this.triangle1 = triangle1; this.ReportCoplanarIntersections = true; }
// Token: 0x0600036F RID: 879 RVA: 0x0000ECF0 File Offset: 0x0000CEF0 public static Vector3?IntersectionWith(this Line3 line, Triangle3 triangle3) { IntersectionLine3Triangle3 intersectionLine3Triangle = new IntersectionLine3Triangle3(line, triangle3); if (intersectionLine3Triangle.Find() && intersectionLine3Triangle.IntersectionType != Intersection.Type.IT_EMPTY) { return(new Vector3?(line.Origin + intersectionLine3Triangle.LineParameter * line.Direction)); } return(null); }
// 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: 0x060003C6 RID: 966 RVA: 0x00010DF8 File Offset: 0x0000EFF8 public static Vector3?IntersectionWith(this Ray3 ray, Triangle3 triangle) { IntersectionRay3Triangle3 intersectionRay3Triangle = new IntersectionRay3Triangle3(ray, triangle); if (intersectionRay3Triangle.Find() && intersectionRay3Triangle.IntersectionType != Intersection.Type.IT_EMPTY) { return(new Vector3?(ray.Origin + intersectionRay3Triangle.RayParameter * ray.Direction)); } return(null); }
// Token: 0x06000489 RID: 1161 RVA: 0x000168B0 File Offset: 0x00014AB0 public static AxisAlignedBox3 ComputeAxisAlignedBoundingBox(this Triangle3 triangle) { double minX = Math.Min(triangle.V0.X, Math.Min(triangle.V1.X, triangle.V2.X)); double minY = Math.Min(triangle.V0.Y, Math.Min(triangle.V1.Y, triangle.V2.Y)); double minZ = Math.Min(triangle.V0.Z, Math.Min(triangle.V1.Z, triangle.V2.Z)); double maxX = Math.Max(triangle.V0.X, Math.Max(triangle.V1.X, triangle.V2.X)); double maxY = Math.Max(triangle.V0.Y, Math.Max(triangle.V1.Y, triangle.V2.Y)); double maxZ = Math.Max(triangle.V0.Z, Math.Max(triangle.V1.Z, triangle.V2.Z)); return(new AxisAlignedBox3(minX, maxX, minY, maxY, minZ, maxZ)); }
// Token: 0x060003AE RID: 942 RVA: 0x000101AA File Offset: 0x0000E3AA public IntersectionPlane3Triangle3(Plane3 plane, Triangle3 triangle, double epsilon) { this = default(IntersectionPlane3Triangle3); this.plane = plane; this.triangle = triangle; if (epsilon >= 0.0) { this.epsilon = epsilon; return; } this.epsilon = 0.0; }
// Token: 0x06000446 RID: 1094 RVA: 0x000137EC File Offset: 0x000119EC public static ICollection <Vector3> IntersectionPointsWith(this Triangle3 triangle, Box3 box) { IntersectionTriangle3Box3 intersectionTriangle3Box = new IntersectionTriangle3Box3(triangle, box); intersectionTriangle3Box.Find(); List <Vector3> list = new List <Vector3>(); for (int i = 0; i < intersectionTriangle3Box.Quantity; i++) { list.Add(intersectionTriangle3Box.Points[i]); } return(list); }
// Token: 0x0600044A RID: 1098 RVA: 0x00013924 File Offset: 0x00011B24 public static ICollection <Vector3> IntersectionPointsWith(this Triangle3 triangle, Triangle3 other) { IntersectionTriangle3Triangle3 intersectionTriangle3Triangle = new IntersectionTriangle3Triangle3(triangle, other); intersectionTriangle3Triangle.Find(); List <Vector3> list = new List <Vector3>(); for (int i = 0; i < intersectionTriangle3Triangle.Quantity; i++) { list.Add(intersectionTriangle3Triangle.Points[i]); } return(list); }
// Token: 0x06000448 RID: 1096 RVA: 0x00013888 File Offset: 0x00011A88 public static ICollection <Vector3> IntersectionPointsWith(this Triangle3 triangle, AxisAlignedBox3 axisAlignedBox) { Box3 box = new Box3(axisAlignedBox.Center, UnitVector3.UnitX, UnitVector3.UnitY, UnitVector3.UnitZ, axisAlignedBox.ExtentX, axisAlignedBox.ExtentY, axisAlignedBox.ExtentZ); IntersectionTriangle3Box3 intersectionTriangle3Box = new IntersectionTriangle3Box3(triangle, box); intersectionTriangle3Box.Find(); List <Vector3> list = new List <Vector3>(); for (int i = 0; i < intersectionTriangle3Box.Quantity; i++) { list.Add(intersectionTriangle3Box.Points[i]); } return(list); }
// Token: 0x0600039A RID: 922 RVA: 0x0000FC34 File Offset: 0x0000DE34 public static Segment3?IntersectionWith(this Plane3 plane, Triangle3 triangle) { IntersectionPlane3Triangle3 intersectionPlane3Triangle = new IntersectionPlane3Triangle3(plane, triangle, 0.0); bool flag = intersectionPlane3Triangle.Find(); if (flag && intersectionPlane3Triangle.IntersectionType == Intersection.Type.IT_SEGMENT) { return(new Segment3?(new Segment3(intersectionPlane3Triangle.Point0, intersectionPlane3Triangle.Point1))); } if (flag && intersectionPlane3Triangle.IntersectionType == Intersection.Type.IT_POINT) { return(new Segment3?(new Segment3(intersectionPlane3Triangle.Point0, intersectionPlane3Triangle.Point0))); } return(null); }
// Token: 0x060001F6 RID: 502 RVA: 0x00008F28 File Offset: 0x00007128 public DistanceTriangle3Triangle3(Triangle3 triangle0, Triangle3 triangle1) { this = default(DistanceTriangle3Triangle3); double num = double.MaxValue; int index = 2; int i = 0; while (i < 3) { Segment3 segment = new Segment3(triangle0[index], triangle0[i]); DistanceSegment3Triangle3 distanceSegment3Triangle = new DistanceSegment3Triangle3(segment, triangle1); double squaredDistance = distanceSegment3Triangle.SquaredDistance; if (squaredDistance < num) { this.ClosestPoint0 = distanceSegment3Triangle.ClosestPointOnSegment; this.ClosestPoint1 = distanceSegment3Triangle.ClosestPointOnTriangle; num = squaredDistance; if (num <= 1E-08) { this.SquaredDistance = 0.0; return; } } index = i++; } int index2 = 2; int j = 0; while (j < 3) { Segment3 segment2 = new Segment3(triangle1[index2], triangle1[j]); DistanceSegment3Triangle3 distanceSegment3Triangle2 = new DistanceSegment3Triangle3(segment2, triangle0); double squaredDistance = distanceSegment3Triangle2.SquaredDistance; if (squaredDistance < num) { this.ClosestPoint0 = distanceSegment3Triangle2.ClosestPointOnTriangle; this.ClosestPoint1 = distanceSegment3Triangle2.ClosestPointOnSegment; num = squaredDistance; if (num <= 1E-08) { this.SquaredDistance = 0.0; return; } } index2 = j++; } this.SquaredDistance = num; }
// Token: 0x060001EE RID: 494 RVA: 0x00008D90 File Offset: 0x00006F90 public DistanceTriangle3Rectangle3(Triangle3 triangle, Rectangle3 rectangle) { this = default(DistanceTriangle3Rectangle3); double num = double.MaxValue; int i = 2; int j = 0; while (j < 3) { Segment3 segment = new Segment3(triangle[i], triangle[j]); DistanceSegment3Rectangle3 distanceSegment3Rectangle = new DistanceSegment3Rectangle3(segment, rectangle); if (distanceSegment3Rectangle.SquaredDistance < num) { this.ClosestPointOnTriangle = distanceSegment3Rectangle.ClosestPointOnSegment; this.ClosestPointOnRectangle = distanceSegment3Rectangle.ClosestPointOnRectangle; num = distanceSegment3Rectangle.SquaredDistance; } i = j++; } for (j = 0; j < 2; j++) { for (i = -1; i <= 1; i += 2) { double num2 = (j == 0) ? rectangle.Extent1 : rectangle.Extent0; UnitVector3 vector = (j == 0) ? rectangle.Axis1 : rectangle.Axis0; Vector3 origin = rectangle.Center + (double)i * num2 * vector; UnitVector3 direction = (j == 0) ? rectangle.Axis0 : rectangle.Axis1; double extent = (j == 0) ? rectangle.Extent0 : rectangle.Extent1; Segment3 segment2 = new Segment3(origin, direction, extent); DistanceSegment3Triangle3 distanceSegment3Triangle = new DistanceSegment3Triangle3(segment2, triangle); if (distanceSegment3Triangle.SquaredDistance < num) { this.ClosestPointOnTriangle = distanceSegment3Triangle.ClosestPointOnTriangle; this.ClosestPointOnRectangle = distanceSegment3Triangle.ClosestPointOnSegment; num = distanceSegment3Triangle.SquaredDistance; } } } this.SquaredDistance = num; }
// Token: 0x0600005E RID: 94 RVA: 0x00003258 File Offset: 0x00001458 public DistancePlane3Triangle3(Plane3 plane, Triangle3 triangle) { this = default(DistancePlane3Triangle3); DistanceVector3Plane3 distanceVector3Plane = new DistanceVector3Plane3(triangle.V0, plane); DistanceVector3Plane3 distanceVector3Plane2 = new DistanceVector3Plane3(triangle.V1, plane); DistanceVector3Plane3 distanceVector3Plane3 = new DistanceVector3Plane3(triangle.V2, plane); double signedDistance = distanceVector3Plane.SignedDistance; double signedDistance2 = distanceVector3Plane2.SignedDistance; double signedDistance3 = distanceVector3Plane3.SignedDistance; if (signedDistance > 0.0 && signedDistance2 > 0.0 && signedDistance3 > 0.0) { this.SignedDistance = Math.Min(signedDistance, Math.Min(signedDistance2, signedDistance3)); return; } if (signedDistance < 0.0 && signedDistance2 < 0.0 && signedDistance3 < 0.0) { this.SignedDistance = Math.Max(signedDistance, Math.Max(signedDistance2, signedDistance3)); return; } this.SignedDistance = 0.0; }
// Token: 0x060001CA RID: 458 RVA: 0x00008918 File Offset: 0x00006B18 public DistanceSegment3Triangle3(Segment3 segment, Triangle3 triangle) { this = default(DistanceSegment3Triangle3); Line3 line = new Line3(segment.Origin, segment.Direction); DistanceLine3Triangle3 distanceLine3Triangle = new DistanceLine3Triangle3(line, triangle); if (distanceLine3Triangle.LineParameter < -segment.Extent) { DistanceVector3Triangle3 distanceVector3Triangle = new DistanceVector3Triangle3(segment.NegativeEnd, triangle); this.SquaredDistance = distanceVector3Triangle.SquaredDistance; this.ClosestPointOnSegment = segment.NegativeEnd; this.ClosestPointOnTriangle = distanceVector3Triangle.ClosestPointOnTriangle; this.SegmentParameter = -segment.Extent; this.TriangleBary0 = distanceVector3Triangle.TriangleBary0; this.TriangleBary1 = distanceVector3Triangle.TriangleBary1; this.TriangleBary2 = distanceVector3Triangle.TriangleBary2; return; } if (distanceLine3Triangle.LineParameter <= segment.Extent) { this.SquaredDistance = distanceLine3Triangle.SquaredDistance; this.ClosestPointOnSegment = distanceLine3Triangle.ClosestPointOnLine; this.ClosestPointOnTriangle = distanceLine3Triangle.ClosestPointOnTriangle; this.SegmentParameter = distanceLine3Triangle.LineParameter; this.TriangleBary0 = distanceLine3Triangle.TriangleBary0; this.TriangleBary1 = distanceLine3Triangle.TriangleBary1; this.TriangleBary2 = distanceLine3Triangle.TriangleBary2; return; } DistanceVector3Triangle3 distanceVector3Triangle2 = new DistanceVector3Triangle3(segment.PositiveEnd, triangle); this.SquaredDistance = distanceVector3Triangle2.SquaredDistance; this.ClosestPointOnSegment = segment.PositiveEnd; this.ClosestPointOnTriangle = distanceVector3Triangle2.ClosestPointOnTriangle; this.SegmentParameter = segment.Extent; this.TriangleBary0 = distanceVector3Triangle2.TriangleBary0; this.TriangleBary1 = distanceVector3Triangle2.TriangleBary1; this.TriangleBary2 = distanceVector3Triangle2.TriangleBary2; }
// Token: 0x06000468 RID: 1128 RVA: 0x000147E8 File Offset: 0x000129E8 private bool ContainsPoint(Triangle3 triangle, Plane3 plane, Vector3 point) { AffineTransform3 affineTransform = Transform3Factory.CreateOrthonormalBasis(plane.Normal); UnitVector3 axisX = affineTransform.AxisX; UnitVector3 axisY = affineTransform.AxisY; Vector3 vector = point - triangle.V0; Vector3 vector2 = triangle.V1 - triangle.V0; Vector3 vector3 = triangle.V2 - triangle.V0; Vector2 rkP = new Vector2(axisX.Dot(vector), axisY.Dot(vector)); Vector2[] vertices = new Vector2[] { Vector2.Zero, new Vector2(axisX.Dot(vector2), axisY.Dot(vector2)), new Vector2(axisX.Dot(vector3), axisY.Dot(vector3)) }; if (new IntersectionTriangle3Triangle3.Query2(3, vertices).ToTriangle(rkP, 0, 1, 2) <= 0) { this.Quantity = 1; this.Points[0] = point; return(true); } return(false); }
// Token: 0x0600009D RID: 157 RVA: 0x00003B68 File Offset: 0x00001D68 public static Segment3 ShortestSegmentTo(this Line3 line3, Triangle3 triangle3) { DistanceLine3Triangle3 distanceLine3Triangle = new DistanceLine3Triangle3(line3, triangle3); return(new Segment3(distanceLine3Triangle.ClosestPointOnLine, distanceLine3Triangle.ClosestPointOnTriangle)); }
// Token: 0x0600009C RID: 156 RVA: 0x00003B48 File Offset: 0x00001D48 public static Vector3 ClosestPointTo(this Line3 line3, Triangle3 triangle3) { DistanceLine3Triangle3 distanceLine3Triangle = new DistanceLine3Triangle3(line3, triangle3); return(distanceLine3Triangle.ClosestPointOnLine); }
// Token: 0x0600009B RID: 155 RVA: 0x00003B28 File Offset: 0x00001D28 public static double DistanceTo(this Line3 line3, Triangle3 triangle3) { DistanceLine3Triangle3 distanceLine3Triangle = new DistanceLine3Triangle3(line3, triangle3); return(distanceLine3Triangle.Distance); }
// Token: 0x06000337 RID: 823 RVA: 0x0000D190 File Offset: 0x0000B390 public static ICollection <Vector3> IntersectionPointsWith(this Box3 box3, Triangle3 triangle3) { return(triangle3.IntersectionPointsWith(box3)); }
// Token: 0x06000336 RID: 822 RVA: 0x0000D187 File Offset: 0x0000B387 public static bool Intersects(this Box3 box3, Triangle3 triangle3) { return(triangle3.Intersects(box3)); }
// Token: 0x060003C5 RID: 965 RVA: 0x00010DD8 File Offset: 0x0000EFD8 public static bool Intersects(this Ray3 ray, Triangle3 triangle) { IntersectionRay3Triangle3 intersectionRay3Triangle = new IntersectionRay3Triangle3(ray, triangle); return(intersectionRay3Triangle.Find()); }
// Token: 0x06000206 RID: 518 RVA: 0x00009244 File Offset: 0x00007444 public static double DistanceTo(this Vector3 vector3, Triangle3 triangle3) { DistanceVector3Triangle3 distanceVector3Triangle = new DistanceVector3Triangle3(vector3, triangle3); return(distanceVector3Triangle.Distance); }
// Token: 0x06000207 RID: 519 RVA: 0x00009264 File Offset: 0x00007464 public static Segment3 ShortestSegmentTo(this Vector3 vector3, Triangle3 triangle3) { DistanceVector3Triangle3 distanceVector3Triangle = new DistanceVector3Triangle3(vector3, triangle3); return(new Segment3(distanceVector3Triangle.ClosestPointOnVector, distanceVector3Triangle.ClosestPointOnTriangle)); }
// Token: 0x06000180 RID: 384 RVA: 0x0000746C File Offset: 0x0000566C public static Segment3 ShortestSegmentTo(this Rectangle3 rectangle, Triangle3 triangle) { DistanceTriangle3Rectangle3 distanceTriangle3Rectangle = new DistanceTriangle3Rectangle3(triangle, rectangle); return(new Segment3(distanceTriangle3Rectangle.ClosestPointOnRectangle, distanceTriangle3Rectangle.ClosestPointOnTriangle)); }