在PathGeometry内部进行命中测试 [英] Hit Testing inside of PathGeometry

查看:138
本文介绍了在PathGeometry内部进行命中测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我将图像剪切到PathGeometry上,如何将该PathGeometry内的特定点命中另一个具有相似属性的对象.基本上,我想检查Image1或Image2的一部分是否彼此靠近,以及是否将它们组合成一个边框对象.如果我能弄清楚如何通过命中测试来启动某个功能或其他东西,那么我可以自己将它们组合起来.

Image1

If I clip an image to a PathGeometry how can I hittest a specific spot inside that PathGeometry to another object with similiar properties. Basically I want to check if a part of Image1 or Image2 go near each other and if they do combine them into one border object. If I could figure out how to get the hit test to launch a function or something I could then combine them myself.
 
Image1

<Image x:Name="piece1" Width="866" Height="577" Stretch="Fill" ClipToBounds="False" SnapsToDevicePixels="False">
                <Image.Clip>
                    <PathGeometry Figures="M292,268c4-24,3-47-6-69c-24-2-47,7-71,1c-28-7-50-26-58-50c-13-41,37-81,79-67c18,6,24,29,41,39c6,4,10-4,10-8
    c0.6-37.784,3.351-76.287,0.5-114H0v302.767C43.442,290.788,87.721,281.405,132,288c12,20-16,29-23,44s-8,38,9,47c31,16,84,0,76-40
    c-3-17-28-32-21-53c37.363-1.384,74.512-0.64,111.646,0.171c0.125-1.391,0.245-2.781,0.354-4.171C286,278,291,273,292,268z"/>
                </Image.Clip>
            </Image>

图片2


<Image x:Name="piece2" Width="866" Height="577" Stretch="Fill" ClipToBounds="False" SnapsToDevicePixels="False"> <Image.Clip> <PathGeometry Figures="M561,267c-1-36-9-81,24-105c14-9,34-1,50-6c27-10,26-44,21-70c-2-14-15-24-28-23c-16,0-22,20-36,27 c-10,5-17-6-19-13c-6.324-25.871-6.367-51.411-5.832-77H287.5c2.85,37.713,0.099,76.216-0.5,114c0,4-4,12-10,8c-17-10-23-33-41-39 c-42-14-92,26-79,67c8,24,30,43,58,50c24,6,47-3,71-1c9,22,10,45,6,69c-1,5-6,10-7,14c-0.11,1.39-0.229,2.78-0.354,4.171 c43.37,0.947,86.717,1.984,130.354-0.171c2,0,4-13,0-18c-11-15-32-16-43-31c-10-12-10-32,0-44c26-32,73-29,105-9c24,13,6,47-4,69 c-4,10-3,29,3,30c28.643,6.249,57.285,7.342,86.069,6.816C560.218,282.211,561.761,274.605,561,267z"/> </Image.Clip> </Image>

谢谢,Teq


------------------------------------ tq

Thanks, Teq


------------------------------------ tq

推荐答案

有一个CodePlex项目可以为您完成所有这些工作:
http://farseerphysics.codeplex.com/
There's a CodePlex project that does all that stuff for you:
http://farseerphysics.codeplex.com/


这篇关于在PathGeometry内部进行命中测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆