private bool ReadCanonicalForm(Transform3D transform, bool useIfChangeable) { if (!CanonicalTransform3D.IsCanonical(transform)) { return(false); } Transform3DGroup transform3Dgroup = (Transform3DGroup)transform; ScaleTransform3D scaleTransform3D = transform3Dgroup.Children[1] as ScaleTransform3D; RotateTransform3D rotateTransform3D = transform3Dgroup.Children[2] as RotateTransform3D; TranslateTransform3D translateTransform3D1 = transform3Dgroup.Children[3] as TranslateTransform3D; TranslateTransform3D translateTransform3D2 = transform3Dgroup.Children[4] as TranslateTransform3D; this.center = new Point3D(translateTransform3D1.OffsetX, translateTransform3D1.OffsetY, translateTransform3D1.OffsetZ); this.scale = new Vector3D(scaleTransform3D.ScaleX, scaleTransform3D.ScaleY, scaleTransform3D.ScaleZ); this.translation = new Vector3D(translateTransform3D2.OffsetX, translateTransform3D2.OffsetY, translateTransform3D2.OffsetZ); if (useIfChangeable && !transform3Dgroup.IsFrozen) { this.transformGroup = transform3Dgroup; } else { this.InitializeTransformGroup(); Vector3D? nullable = (Vector3D?)rotateTransform3D.GetValue(CanonicalTransform3D.EulerAnglesProperty); bool flag = nullable.HasValue; AxisAngleRotation3D axisAngleRotation3D = rotateTransform3D.Rotation as AxisAngleRotation3D; Quaternion orientation = Quaternion.Identity; if (axisAngleRotation3D != null) { orientation = new Quaternion(axisAngleRotation3D.Axis, axisAngleRotation3D.Angle); } if (flag) { Quaternion quaternion = Helper3D.QuaternionFromEulerAngles(nullable.Value); if (!Tolerances.AreClose(quaternion.Angle, orientation.Angle) || !Tolerances.AreClose(quaternion.Axis, orientation.Axis)) { flag = false; } } if (!flag) { nullable = new Vector3D?(Helper3D.EulerAnglesFromQuaternion(orientation)); } this.RotationAngles = nullable.Value; } return(true); }