[英]Arbitrary ray test using C# and WPF
我想知道来自任意点的光线是否会撞击多边形。 了解空间中发生相交的点以及对该多边形的引用将很有用。 我正在使用System.Windows.Media.Media3D库,并已进行了光线跟踪测试,但尚未从VisualTreeHelper.HitTest返回的HitTestResult对象中破解我想要的任何信息。
我看错地方了吗?
是否有不同的方法来测试任意交叉点?
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.
}
}
我不知道System.Windows.Media.Media3D,但是:
我知道我的回答有些含糊,但无论如何我希望它对您有帮助。
您可以将HitTestResult
转换为RayHitTestResult
吗? 那有您需要的信息吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.