Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Core / System / Windows / Media3D / ProjectionCamera.cs / 1 / ProjectionCamera.cs
//---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // //--------------------------------------------------------------------------- using System; namespace System.Windows.Media.Media3D { ////// The ProjectionCamera is an abstract base class from cameras /// constructed from well-understand parameers such as Position, /// LookAtPoint, and Up. /// public abstract partial class ProjectionCamera : Camera { //----------------------------------------------------- // // Constructors // //----------------------------------------------------- ////// Prevent 3rd parties from extending this abstract base class. /// internal ProjectionCamera() { } //------------------------------------------------------ // // Public Methods // //----------------------------------------------------- //------------------------------------------------------ // // Public Properties // //------------------------------------------------------ //----------------------------------------------------- // // Public Events // //------------------------------------------------------ //----------------------------------------------------- // // Internal Methods // //----------------------------------------------------- #region Internal Methods internal override Matrix3D GetViewMatrix() { Point3D position = Position; Vector3D lookDirection = LookDirection; Vector3D upDirection = UpDirection; return CreateViewMatrix(Transform, ref position, ref lookDirection, ref upDirection); } // Transfrom that moves the world to a camera coordinate system // where the camera is at the origin looking down the negative z // axis and y is up. // // NOTE: We consider camera.Transform to be part of the view matrix. // internal static Matrix3D CreateViewMatrix(Transform3D transform, ref Point3D position, ref Vector3D lookDirection, ref Vector3D upDirection) { Vector3D zaxis = -lookDirection; zaxis.Normalize(); Vector3D xaxis = Vector3D.CrossProduct(upDirection, zaxis); xaxis.Normalize(); Vector3D yaxis = Vector3D.CrossProduct(zaxis, xaxis); Vector3D positionVec = (Vector3D) position; double cx = -Vector3D.DotProduct(xaxis, positionVec); double cy = -Vector3D.DotProduct(yaxis, positionVec); double cz = -Vector3D.DotProduct(zaxis, positionVec); Matrix3D viewMatrix = new Matrix3D( xaxis.X, yaxis.X, zaxis.X, 0, xaxis.Y, yaxis.Y, zaxis.Y, 0, xaxis.Z, yaxis.Z, zaxis.Z, 0, cx, cy, cz, 1); PrependInverseTransform(transform, ref viewMatrix); return viewMatrix; } #endregion Internal Methods //----------------------------------------------------- // // Private Fields // //------------------------------------------------------ } } // 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
- counter.cs
- DateTimeOffsetAdapter.cs
- UnknownBitmapEncoder.cs
- KnownTypesProvider.cs
- Timer.cs
- AstTree.cs
- HttpResponseInternalWrapper.cs
- Help.cs
- XhtmlConformanceSection.cs
- ValidationRuleCollection.cs
- ScriptDescriptor.cs
- SeparatorAutomationPeer.cs
- SelectionChangedEventArgs.cs
- ConfigXmlComment.cs
- XmlNotation.cs
- Empty.cs
- DrawingAttributes.cs
- DesignerAttribute.cs
- ColumnBinding.cs
- ToolStripDropDownMenu.cs
- Byte.cs
- CryptoConfig.cs
- StringFunctions.cs
- SqlMethodAttribute.cs
- LabelAutomationPeer.cs
- QueryOperator.cs
- AssemblyBuilderData.cs
- UniqueIdentifierService.cs
- SharedStatics.cs
- _BaseOverlappedAsyncResult.cs
- DomNameTable.cs
- AsyncOperationContext.cs
- WmlPageAdapter.cs
- AccessKeyManager.cs
- AsymmetricSignatureFormatter.cs
- HierarchicalDataTemplate.cs
- ToolStripItemDataObject.cs
- ConditionChanges.cs
- QilInvokeEarlyBound.cs
- ListParaClient.cs
- TextBoxView.cs
- WebControlAdapter.cs
- TimeStampChecker.cs
- LinqToSqlWrapper.cs
- WeakReferenceEnumerator.cs
- XmlNodeChangedEventManager.cs
- BaseTemplateCodeDomTreeGenerator.cs
- SourceFileBuildProvider.cs
- CodeAssignStatement.cs
- EntityParameterCollection.cs
- LinkClickEvent.cs
- SqlReorderer.cs
- PipeSecurity.cs
- GridViewCommandEventArgs.cs
- webeventbuffer.cs
- ScalarType.cs
- ToolstripProfessionalRenderer.cs
- DbTypeMap.cs
- ContourSegment.cs
- StringAnimationBase.cs
- entityreference_tresulttype.cs
- CompiledQueryCacheEntry.cs
- ApplicationFileCodeDomTreeGenerator.cs
- ColorTransform.cs
- Baml2006SchemaContext.cs
- KnownTypesHelper.cs
- BrowserCapabilitiesFactoryBase.cs
- ActivityIdHeader.cs
- QilBinary.cs
- HttpPostClientProtocol.cs
- ConstraintEnumerator.cs
- OletxEnlistment.cs
- ReadOnlyCollectionBase.cs
- CngKeyBlobFormat.cs
- ExpressionBuilderContext.cs
- keycontainerpermission.cs
- SectionVisual.cs
- FixedSOMSemanticBox.cs
- updateconfighost.cs
- FontFamily.cs
- SoapClientProtocol.cs
- SmiSettersStream.cs
- AuthenticationSection.cs
- SynchronizationLockException.cs
- Metafile.cs
- GeneratedCodeAttribute.cs
- XmlSchemaCollection.cs
- FixedPageAutomationPeer.cs
- UiaCoreApi.cs
- rsa.cs
- GZipDecoder.cs
- RouteParser.cs
- UrlRoutingHandler.cs
- SimpleHandlerBuildProvider.cs
- RegionIterator.cs
- XPathNodeInfoAtom.cs
- ColumnMapVisitor.cs
- HScrollProperties.cs
- ListView.cs
- DesignerTransactionCloseEvent.cs