// Token: 0x060004B9 RID: 1209 RVA: 0x00018420 File Offset: 0x00016620
 public static Triangle3 Transform(this AffineTransform3 transformer, Triangle3 input)
 {
     return(new Triangle3(transformer.Transform(input.V0), transformer.Transform(input.V1), transformer.Transform(input.V2)));
 }
 // Token: 0x060004B4 RID: 1204 RVA: 0x00018270 File Offset: 0x00016470
 public static Vector3 Transform(this AffineTransform3 transformer, Vector3 input)
 {
     return(transformer.Origin + transformer.Scale * (transformer.AxisX * input.X + transformer.AxisY * input.Y + transformer.AxisZ * input.Z));
 }
 // 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: 0x060004B2 RID: 1202 RVA: 0x0001810D File Offset: 0x0001630D
 public static AffineTransform3 Transform(this AffineTransform3 transformer, AffineTransform3 source)
 {
     return(Transform3Factory.Combine(source, transformer));
 }
 // Token: 0x060004CD RID: 1229 RVA: 0x00018B5A File Offset: 0x00016D5A
 public static Cylinder3 Transform(this AffineTransform3 transformer, Cylinder3 cylinder)
 {
     return(new Cylinder3(transformer.Transform(cylinder.Axis), transformer.Scale * cylinder.Radius, transformer.Scale * cylinder.Height));
 }
 // Token: 0x060004C4 RID: 1220 RVA: 0x00018983 File Offset: 0x00016B83
 public static Arc3 Transform(this AffineTransform3 transformer, Arc3 arc)
 {
     return(new Arc3(transformer.Transform(arc.Circle), arc.StartAngle, arc.DeltaAngle));
 }
예제 #7
0
        // 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;
            }
        }
예제 #8
0
 // Token: 0x060004AC RID: 1196 RVA: 0x00017B97 File Offset: 0x00015D97
 public static Quaternion CreateFromTransform(AffineTransform3 transform)
 {
     return(QuaternionFactory.CreateFromRotationMatrix(new Matrix3((Vector3)transform.AxisX, (Vector3)transform.AxisY, (Vector3)transform.AxisZ)));
 }