Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / System / Windows / Media3D / ProjectionCamera.cs / 1305600 / 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
- Pair.cs
- Sql8ConformanceChecker.cs
- KeyPullup.cs
- FontDialog.cs
- RawStylusInputCustomDataList.cs
- DeflateStreamAsyncResult.cs
- Menu.cs
- StateMachineDesignerPaint.cs
- CheckBoxFlatAdapter.cs
- DescendentsWalkerBase.cs
- FolderBrowserDialog.cs
- ApplicationSecurityInfo.cs
- Clause.cs
- ImageInfo.cs
- PointF.cs
- CharStorage.cs
- DataGridViewColumnHeaderCell.cs
- ReadOnlyTernaryTree.cs
- LocalFileSettingsProvider.cs
- __Filters.cs
- HtmlControlPersistable.cs
- PageWrapper.cs
- TabletDevice.cs
- TableLayoutPanelCellPosition.cs
- ManifestResourceInfo.cs
- WebPartConnectionsCancelVerb.cs
- List.cs
- BuilderPropertyEntry.cs
- EnumConverter.cs
- RuleSetDialog.cs
- OleDbConnectionFactory.cs
- IndexedDataBuffer.cs
- ComponentConverter.cs
- UntrustedRecipientException.cs
- ConfigurationLocationCollection.cs
- ConfigurationPropertyCollection.cs
- IdentityHolder.cs
- GlyphTypeface.cs
- DrawListViewSubItemEventArgs.cs
- FunctionQuery.cs
- DefinitionUpdate.cs
- DateTimeFormatInfoScanner.cs
- ImageSourceValueSerializer.cs
- AssociationEndMember.cs
- AssociationTypeEmitter.cs
- DetailsViewCommandEventArgs.cs
- ProjectionPruner.cs
- DragStartedEventArgs.cs
- ProgressBarHighlightConverter.cs
- SpotLight.cs
- PlatformNotSupportedException.cs
- FormsAuthenticationCredentials.cs
- Animatable.cs
- nulltextcontainer.cs
- MetadataArtifactLoaderResource.cs
- RuntimeHandles.cs
- QuaternionAnimation.cs
- CroppedBitmap.cs
- X509Utils.cs
- ConfigurationPropertyAttribute.cs
- ValueQuery.cs
- Literal.cs
- WebPartEditVerb.cs
- ReferenceConverter.cs
- QilLiteral.cs
- CompiledRegexRunner.cs
- TextRangeEdit.cs
- SimplePropertyEntry.cs
- AccessText.cs
- Effect.cs
- AutoGeneratedFieldProperties.cs
- DSASignatureFormatter.cs
- VarInfo.cs
- HyperLinkField.cs
- SessionStateSection.cs
- ObjectCloneHelper.cs
- InternalCompensate.cs
- CRYPTPROTECT_PROMPTSTRUCT.cs
- OperatorExpressions.cs
- FileNotFoundException.cs
- TableLayoutPanel.cs
- __Filters.cs
- sortedlist.cs
- WebEvents.cs
- SessionStateContainer.cs
- HScrollBar.cs
- GeometryDrawing.cs
- SByteConverter.cs
- InheritanceContextHelper.cs
- ExpandedWrapper.cs
- TextSpanModifier.cs
- UriSchemeKeyedCollection.cs
- DataSourceNameHandler.cs
- DataKey.cs
- HuffmanTree.cs
- ProfileModule.cs
- WindowsToolbar.cs
- ViewBase.cs
- ToggleButtonAutomationPeer.cs
- AutomationElementIdentifiers.cs