Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / System / Windows / Media3D / RayMeshGeometry3DHitTestResult.cs / 1305600 / RayMeshGeometry3DHitTestResult.cs
//----------------------------------------------------------------------------
//
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//
//
// History:
// 06/22/2005 : [....] - Integrated from RayHitTestResult.
//
//---------------------------------------------------------------------------
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
namespace System.Windows.Media.Media3D
{
///
/// The HitTestResult of a Visual3D.HitTest(...) where the parameter
/// was a RayHitTestParameter and the ray intersected a MeshGeometry3D.
///
/// NOTE: This might have originated as a PointHitTest on a 2D Visual
/// which was extended into 3D.
///
public sealed class RayMeshGeometry3DHitTestResult : RayHitTestResult
{
//-----------------------------------------------------
//
// Constructors
//
//-----------------------------------------------------
#region Constructors
internal RayMeshGeometry3DHitTestResult(
Visual3D visualHit,
Model3D modelHit,
MeshGeometry3D meshHit,
Point3D pointHit,
double distanceToRayOrigin,
int vertexIndex1,
int vertexIndex2,
int vertexIndex3,
Point barycentricCoordinate) : base (visualHit, modelHit)
{
_meshHit = meshHit;
_pointHit = pointHit;
_distanceToRayOrigin = distanceToRayOrigin;
_vertexIndex1 = vertexIndex1;
_vertexIndex2 = vertexIndex2;
_vertexIndex3 = vertexIndex3;
_barycentricCoordinate = barycentricCoordinate;
}
#endregion Constructors
//------------------------------------------------------
//
// Public Methods
//
//-----------------------------------------------------
///
/// This is a point in 3-space at which the ray intersected
/// the geometry of the hit Model3D. This point is in the
/// coordinate system of the Visual3D.
///
public override Point3D PointHit
{
get
{
return _pointHit;
}
}
///
/// This is the distance between the ray's origin and the
/// point the PointHit.
///
public override double DistanceToRayOrigin
{
get { return _distanceToRayOrigin; }
}
///
/// Index of the 1st vertex of the triangle which was intersected.
/// Use this to retrieve the position, texturecoordinate, etc. from
/// the MeshHit.
///
public int VertexIndex1
{
get { return _vertexIndex1; }
}
///
/// Index of the 2nd vertex of the triangle which was intersected.
/// Use this to retrieve the position, texturecoordinate, etc. from
/// the MeshHit.
///
public int VertexIndex2
{
get { return _vertexIndex2; }
}
///
/// Index of the 3rd vertex of the triangle which was intersected.
/// Use this to retrieve the position, texturecoordinate, etc. from
/// the MeshHit.
///
public int VertexIndex3
{
get { return _vertexIndex3; }
}
///
public double VertexWeight1
{
get { return 1 - VertexWeight2 - VertexWeight3; }
}
///
public double VertexWeight2
{
get { return _barycentricCoordinate.X; }
}
///
public double VertexWeight3
{
get { return _barycentricCoordinate.Y; }
}
///
/// The MeshGeometry3D which was intersected by the ray.
///
public MeshGeometry3D MeshHit
{
get { return _meshHit; }
}
//------------------------------------------------------
//
// Public Properties
//
//------------------------------------------------------
//-----------------------------------------------------
//
// Public Events
//
//------------------------------------------------------
//-----------------------------------------------------
//
// Internal Methods
//
//-----------------------------------------------------
internal override void SetDistanceToRayOrigin(double distance)
{
_distanceToRayOrigin = distance;
}
//-----------------------------------------------------
//
// Private Fields
//
//------------------------------------------------------
#region Private Fields
private double _distanceToRayOrigin; // Not readonly because it can be adjusted after construction.
private readonly int _vertexIndex1;
private readonly int _vertexIndex2;
private readonly int _vertexIndex3;
private readonly Point _barycentricCoordinate;
private readonly MeshGeometry3D _meshHit;
private readonly Point3D _pointHit;
#endregion Private Fields
}
}
// 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.
//
//
//
// History:
// 06/22/2005 : [....] - Integrated from RayHitTestResult.
//
//---------------------------------------------------------------------------
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
namespace System.Windows.Media.Media3D
{
///
/// The HitTestResult of a Visual3D.HitTest(...) where the parameter
/// was a RayHitTestParameter and the ray intersected a MeshGeometry3D.
///
/// NOTE: This might have originated as a PointHitTest on a 2D Visual
/// which was extended into 3D.
///
public sealed class RayMeshGeometry3DHitTestResult : RayHitTestResult
{
//-----------------------------------------------------
//
// Constructors
//
//-----------------------------------------------------
#region Constructors
internal RayMeshGeometry3DHitTestResult(
Visual3D visualHit,
Model3D modelHit,
MeshGeometry3D meshHit,
Point3D pointHit,
double distanceToRayOrigin,
int vertexIndex1,
int vertexIndex2,
int vertexIndex3,
Point barycentricCoordinate) : base (visualHit, modelHit)
{
_meshHit = meshHit;
_pointHit = pointHit;
_distanceToRayOrigin = distanceToRayOrigin;
_vertexIndex1 = vertexIndex1;
_vertexIndex2 = vertexIndex2;
_vertexIndex3 = vertexIndex3;
_barycentricCoordinate = barycentricCoordinate;
}
#endregion Constructors
//------------------------------------------------------
//
// Public Methods
//
//-----------------------------------------------------
///
/// This is a point in 3-space at which the ray intersected
/// the geometry of the hit Model3D. This point is in the
/// coordinate system of the Visual3D.
///
public override Point3D PointHit
{
get
{
return _pointHit;
}
}
///
/// This is the distance between the ray's origin and the
/// point the PointHit.
///
public override double DistanceToRayOrigin
{
get { return _distanceToRayOrigin; }
}
///
/// Index of the 1st vertex of the triangle which was intersected.
/// Use this to retrieve the position, texturecoordinate, etc. from
/// the MeshHit.
///
public int VertexIndex1
{
get { return _vertexIndex1; }
}
///
/// Index of the 2nd vertex of the triangle which was intersected.
/// Use this to retrieve the position, texturecoordinate, etc. from
/// the MeshHit.
///
public int VertexIndex2
{
get { return _vertexIndex2; }
}
///
/// Index of the 3rd vertex of the triangle which was intersected.
/// Use this to retrieve the position, texturecoordinate, etc. from
/// the MeshHit.
///
public int VertexIndex3
{
get { return _vertexIndex3; }
}
///
public double VertexWeight1
{
get { return 1 - VertexWeight2 - VertexWeight3; }
}
///
public double VertexWeight2
{
get { return _barycentricCoordinate.X; }
}
///
public double VertexWeight3
{
get { return _barycentricCoordinate.Y; }
}
///
/// The MeshGeometry3D which was intersected by the ray.
///
public MeshGeometry3D MeshHit
{
get { return _meshHit; }
}
//------------------------------------------------------
//
// Public Properties
//
//------------------------------------------------------
//-----------------------------------------------------
//
// Public Events
//
//------------------------------------------------------
//-----------------------------------------------------
//
// Internal Methods
//
//-----------------------------------------------------
internal override void SetDistanceToRayOrigin(double distance)
{
_distanceToRayOrigin = distance;
}
//-----------------------------------------------------
//
// Private Fields
//
//------------------------------------------------------
#region Private Fields
private double _distanceToRayOrigin; // Not readonly because it can be adjusted after construction.
private readonly int _vertexIndex1;
private readonly int _vertexIndex2;
private readonly int _vertexIndex3;
private readonly Point _barycentricCoordinate;
private readonly MeshGeometry3D _meshHit;
private readonly Point3D _pointHit;
#endregion 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
- ActiveXContainer.cs
- RelationshipManager.cs
- ScriptReference.cs
- QueryRewriter.cs
- CodeArgumentReferenceExpression.cs
- GridViewDeleteEventArgs.cs
- Int32Rect.cs
- CodeGenerator.cs
- ExtensionFile.cs
- CatalogPart.cs
- CacheRequest.cs
- ChooseAction.cs
- PageAsyncTaskManager.cs
- MetadataArtifactLoaderCompositeResource.cs
- PropertyEntry.cs
- dbenumerator.cs
- UserInitiatedRoutedEventPermissionAttribute.cs
- DashStyles.cs
- Quaternion.cs
- DesignerSerializerAttribute.cs
- XamlInt32CollectionSerializer.cs
- FixedSOMPage.cs
- ListViewInsertEventArgs.cs
- XomlCompilerResults.cs
- Thread.cs
- ExceptionHandler.cs
- IsolatedStorageFilePermission.cs
- DynamicDataRouteHandler.cs
- LabelTarget.cs
- XmlSerializationWriter.cs
- PropertyChange.cs
- PixelFormat.cs
- PolicyConversionContext.cs
- srgsitem.cs
- StrongNameMembershipCondition.cs
- GcSettings.cs
- XmlTextEncoder.cs
- updatecommandorderer.cs
- UpdateTracker.cs
- DataObjectSettingDataEventArgs.cs
- HttpModulesSection.cs
- activationcontext.cs
- SQLBoolean.cs
- SecurityDocument.cs
- CloudCollection.cs
- StylusPointPropertyInfo.cs
- TextSelectionProcessor.cs
- ParallelEnumerableWrapper.cs
- ImageClickEventArgs.cs
- RuntimeHandles.cs
- WsdlWriter.cs
- Columns.cs
- SQLSingleStorage.cs
- XmlArrayItemAttributes.cs
- LinqDataSourceStatusEventArgs.cs
- XmlAttributes.cs
- CssClassPropertyAttribute.cs
- FilteredDataSetHelper.cs
- UnmanagedMemoryStreamWrapper.cs
- TextFindEngine.cs
- ScrollProviderWrapper.cs
- HttpClientCredentialType.cs
- PermissionListSet.cs
- WasHttpModulesInstallComponent.cs
- RC2CryptoServiceProvider.cs
- SettingsAttributes.cs
- GlobalProxySelection.cs
- HostedElements.cs
- XmlHelper.cs
- ObjectHelper.cs
- EventlogProvider.cs
- PrinterSettings.cs
- NaturalLanguageHyphenator.cs
- EntityDataSourceChangedEventArgs.cs
- AdPostCacheSubstitution.cs
- HtmlLink.cs
- SortableBindingList.cs
- SamlAdvice.cs
- unsafenativemethodstextservices.cs
- _IPv6Address.cs
- PolyLineSegment.cs
- IntranetCredentialPolicy.cs
- DictionaryCustomTypeDescriptor.cs
- CommunicationObjectFaultedException.cs
- ApplyTemplatesAction.cs
- TabItem.cs
- sqlpipe.cs
- DiscoveryClientBindingElement.cs
- XPathQilFactory.cs
- DataContractAttribute.cs
- EventSetterHandlerConverter.cs
- InputMethodStateTypeInfo.cs
- SqlDataSourceFilteringEventArgs.cs
- AffineTransform3D.cs
- SuppressMessageAttribute.cs
- ButtonPopupAdapter.cs
- FastEncoderWindow.cs
- TextElementEnumerator.cs
- OrthographicCamera.cs
- LinqDataSourceInsertEventArgs.cs