I want to know if a ray from an arbitrary point will strike a polygon. It would be useful to know the point in space that intersection occurs and also a reference to that polygon. I'm using the System.Windows.Media.Media3D library and have done a ray trace test but have yet to crack any of teh information i want out of the HitTestResult object returned by VisualTreeHelper.HitTest.
Am i looking in the wrong place?
Is there a different approach to test for arbitrary intersection?
The Codez:
private void MainViewport_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
{
// Retrieve the coordinate of the mouse position.
Point pt = e.GetPosition((UIElement)sender);
// Perform the hit test against a given portion of the visual object tree.
HitTestResult result = VisualTreeHelper.HitTest(MainViewport, pt);
if (result != null)
{
// Perform action on hit visual object.
}
}