// Token: 0x060004B6 RID: 1206 RVA: 0x00018328 File Offset: 0x00016528 public static UnitVector3 Transform(this AffineTransform3 transformer, UnitVector3 input) { return((transformer.AxisX * input.X + transformer.AxisY * input.Y + transformer.AxisZ * input.Z).GetNormalized()); }
// Token: 0x060000D9 RID: 217 RVA: 0x000052B4 File Offset: 0x000034B4 public DistanceLine3Rectangle3(Line3 line, Rectangle3 rectangle) { this = default(DistanceLine3Rectangle3); if (Math.Abs(rectangle.Axis0.Cross(rectangle.Axis1).Dot(line.Direction)) > 1E-08) { Vector3 vector = line.Origin - rectangle.Center; UnitVector3 direction = line.Direction; AffineTransform3 affineTransform = Transform3Factory.CreateOrthonormalBasis(direction); double num = affineTransform.AxisX.Dot(rectangle.Axis0); double num2 = affineTransform.AxisX.Dot(rectangle.Axis1); double num3 = affineTransform.AxisX.Dot(vector); double num4 = affineTransform.AxisY.Dot(rectangle.Axis0); double num5 = affineTransform.AxisY.Dot(rectangle.Axis1); double num6 = affineTransform.AxisY.Dot(vector); double num7 = 1.0 / (num * num5 - num2 * num4); double num8 = (num5 * num3 - num2 * num6) * num7; double num9 = (num * num6 - num4 * num3) * num7; if (Math.Abs(num8) <= rectangle.Extent0 && Math.Abs(num9) <= rectangle.Extent1) { double num10 = direction.Dot(rectangle.Axis0); double num11 = direction.Dot(rectangle.Axis1); double num12 = line.Direction.Dot(vector); this.LineParameter = num8 * num10 + num9 * num11 - num12; this.RectCoord0 = num8; this.RectCoord1 = num9; this.ClosestPointOnLine = line.Origin + this.LineParameter * line.Direction; this.ClosestPointOnRectangle = rectangle.Center + num8 * rectangle.Axis0 + num9 * rectangle.Axis1; this.SquaredDistance = 0.0; return; } } double num13 = double.MaxValue; Vector3[] array = new Vector3[] { rectangle.Extent0 *rectangle.Axis0, rectangle.Extent1 *rectangle.Axis1 }; for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { Vector3 origin = rectangle.Center + (double)(2 * j - 1) * array[i]; UnitVector3 direction2 = (i == 0) ? rectangle.Axis1 : rectangle.Axis0; double extent = (i == 0) ? rectangle.Extent1 : rectangle.Extent0; Segment3 segment = new Segment3(origin, direction2, extent); DistanceLine3Segment3 distanceLine3Segment = new DistanceLine3Segment3(line, segment); double squaredDistance = distanceLine3Segment.SquaredDistance; if (squaredDistance < num13) { this.ClosestPointOnLine = distanceLine3Segment.ClosestPointOnLine; this.ClosestPointOnRectangle = distanceLine3Segment.ClosestPointOnSegment; num13 = squaredDistance; this.LineParameter = distanceLine3Segment.LineParameter; double num14 = distanceLine3Segment.SegmentParameter / segment.Extent; this.RectCoord0 = rectangle.Extent0 * ((double)((1 - i) * (2 * j - 1)) + (double)i * num14); this.RectCoord1 = rectangle.Extent1 * ((double)((1 - j) * (2 * i - 1)) + (double)j * num14); } } } this.SquaredDistance = num13; }
// Token: 0x060001E6 RID: 486 RVA: 0x0000A6EC File Offset: 0x000088EC public AffineTransform3(UnitVector3 axisX, UnitVector3 axisY, UnitVector3 axisZ) { this = new AffineTransform3(axisX, axisY, axisZ, Vector3.Zero); }
// Token: 0x060001E7 RID: 487 RVA: 0x0000A6FC File Offset: 0x000088FC public AffineTransform3(UnitVector3 axisX, UnitVector3 axisY) { this = new AffineTransform3(axisX, axisY, axisX.UnitCross(axisY)); }
// Token: 0x060000F3 RID: 243 RVA: 0x000058E0 File Offset: 0x00003AE0 public DistanceLine3Triangle3(Line3 line, Triangle3 triangle) { this = default(DistanceLine3Triangle3); Vector3 vector = triangle.V1 - triangle.V0; Vector3 vector2 = triangle.V2 - triangle.V0; UnitVector3 unitVector; if (vector.TryGetUnitCross(vector2, out unitVector) && Math.Abs(unitVector.Dot(line.Direction)) > 1E-08) { Vector3 vector3 = line.Origin - triangle.V0; UnitVector3 direction = line.Direction; AffineTransform3 affineTransform = Transform3Factory.CreateOrthonormalBasis(direction); double num = affineTransform.AxisX.Dot(vector); double num2 = affineTransform.AxisX.Dot(vector2); double num3 = affineTransform.AxisX.Dot(vector3); double num4 = affineTransform.AxisY.Dot(vector); double num5 = affineTransform.AxisY.Dot(vector2); double num6 = affineTransform.AxisY.Dot(vector3); double num7 = 1.0 / (num * num5 - num2 * num4); double num8 = (num5 * num3 - num2 * num6) * num7; double num9 = (num * num6 - num4 * num3) * num7; double num10 = 1.0 - num8 - num9; if (num10 >= 0.0 && num8 >= 0.0 && num9 >= 0.0) { double num11 = direction.Dot(vector); double num12 = direction.Dot(vector2); double num13 = line.Direction.Dot(vector3); this.LineParameter = num8 * num11 + num9 * num12 - num13; this.TriangleBary0 = num10; this.TriangleBary1 = num8; this.TriangleBary2 = num9; this.ClosestPointOnLine = line.Origin + this.LineParameter * line.Direction; this.ClosestPointOnTriangle = triangle.V0 + num8 * vector + num9 * vector2; this.SquaredDistance = 0.0; return; } } Segment3 segment = new Segment3(triangle.V2, triangle.V0); DistanceLine3Segment3 distanceLine3Segment = new DistanceLine3Segment3(line, segment); this.ClosestPointOnLine = distanceLine3Segment.ClosestPointOnLine; this.ClosestPointOnTriangle = distanceLine3Segment.ClosestPointOnSegment; this.SquaredDistance = distanceLine3Segment.SquaredDistance; this.LineParameter = distanceLine3Segment.LineParameter; this.TriangleBary2 = 0.5 * (1.0 - distanceLine3Segment.SegmentParameter / segment.Extent); this.TriangleBary0 = 1.0 - this.TriangleBary2; this.TriangleBary1 = 0.0; Segment3 segment2 = new Segment3(triangle.V0, triangle.V1); DistanceLine3Segment3 distanceLine3Segment2 = new DistanceLine3Segment3(line, segment2); if (distanceLine3Segment2.SquaredDistance < this.SquaredDistance) { this.ClosestPointOnLine = distanceLine3Segment2.ClosestPointOnLine; this.ClosestPointOnTriangle = distanceLine3Segment2.ClosestPointOnSegment; this.SquaredDistance = distanceLine3Segment2.SquaredDistance; this.LineParameter = distanceLine3Segment2.LineParameter; this.TriangleBary0 = 0.5 * (1.0 - distanceLine3Segment2.SegmentParameter / segment2.Extent); this.TriangleBary1 = 1.0 - this.TriangleBary0; this.TriangleBary2 = 0.0; } Segment3 segment3 = new Segment3(triangle.V1, triangle.V2); DistanceLine3Segment3 distanceLine3Segment3 = new DistanceLine3Segment3(line, segment3); if (distanceLine3Segment3.SquaredDistance < this.SquaredDistance) { this.ClosestPointOnLine = distanceLine3Segment3.ClosestPointOnLine; this.ClosestPointOnTriangle = distanceLine3Segment3.ClosestPointOnSegment; this.SquaredDistance = distanceLine3Segment3.SquaredDistance; this.LineParameter = distanceLine3Segment3.LineParameter; this.TriangleBary1 = 0.5 * (1.0 - distanceLine3Segment3.SegmentParameter / segment3.Extent); this.TriangleBary2 = 1.0 - this.TriangleBary1; this.TriangleBary0 = 0.0; } }
// Token: 0x060001E5 RID: 485 RVA: 0x0000A6D6 File Offset: 0x000088D6 public AffineTransform3(UnitVector3 axisX, UnitVector3 axisY, UnitVector3 axisZ, Vector3 origin) { this = new AffineTransform3(axisX, axisY, axisZ, origin, 1.0); }
// Token: 0x06000113 RID: 275 RVA: 0x0000513A File Offset: 0x0000333A public Line3(Vector3 origin, UnitVector3 direction) { this = default(Line3); this.Origin = origin; this.Direction = direction; }
// Token: 0x060001A8 RID: 424 RVA: 0x000099B6 File Offset: 0x00007BB6 public Ray3(Vector3 origin, UnitVector3 direction) { this = default(Ray3); this.Origin = origin; this.Direction = direction; }
// Token: 0x06000483 RID: 1155 RVA: 0x00016320 File Offset: 0x00014520 public static AxisAlignedBox3 ComputeAxisAlignedBoundingBox(this Arc3 arc) { AxisAlignedBox3 axisAlignedBox = arc.Circle.ComputeAxisAlignedBoundingBox(); double minX = axisAlignedBox.MinX; double maxX = axisAlignedBox.MaxX; double minY = axisAlignedBox.MinY; double maxY = axisAlignedBox.MaxY; double minZ = axisAlignedBox.MinZ; double maxZ = axisAlignedBox.MaxZ; Vector3 startPoint = arc.StartPoint; Vector3 endPoint = arc.EndPoint; UnitVector3 unitVector; if (arc.Circle.Normal.TryGetUnitCross(UnitVector3.UnitX, out unitVector)) { UnitVector3 vector = unitVector.UnitCross(arc.Circle.Normal); double num = Math.Acos(arc.Circle.UnitU.Dot(vector)); if (arc.Circle.UnitV.Dot(UnitVector3.UnitX) < 0.0) { num = 6.2831853071795862 - num; } if (!arc.Contains(Angle.FromRadians(num))) { maxX = Math.Max(startPoint.X, endPoint.X); } if (!arc.Contains(Angle.FromRadians((num + 3.1415926535897931) % 6.2831853071795862))) { minX = Math.Min(startPoint.X, endPoint.X); } } UnitVector3 unitVector2; if (arc.Circle.Normal.TryGetUnitCross(UnitVector3.UnitY, out unitVector2)) { UnitVector3 vector2 = unitVector2.UnitCross(arc.Circle.Normal); double num2 = Math.Acos(arc.Circle.UnitU.Dot(vector2)); if (arc.Circle.UnitV.Dot(UnitVector3.UnitY) < 0.0) { num2 = 6.2831853071795862 - num2; } if (!arc.Contains(Angle.FromRadians(num2))) { maxY = Math.Max(startPoint.Y, endPoint.Y); } if (!arc.Contains(Angle.FromRadians((num2 + 3.1415926535897931) % 6.2831853071795862))) { minY = Math.Min(startPoint.Y, endPoint.Y); } } UnitVector3 unitVector3; if (arc.Circle.Normal.TryGetUnitCross(UnitVector3.UnitZ, out unitVector3)) { UnitVector3 vector3 = unitVector3.UnitCross(arc.Circle.Normal); double num3 = Math.Acos(arc.Circle.UnitU.Dot(vector3)); if (arc.Circle.UnitV.Dot(UnitVector3.UnitZ) < 0.0) { num3 = 6.2831853071795862 - num3; } if (!arc.Contains(Angle.FromRadians(num3))) { maxZ = Math.Max(startPoint.Z, endPoint.Z); } if (!arc.Contains(Angle.FromRadians((num3 + 3.1415926535897931) % 6.2831853071795862))) { minZ = Math.Min(startPoint.Z, endPoint.Z); } } return(new AxisAlignedBox3(minX, maxX, minY, maxY, minZ, maxZ)); }
// Token: 0x06000459 RID: 1113 RVA: 0x00013A04 File Offset: 0x00011C04 public bool Test() { Vector3[] array = new Vector3[3]; array[0] = this.triangle.V1 - this.triangle.V0; array[1] = this.triangle.V2 - this.triangle.V0; Vector3 axis = array[0].Cross(array[1]); double num = axis.Dot(this.triangle.V0); double num2 = num; double num3; double num4; IntersectionUtility3.GetProjection(axis, this.box, out num3, out num4); if (num4 < num || num2 < num3) { return(false); } UnitVector3 unitVector = this.box.Axis0; IntersectionUtility3.GetProjection((Vector3)unitVector, this.triangle, out num, out num2); double num5 = unitVector.Dot(this.box.Center); num3 = num5 - this.box.Extent0; num4 = num5 + this.box.Extent0; if (num4 < num || num2 < num3) { return(false); } unitVector = this.box.Axis1; IntersectionUtility3.GetProjection((Vector3)unitVector, this.triangle, out num, out num2); double num6 = unitVector.Dot(this.box.Center); num3 = num6 - this.box.Extent1; num4 = num6 + this.box.Extent1; if (num4 < num || num2 < num3) { return(false); } unitVector = this.box.Axis2; IntersectionUtility3.GetProjection((Vector3)unitVector, this.triangle, out num, out num2); double num7 = unitVector.Dot(this.box.Center); num3 = num7 - this.box.Extent2; num4 = num7 + this.box.Extent2; if (num4 < num || num2 < num3) { return(false); } array[2] = array[1] - array[0]; for (int i = 0; i < 3; i++) { Vector3 axis2 = array[i].Cross(this.box.Axis0); IntersectionUtility3.GetProjection(axis2, this.triangle, out num, out num2); IntersectionUtility3.GetProjection(axis2, this.box, out num3, out num4); if (num4 < num || num2 < num3) { return(false); } Vector3 axis3 = array[i].Cross(this.box.Axis1); IntersectionUtility3.GetProjection(axis3, this.triangle, out num, out num2); IntersectionUtility3.GetProjection(axis3, this.box, out num3, out num4); if (num4 < num || num2 < num3) { return(false); } Vector3 axis4 = array[i].Cross(this.box.Axis2); IntersectionUtility3.GetProjection(axis4, this.triangle, out num, out num2); IntersectionUtility3.GetProjection(axis4, this.box, out num3, out num4); if (num4 < num || num2 < num3) { return(false); } } return(true); }
// Token: 0x060004DC RID: 1244 RVA: 0x000194CC File Offset: 0x000176CC internal static void GenerateComplementBasis(out UnitVector3 u, out UnitVector3 v, UnitVector3 w) { Vector3 vector = default(Vector3); Vector3 vector2 = default(Vector3); if (Math.Abs(w.X) >= Math.Abs(w.Y)) { double num = 1.0 / Math.Sqrt(w.X * w.X + w.Z * w.Z); vector.X = -w.Z * num; vector.Y = 0.0; vector.Z = w.X * num; vector2.X = w.Y * vector.Z; vector2.Y = w.Z * vector.X - w.X * vector.Z; vector2.Z = -w.Y * vector.X; } else { double num = 1.0 / Math.Sqrt(w.Y * w.Y + w.Z * w.Z); vector.X = 0.0; vector.Y = w.Z * num; vector.Z = -w.Y * num; vector2.X = w.Y * vector.Z - w.Z * vector.Y; vector2.Y = -w.X * vector.Z; vector2.Z = w.X * vector.Y; } u = new UnitVector3(vector.X, vector.Y, vector.Z); v = new UnitVector3(vector2.X, vector2.Y, vector2.Z); }