Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / MS / Internal / Ink / ContourSegment.cs / 1305600 / ContourSegment.cs
//------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------- using System; using System.Windows; using System.Windows.Media; namespace MS.Internal.Ink { ////// A helper structure representing an edge of a contour, where /// the edge is either a straight segment or an arc of a circle. /// ContourSegment are alwais directed clockwise (i.e with the contour /// inner area being on the right side. /// Used in hit-testing a contour vs another contour. /// internal struct ContourSegment { ////// Constructor for linear segments /// /// segment's begin point /// segment's end point internal ContourSegment(Point begin, Point end) { _begin = begin; _vector = DoubleUtil.AreClose(begin, end) ? new Vector(0, 0) : (end - begin); _radius = new Vector(0, 0); } ////// Constructor for arcs /// /// arc's begin point /// arc's end point /// arc's center internal ContourSegment(Point begin, Point end, Point center) { _begin = begin; _vector = end - begin; _radius = center - begin; } ///Tells whether the segment is arc or straight internal bool IsArc { get { return (_radius.X != 0) || (_radius.Y != 0); } } ///Returns the begin point of the segment internal Point Begin { get { return _begin; } } ///Returns the end point of the segment internal Point End { get { return _begin + _vector; } } ///Returns the vector from Begin to End internal Vector Vector { get { return _vector; } } ///Returns the vector from Begin to the center of the circle /// (zero vector for linear segments internal Vector Radius { get { return _radius; } } #region Fields private Point _begin; private Vector _vector; private Vector _radius; #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------- using System; using System.Windows; using System.Windows.Media; namespace MS.Internal.Ink { ////// A helper structure representing an edge of a contour, where /// the edge is either a straight segment or an arc of a circle. /// ContourSegment are alwais directed clockwise (i.e with the contour /// inner area being on the right side. /// Used in hit-testing a contour vs another contour. /// internal struct ContourSegment { ////// Constructor for linear segments /// /// segment's begin point /// segment's end point internal ContourSegment(Point begin, Point end) { _begin = begin; _vector = DoubleUtil.AreClose(begin, end) ? new Vector(0, 0) : (end - begin); _radius = new Vector(0, 0); } ////// Constructor for arcs /// /// arc's begin point /// arc's end point /// arc's center internal ContourSegment(Point begin, Point end, Point center) { _begin = begin; _vector = end - begin; _radius = center - begin; } ///Tells whether the segment is arc or straight internal bool IsArc { get { return (_radius.X != 0) || (_radius.Y != 0); } } ///Returns the begin point of the segment internal Point Begin { get { return _begin; } } ///Returns the end point of the segment internal Point End { get { return _begin + _vector; } } ///Returns the vector from Begin to End internal Vector Vector { get { return _vector; } } ///Returns the vector from Begin to the center of the circle /// (zero vector for linear segments internal Vector Radius { get { return _radius; } } #region Fields private Point _begin; private Vector _vector; private Vector _radius; #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SmtpMail.cs
- GridViewUpdatedEventArgs.cs
- SecurityNegotiationException.cs
- InternalControlCollection.cs
- ProviderCollection.cs
- OverflowException.cs
- MissingFieldException.cs
- ThemeInfoAttribute.cs
- MissingSatelliteAssemblyException.cs
- MailDefinition.cs
- StateChangeEvent.cs
- PenThread.cs
- PieceNameHelper.cs
- XmlMemberMapping.cs
- Style.cs
- AutoGeneratedField.cs
- MobileControlsSectionHandler.cs
- Set.cs
- WebPartConnectionsCancelVerb.cs
- SqlBulkCopyColumnMapping.cs
- httpapplicationstate.cs
- RelativeSource.cs
- DataServiceQueryProvider.cs
- ConfigXmlComment.cs
- ZipFileInfo.cs
- SerTrace.cs
- MetaColumn.cs
- PreviewPageInfo.cs
- ValidationEventArgs.cs
- EpmContentDeSerializerBase.cs
- AffineTransform3D.cs
- NativeMethods.cs
- PanelStyle.cs
- CommandField.cs
- StringStorage.cs
- ProxyGenerator.cs
- UInt64.cs
- GuidConverter.cs
- ComponentEditorPage.cs
- GridSplitter.cs
- WorkflowInstanceExtensionManager.cs
- StrongBox.cs
- UseAttributeSetsAction.cs
- TransactionBridge.cs
- SafeViewOfFileHandle.cs
- ToolStripPanelRow.cs
- IndexExpression.cs
- MetafileHeaderWmf.cs
- WriteTimeStream.cs
- SmiEventStream.cs
- NullableDoubleAverageAggregationOperator.cs
- TextEditor.cs
- ISCIIEncoding.cs
- CustomAttribute.cs
- UseLicense.cs
- ButtonRenderer.cs
- XsdBuildProvider.cs
- WinOEToolBoxItem.cs
- List.cs
- SynchronizedDispatch.cs
- ListBoxAutomationPeer.cs
- PixelFormats.cs
- WriteTimeStream.cs
- TagNameToTypeMapper.cs
- PathFigure.cs
- ListSourceHelper.cs
- NativeMethods.cs
- SQLInt16Storage.cs
- DesignerWidgets.cs
- SoapCommonClasses.cs
- ScriptControlDescriptor.cs
- UnsafeNativeMethods.cs
- UrlMappingsSection.cs
- DebugViewWriter.cs
- WindowsTitleBar.cs
- PrinterResolution.cs
- StorageEntitySetMapping.cs
- StrongName.cs
- SocketElement.cs
- HyperlinkAutomationPeer.cs
- AppDomainFactory.cs
- HMAC.cs
- LeafCellTreeNode.cs
- KeyboardDevice.cs
- DeclarativeCatalogPart.cs
- WinCategoryAttribute.cs
- XXXOnTypeBuilderInstantiation.cs
- PtsCache.cs
- Win32.cs
- PerformanceCounterPermissionEntry.cs
- LoginCancelEventArgs.cs
- PageHandlerFactory.cs
- WorkflowControlClient.cs
- WindowsEditBox.cs
- DbSetClause.cs
- GridSplitterAutomationPeer.cs
- ProcessingInstructionAction.cs
- ControlCachePolicy.cs
- SynchronizingStream.cs
- AssemblyHash.cs