Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / System / Windows / Media3D / AxisAngleRotation3D.cs / 1305600 / 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. //---------------------------------------------------------------------------- // //// 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
- TreePrinter.cs
- SQLSingleStorage.cs
- HtmlFormAdapter.cs
- MethodExpr.cs
- PermissionListSet.cs
- DiscoveryServerProtocol.cs
- SafeNativeMethods.cs
- SQLInt32Storage.cs
- TraceHelpers.cs
- Int16.cs
- WeakEventTable.cs
- SimpleBitVector32.cs
- SerializerWriterEventHandlers.cs
- Visual3D.cs
- EncodingInfo.cs
- XamlSerializerUtil.cs
- DataControlPagerLinkButton.cs
- DefaultAssemblyResolver.cs
- BackgroundWorker.cs
- InvalidFilterCriteriaException.cs
- SHA1.cs
- QilInvokeLateBound.cs
- SimpleMailWebEventProvider.cs
- DialogResultConverter.cs
- UnsafeNativeMethods.cs
- SafeProcessHandle.cs
- SecurityManager.cs
- SqlFlattener.cs
- EventLogTraceListener.cs
- GregorianCalendar.cs
- TemplateInstanceAttribute.cs
- RegexStringValidator.cs
- DataGridTablesFactory.cs
- OracleInfoMessageEventArgs.cs
- WebBrowserDocumentCompletedEventHandler.cs
- AttributeAction.cs
- SafeSecurityHandles.cs
- XmlUnspecifiedAttribute.cs
- ActiveXSite.cs
- HtmlEmptyTagControlBuilder.cs
- RecognizerStateChangedEventArgs.cs
- Stopwatch.cs
- COM2ExtendedUITypeEditor.cs
- Triplet.cs
- UserControl.cs
- Literal.cs
- _FixedSizeReader.cs
- EntitySqlException.cs
- ProxyWebPartManager.cs
- OracleInternalConnection.cs
- TransformPatternIdentifiers.cs
- XmlResolver.cs
- RegisteredArrayDeclaration.cs
- ClientUrlResolverWrapper.cs
- XpsStructure.cs
- UnsignedPublishLicense.cs
- DefaultTextStore.cs
- StaticFileHandler.cs
- UIAgentAsyncParams.cs
- MsmqBindingFilter.cs
- KeyValuePairs.cs
- SqlClientWrapperSmiStreamChars.cs
- MessageQueueConverter.cs
- CaseStatement.cs
- GroupStyle.cs
- AssemblyBuilderData.cs
- XmlSchemaSet.cs
- AmbientEnvironment.cs
- UpdatePanelTrigger.cs
- BlobPersonalizationState.cs
- NamedObject.cs
- X509CertificateRecipientServiceCredential.cs
- Encoder.cs
- MDIWindowDialog.cs
- DataGridViewCellValidatingEventArgs.cs
- EntityDescriptor.cs
- CorePropertiesFilter.cs
- LinqDataView.cs
- PermissionRequestEvidence.cs
- ExpressionBindings.cs
- SqlErrorCollection.cs
- InvalidateEvent.cs
- ObjectConverter.cs
- ExceptionHelpers.cs
- GenericEnumerator.cs
- XmlUrlResolver.cs
- AdapterDictionary.cs
- ScaleTransform.cs
- TraversalRequest.cs
- PartitionerQueryOperator.cs
- ProfilePropertyMetadata.cs
- ErrorFormatter.cs
- DataGridViewCellFormattingEventArgs.cs
- RoutedUICommand.cs
- FileDialogPermission.cs
- FigureParaClient.cs
- StreamAsIStream.cs
- ConfigurationStrings.cs
- CapabilitiesSection.cs
- CatalogZone.cs