RotateTransform3D.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / wpf / src / Core / CSharp / System / Windows / Media3D / RotateTransform3D.cs / 1 / RotateTransform3D.cs

                            //---------------------------------------------------------------------------- 
//
// 
//    Copyright (C) Microsoft Corporation.  All rights reserved.
//  
//
// 
// Description: 3D rotate transforms. 
//
//              See spec at http://avalon/medialayer/Specifications/Avalon3D%20API%20Spec.mht 
//
// History:
//  06/04/2003 : t-gregr - Created
// 
//---------------------------------------------------------------------------
 
using System; 
using System.ComponentModel;
using System.Windows.Media; 
using System.Windows.Media.Animation;
using System.Windows.Media.Composition;
using MS.Internal;
using System.ComponentModel.Design.Serialization; 
using System.Windows.Markup;
 
namespace System.Windows.Media.Media3D 
{
    ///  
    /// 3D rotate transforms.
    /// 
    public sealed partial class RotateTransform3D : AffineTransform3D
    { 
        //-----------------------------------------------------
        // 
        //  Constructors 
        //
        //----------------------------------------------------- 

        #region Constructors

        ///  
        ///     Default constructor.
        ///  
        public RotateTransform3D() {} 

        ///  
        ///     Constructor from Rotation3D.
        /// 
        /// Rotation3D.
        public RotateTransform3D(Rotation3D rotation) 
        {
            Rotation = rotation; 
        } 

        ///  
        ///     Constructor from Rotation3D and center point.
        /// 
        /// Rotation3D.
        /// Center point. 
        public RotateTransform3D(Rotation3D rotation, Point3D center)
        { 
            Rotation = rotation; 
            CenterX = center.X;
            CenterY = center.Y; 
            CenterZ = center.Z;
        }

 
        /// 
        ///     Constructor from Rotation3D and center point. 
        ///  
        /// Rotation3D.
        /// X center 
        /// Y center
        /// Z center
        public RotateTransform3D(Rotation3D rotation, double centerX, double centerY, double centerZ)
        { 
            Rotation = rotation;
            CenterX = centerX; 
            CenterY = centerY; 
            CenterZ = centerZ;
        } 

        #endregion Constructors

        //------------------------------------------------------ 
        //
        //  Public Methods 
        // 
        //-----------------------------------------------------
 
        //------------------------------------------------------
        //
        //  Public Properties
        // 
        //------------------------------------------------------
 
        #region Public Properties 

        ///  
        /// Retrieves matrix representing the rotation.
        /// 
        public override Matrix3D Value
        { 
            get
            { 
                ReadPreamble(); 

                Rotation3D rotation = _cachedRotationValue; 

                if (rotation == null)
                {
                    return Matrix3D.Identity; 
                }
 
                Quaternion quaternion = rotation.InternalQuaternion; 
                Point3D center = new Point3D(_cachedCenterXValue, _cachedCenterYValue, _cachedCenterZValue);
 
                return Matrix3D.CreateRotationMatrix(ref quaternion, ref center);
            }
        }
 
        #endregion Public Properties
 
        internal override void Append(ref Matrix3D matrix) 
        {
            matrix = matrix * Value; 
        }

    }
} 


// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
//---------------------------------------------------------------------------- 
//
// 
//    Copyright (C) Microsoft Corporation.  All rights reserved.
//  
//
// 
// Description: 3D rotate transforms. 
//
//              See spec at http://avalon/medialayer/Specifications/Avalon3D%20API%20Spec.mht 
//
// History:
//  06/04/2003 : t-gregr - Created
// 
//---------------------------------------------------------------------------
 
using System; 
using System.ComponentModel;
using System.Windows.Media; 
using System.Windows.Media.Animation;
using System.Windows.Media.Composition;
using MS.Internal;
using System.ComponentModel.Design.Serialization; 
using System.Windows.Markup;
 
namespace System.Windows.Media.Media3D 
{
    ///  
    /// 3D rotate transforms.
    /// 
    public sealed partial class RotateTransform3D : AffineTransform3D
    { 
        //-----------------------------------------------------
        // 
        //  Constructors 
        //
        //----------------------------------------------------- 

        #region Constructors

        ///  
        ///     Default constructor.
        ///  
        public RotateTransform3D() {} 

        ///  
        ///     Constructor from Rotation3D.
        /// 
        /// Rotation3D.
        public RotateTransform3D(Rotation3D rotation) 
        {
            Rotation = rotation; 
        } 

        ///  
        ///     Constructor from Rotation3D and center point.
        /// 
        /// Rotation3D.
        /// Center point. 
        public RotateTransform3D(Rotation3D rotation, Point3D center)
        { 
            Rotation = rotation; 
            CenterX = center.X;
            CenterY = center.Y; 
            CenterZ = center.Z;
        }

 
        /// 
        ///     Constructor from Rotation3D and center point. 
        ///  
        /// Rotation3D.
        /// X center 
        /// Y center
        /// Z center
        public RotateTransform3D(Rotation3D rotation, double centerX, double centerY, double centerZ)
        { 
            Rotation = rotation;
            CenterX = centerX; 
            CenterY = centerY; 
            CenterZ = centerZ;
        } 

        #endregion Constructors

        //------------------------------------------------------ 
        //
        //  Public Methods 
        // 
        //-----------------------------------------------------
 
        //------------------------------------------------------
        //
        //  Public Properties
        // 
        //------------------------------------------------------
 
        #region Public Properties 

        ///  
        /// Retrieves matrix representing the rotation.
        /// 
        public override Matrix3D Value
        { 
            get
            { 
                ReadPreamble(); 

                Rotation3D rotation = _cachedRotationValue; 

                if (rotation == null)
                {
                    return Matrix3D.Identity; 
                }
 
                Quaternion quaternion = rotation.InternalQuaternion; 
                Point3D center = new Point3D(_cachedCenterXValue, _cachedCenterYValue, _cachedCenterZValue);
 
                return Matrix3D.CreateRotationMatrix(ref quaternion, ref center);
            }
        }
 
        #endregion Public Properties
 
        internal override void Append(ref Matrix3D matrix) 
        {
            matrix = matrix * Value; 
        }

    }
} 


// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK