Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Core / System / Windows / Media3D / AxisAngleRotation3D.cs / 1 / AxisAngleRotation3D.cs
//---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // //--------------------------------------------------------------------------- using System; using MS.Internal; namespace System.Windows.Media.Media3D { ////// A rotation in 3-space defined by an axis and an angle to rotate about that axis. /// public partial class AxisAngleRotation3D { //----------------------------------------------------- // // Constructors // //----------------------------------------------------- #region Constructors ////// Default constructor that creates a rotation with Axis (0,1,0) and Angle of 0. /// public AxisAngleRotation3D() {} ////// Constructor taking axis and angle. /// public AxisAngleRotation3D(Vector3D axis, double angle) { Axis = axis; Angle = angle; } #endregion Constructors //------------------------------------------------------ // // Public Methods // //----------------------------------------------------- //------------------------------------------------------ // // Public Properties // //------------------------------------------------------ //----------------------------------------------------- // // Public Events // //------------------------------------------------------ //----------------------------------------------------- // // Internal Properties // //----------------------------------------------------- #region Internal Properties // Used by animation to get a snapshot of the current rotational // configuration for interpolation in Rotation3DAnimations. internal override Quaternion InternalQuaternion { get { if (_cachedQuaternionValue == c_dirtyQuaternion) { Vector3D axis = Axis; // Quaternion's axis/angle ctor throws if the axis has zero length. // // This threshold needs to match the one we used in D3DXVec3Normalize (d3dxmath9.cpp) // and in unmanaged code. See also AxisAngleRotation3D.cpp. if (axis.LengthSquared > DoubleUtil.FLT_MIN) { _cachedQuaternionValue = new Quaternion(axis, Angle); } else { // If we have a zero-length axis we return identity (i.e., // we consider this to be no rotation.) _cachedQuaternionValue = Quaternion.Identity; } } return _cachedQuaternionValue; } } #endregion Internal Properties internal void AxisPropertyChangedHook(DependencyPropertyChangedEventArgs e) { _cachedQuaternionValue = c_dirtyQuaternion; } internal void AnglePropertyChangedHook(DependencyPropertyChangedEventArgs e) { _cachedQuaternionValue = c_dirtyQuaternion; } //----------------------------------------------------- // // Private Fields // //------------------------------------------------------ private Quaternion _cachedQuaternionValue = c_dirtyQuaternion; // Arbitrary quaternion that will signify that our cached quat is dirty // Reasonable quaternions are normalized so it's very unlikely that this // will ever occurr in a normal application. internal static readonly Quaternion c_dirtyQuaternion = new Quaternion( Math.E, Math.PI, Math.E * Math.PI, 55.0 ); } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- HashAlgorithm.cs
- SqlParameter.cs
- RuntimeConfigLKG.cs
- DocumentApplicationJournalEntry.cs
- MetadataSource.cs
- DataGridColumnHeaderAutomationPeer.cs
- DbReferenceCollection.cs
- BuildProvidersCompiler.cs
- CompilerScope.cs
- WebBrowserNavigatingEventHandler.cs
- DbReferenceCollection.cs
- ServiceDiscoveryElement.cs
- DataGridViewRowPrePaintEventArgs.cs
- LinkedResource.cs
- ConfigXmlElement.cs
- SecurityNegotiationException.cs
- MbpInfo.cs
- FrameworkElement.cs
- Metadata.cs
- Errors.cs
- UnsafeNativeMethods.cs
- DocumentApplication.cs
- CounterCreationDataCollection.cs
- Utils.cs
- HttpWebRequestElement.cs
- SqlRewriteScalarSubqueries.cs
- SystemUdpStatistics.cs
- SHA256Cng.cs
- AdornerLayer.cs
- SiteMapNodeItem.cs
- NoPersistHandle.cs
- XmlSchemaAppInfo.cs
- StateDesigner.cs
- AspCompat.cs
- FormsAuthenticationUserCollection.cs
- Cursor.cs
- IisTraceListener.cs
- ParameterElement.cs
- SchemaUtility.cs
- WindowsSolidBrush.cs
- AuthenticationManager.cs
- EventSourceCreationData.cs
- ExpressionHelper.cs
- CommonDialog.cs
- RoleManagerModule.cs
- JsonDeserializer.cs
- TimeSpanConverter.cs
- WebConfigurationManager.cs
- ContentPosition.cs
- Lease.cs
- KeyValueInternalCollection.cs
- TransformerTypeCollection.cs
- DbException.cs
- PageContent.cs
- WebPartConnectionsConfigureVerb.cs
- Matrix.cs
- parserscommon.cs
- XamlReader.cs
- RegexStringValidatorAttribute.cs
- AttachedPropertyInfo.cs
- InstanceCreationEditor.cs
- FrameSecurityDescriptor.cs
- CharacterMetricsDictionary.cs
- CorrelationManager.cs
- SessionEndedEventArgs.cs
- DataGridViewElement.cs
- ParserStreamGeometryContext.cs
- XPathNodeInfoAtom.cs
- ISessionStateStore.cs
- NTAccount.cs
- MemberJoinTreeNode.cs
- SByte.cs
- Size.cs
- WsdlBuildProvider.cs
- CompiledQueryCacheEntry.cs
- TargetControlTypeAttribute.cs
- CaseStatement.cs
- DataObjectFieldAttribute.cs
- CellQuery.cs
- WarningException.cs
- TransactedReceiveData.cs
- CustomCategoryAttribute.cs
- WithParamAction.cs
- QilGenerator.cs
- CreateUserWizardStep.cs
- CheckBoxList.cs
- CompilerResults.cs
- XpsException.cs
- DbParameterHelper.cs
- LabelLiteral.cs
- LabelLiteral.cs
- configsystem.cs
- PatternMatchRules.cs
- SolidColorBrush.cs
- FullTextLine.cs
- TransportConfigurationTypeElementCollection.cs
- Header.cs
- DesignerActionPropertyItem.cs
- ListSortDescriptionCollection.cs
- UInt16Converter.cs