예제 #1
0
        public static bool IsSane(Matrix4D transform)
        {
            double determinant = transform.GetDeterminant();

            if (!double.IsNaN(determinant))
            {
                return(!double.IsInfinity(determinant));
            }
            return(false);
        }
예제 #2
0
파일: DxfMText.cs 프로젝트: 15831944/WW
        public override void TransformMe(
            TransformConfig config,
            Matrix4D matrix,
            CommandGroup undoGroup)
        {
            // ISSUE: object of a compiler-generated type is created
            // ISSUE: variable of a compiler-generated type
            DxfMText.Class416 class416 = new DxfMText.Class416();
            // ISSUE: reference to a compiler-generated field
            class416.dxfMText_0 = this;
            // ISSUE: reference to a compiler-generated field
            class416.point3D_0 = this.point3D_0;
            // ISSUE: reference to a compiler-generated field
            class416.double_0 = this.double_1;
            // ISSUE: reference to a compiler-generated field
            class416.double_1 = this.double_2;
            // ISSUE: reference to a compiler-generated field
            class416.vector3D_0 = this.vector3D_0;
            // ISSUE: reference to a compiler-generated field
            class416.vector3D_1 = this.vector3D_1;
            // ISSUE: reference to a compiler-generated field
            class416.attachmentPoint_0 = this.attachmentPoint_0;
            this.vector3D_1            = matrix.Transform(this.vector3D_1);
            this.vector3D_1.Normalize();
            this.vector3D_0 = matrix.Transform(this.vector3D_0);
            this.vector3D_0.Normalize();
            Matrix4D inverse = DxfUtil.GetToWCSTransform(this.vector3D_1, this.vector3D_0).GetInverse();
            // ISSUE: reference to a compiler-generated field
            // ISSUE: reference to a compiler-generated field
            Matrix4D toWcsTransform = DxfUtil.GetToWCSTransform(class416.vector3D_1, class416.vector3D_0);
            Matrix4D matrix4D       = inverse * matrix * toWcsTransform;

            this.point3D_0 = matrix.Transform(this.point3D_0);
            this.double_1  = matrix4D.Transform(new WW.Math.Vector3D(0.0, this.double_1, 0.0)).GetLength();
            this.double_2  = matrix4D.Transform(new WW.Math.Vector3D(this.double_2, 0.0, 0.0)).GetLength();
            if (matrix.GetDeterminant() < 0.0)
            {
                // ISSUE: reference to a compiler-generated field
                bool     flag       = WW.Math.Vector3D.DotProduct(this.vector3D_1, class416.vector3D_1) < 0.0;
                Bounds2D textBounds = this.TextBounds;
                if (flag)
                {
                    this.vector3D_1 = -this.vector3D_1;
                    switch (this.attachmentPoint_0)
                    {
                    case AttachmentPoint.TopLeft:
                        this.attachmentPoint_0 = AttachmentPoint.TopRight;
                        break;

                    case AttachmentPoint.TopRight:
                        this.attachmentPoint_0 = AttachmentPoint.TopLeft;
                        break;

                    case AttachmentPoint.MiddleLeft:
                        this.attachmentPoint_0 = AttachmentPoint.MiddleRight;
                        break;

                    case AttachmentPoint.MiddleRight:
                        this.attachmentPoint_0 = AttachmentPoint.MiddleLeft;
                        break;

                    case AttachmentPoint.BottomLeft:
                        this.attachmentPoint_0 = AttachmentPoint.BottomRight;
                        break;

                    case AttachmentPoint.BottomRight:
                        this.attachmentPoint_0 = AttachmentPoint.BottomLeft;
                        break;
                    }
                }
                else
                {
                    WW.Math.Vector3D.CrossProduct(this.vector3D_0, this.vector3D_1).GetUnit();
                    switch (this.attachmentPoint_0)
                    {
                    case AttachmentPoint.TopLeft:
                        this.attachmentPoint_0 = AttachmentPoint.BottomLeft;
                        break;

                    case AttachmentPoint.TopCenter:
                        this.attachmentPoint_0 = AttachmentPoint.BottomCenter;
                        break;

                    case AttachmentPoint.TopRight:
                        this.attachmentPoint_0 = AttachmentPoint.BottomRight;
                        break;

                    case AttachmentPoint.BottomLeft:
                        this.attachmentPoint_0 = AttachmentPoint.TopLeft;
                        break;

                    case AttachmentPoint.BottomCenter:
                        this.attachmentPoint_0 = AttachmentPoint.TopCenter;
                        break;

                    case AttachmentPoint.BottomRight:
                        this.attachmentPoint_0 = AttachmentPoint.TopRight;
                        break;
                    }
                }
            }
            this.method_15();
            if (undoGroup == null)
            {
                return;
            }
            // ISSUE: object of a compiler-generated type is created
            // ISSUE: reference to a compiler-generated method
            // ISSUE: reference to a compiler-generated method
            undoGroup.UndoStack.Push((ICommand) new Command((object)this, new System.Action(new DxfMText.Class417()
            {
                class416_0        = class416,
                point3D_0         = this.point3D_0,
                double_0          = this.double_1,
                double_1          = this.double_2,
                vector3D_0        = this.vector3D_0,
                vector3D_1        = this.vector3D_1,
                attachmentPoint_0 = this.attachmentPoint_0
            }.method_0), new System.Action(class416.method_0)));
        }