使用WPF的Windows 8 Bubble Screen Saver [英] Windows 8 Bubble Screen Saver using WPF
问题描述
亲爱的所有人,
有人可以帮助我在WPF上开发像Windows 8泡泡屏幕保护程序这样的屏幕保护程序
我使用了以下链接我的参考..
http://channel9.msdn。 com / coding4fun / articles / WPF-Custom-Screen-Saver-Art [ ^ ]
我面临的问题是气泡彼此重叠..
有人可以指导我如何停止重叠气泡,它应该像
windows 8泡泡屏幕保护程序一样工作。
真诚地感谢任何帮助..
BestRegards,
Henry
Dear All,
Can someone help me on developing a screensaver like Windows 8 Bubble screensaver on WPF
I used the belowlink for my reference..
http://channel9.msdn.com/coding4fun/articles/WPF-Custom-Screen-Saver-Art[^]
I am facing a problem that bubbles are overlapping on each other..
Could someone guide me on how to stop overlapping the bubbles and also It should work like a
windows 8 bubble screensaver.
Any help would be sincerely appreciated..
BestRegards,
Henry
推荐答案
你需要检查两个气泡坐标之间的欧氏距离是否小于或等于两个气泡的半径之和(=一个气泡的直径,如果它们都是相同的大小)。
You will need to check if the Euclidean distance between the two bubbles' coordinates is less than or equal to the sum of the radii of the two bubbles (= diameter of one bubble if they are all the same size).
var deltax = b1.x - b2.x;
var deltay = b1.y - b2.y;
if (Math.Sqrt(deltax * deltax + deltay * deltay) <= b1.radius + b2.radius)
{
// the bubbles collide
}
这假设坐标是气泡的中心 !!
这篇关于使用WPF的Windows 8 Bubble Screen Saver的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!