// Token: 0x06000487 RID: 1159 RVA: 0x000167AC File Offset: 0x000149AC public static AxisAlignedBox3 ComputeAxisAlignedBoundingBox(this Cylinder3 cylinder) { double scalar = cylinder.Height / 2.0; AffineTransform3 affineTransform = Transform3Factory.CreateOrthonormalBasis(cylinder.Axis.Direction); Circle3 circle = new Circle3(cylinder.Axis.Origin + scalar * cylinder.Axis.Direction, affineTransform.AxisX, affineTransform.AxisY, affineTransform.AxisZ, cylinder.Radius); Circle3 circle2 = new Circle3(cylinder.Axis.Origin - scalar * cylinder.Axis.Direction, affineTransform.AxisX, affineTransform.AxisY, affineTransform.AxisZ, cylinder.Radius); AxisAlignedBox3 axisAlignedBox = circle.ComputeAxisAlignedBoundingBox(); AxisAlignedBox3 other = circle2.ComputeAxisAlignedBoundingBox(); return(axisAlignedBox.CreateMergedWith(other)); }
// 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: 0x060004AB RID: 1195 RVA: 0x00017B54 File Offset: 0x00015D54 public static Vector3 Rotate(this Quaternion quaternion, Vector3 vector) { AffineTransform3 affineTransform = Transform3Factory.CreateFromQuaternion(quaternion); return(new Matrix3((Vector3)affineTransform.AxisX, (Vector3)affineTransform.AxisY, (Vector3)affineTransform.AxisZ) * vector); }
// Token: 0x060004D5 RID: 1237 RVA: 0x000190A7 File Offset: 0x000172A7 public static AffineTransform3 CreateFromAxisAngle(UnitVector3 axis, Angle angle) { return(Transform3Factory.CreateFromAxisAngle(axis, angle, Vector3.Zero)); }
// Token: 0x060004D4 RID: 1236 RVA: 0x00019094 File Offset: 0x00017294 public static AffineTransform3 CreateFromAxisAngle(UnitVector3 axis, Angle angle, Vector3 origin) { return(Transform3Factory.CreateFromAxisAngle(axis, angle, origin, 1.0)); }
public static AffineTransform3 CreateFromAxisAngle(UnitVector3 axis, double angle, Vector3 origin, double scale) { return(Transform3Factory.CreateFromAxisAngle(axis, Angle.FromRadians(angle), origin, scale)); }
// Token: 0x060004CF RID: 1231 RVA: 0x00018E99 File Offset: 0x00017099 public static AffineTransform3 Combine(AffineTransform3 first, AffineTransform3 second, AffineTransform3 third) { return(Transform3Factory.Combine(Transform3Factory.Combine(first, second), third)); }
// Token: 0x060004D9 RID: 1241 RVA: 0x000191DD File Offset: 0x000173DD public static AffineTransform3 CreateFromQuaternion(Quaternion quaternion) { return(Transform3Factory.CreateFromQuaternion(quaternion, Vector3.Zero)); }
// Token: 0x060004D8 RID: 1240 RVA: 0x000191CB File Offset: 0x000173CB public static AffineTransform3 CreateFromQuaternion(Quaternion quaternion, Vector3 origin) { return(Transform3Factory.CreateFromQuaternion(quaternion, origin, 1.0)); }
// 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: 0x060004B2 RID: 1202 RVA: 0x0001810D File Offset: 0x0001630D public static AffineTransform3 Transform(this AffineTransform3 transformer, AffineTransform3 source) { return(Transform3Factory.Combine(source, transformer)); }
// 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; } }