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 / 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. //---------------------------------------------------------------------------- // //// 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
- TransactionsSectionGroup.cs
- SimpleApplicationHost.cs
- CompositeFontFamily.cs
- OneWayChannelListener.cs
- RenderingEventArgs.cs
- ReadOnlyHierarchicalDataSource.cs
- SafeHandle.cs
- CultureTableRecord.cs
- PeerNearMe.cs
- OutputCacheProfileCollection.cs
- ButtonBaseAdapter.cs
- ExternalException.cs
- DataGridItemCollection.cs
- Internal.cs
- WindowsFormsHelpers.cs
- Rotation3DAnimationBase.cs
- SortDescription.cs
- JpegBitmapEncoder.cs
- RubberbandSelector.cs
- connectionpool.cs
- Helper.cs
- CultureData.cs
- RC2CryptoServiceProvider.cs
- RectAnimation.cs
- DPTypeDescriptorContext.cs
- path.cs
- SolidBrush.cs
- ModelPropertyCollectionImpl.cs
- StreamUpdate.cs
- DPTypeDescriptorContext.cs
- SocketAddress.cs
- NullableDoubleSumAggregationOperator.cs
- Pair.cs
- FontEmbeddingManager.cs
- AuthenticationManager.cs
- InteropBitmapSource.cs
- controlskin.cs
- AssociatedControlConverter.cs
- EndpointAddress.cs
- XmlProcessingInstruction.cs
- ToolStripKeyboardHandlingService.cs
- RangeValidator.cs
- CollectionDataContractAttribute.cs
- COAUTHINFO.cs
- Native.cs
- StandardCommands.cs
- RegexNode.cs
- DynamicResourceExtensionConverter.cs
- _SecureChannel.cs
- DiscoveryInnerClientAdhoc11.cs
- ScriptControlDescriptor.cs
- AggregationMinMaxHelpers.cs
- DesigntimeLicenseContextSerializer.cs
- ItemMap.cs
- RelatedImageListAttribute.cs
- Ref.cs
- OracleParameterBinding.cs
- MethodCallTranslator.cs
- SortableBindingList.cs
- DoubleKeyFrameCollection.cs
- TemplateControlParser.cs
- ListViewGroup.cs
- ValidationEventArgs.cs
- EntityDataReader.cs
- DataGridViewButtonColumn.cs
- HandleExceptionArgs.cs
- BufferedGraphicsContext.cs
- SqlInternalConnectionTds.cs
- TabRenderer.cs
- DataGridCaption.cs
- Registry.cs
- CodeIndexerExpression.cs
- ParsedAttributeCollection.cs
- Size.cs
- DataGridViewEditingControlShowingEventArgs.cs
- LogicalChannelCollection.cs
- StateMachineWorkflowDesigner.cs
- DataGridViewRowsAddedEventArgs.cs
- ChangeInterceptorAttribute.cs
- DataGridViewRowHeaderCell.cs
- TransformCollection.cs
- RankException.cs
- XmlIterators.cs
- Typography.cs
- HtmlElementErrorEventArgs.cs
- PlanCompiler.cs
- ExpressionEditorAttribute.cs
- SuppressIldasmAttribute.cs
- EntityDataSourceEntityTypeFilterItem.cs
- ApplicationFileCodeDomTreeGenerator.cs
- UInt64Converter.cs
- SqlRemoveConstantOrderBy.cs
- XPathParser.cs
- ProvideValueServiceProvider.cs
- BaseTemplateCodeDomTreeGenerator.cs
- LazyInitializer.cs
- PropertyPathWorker.cs
- ResourceReferenceExpressionConverter.cs
- Automation.cs
- LogWriteRestartAreaAsyncResult.cs