Windows中的对称2d绘图存储画布 [英] Symmetric 2d drawing in windows store canvas

查看:64
本文介绍了Windows中的对称2d绘图存储画布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



我需要在xaml的canvas控件上绘制对称绘图。如果可能的话,请给我一些提示。



作为参考: http://www.mathsisfun.com/geometry/symmetry-artist.html [ ^ ]



谢谢

解决方案

好吧,如果你想制作类似于那个链接的东西...那就可以在快速答案部分解释。



我建议你自己开始,当你遇到困难然后阅读你有什么尝试? [ ^ ]并回到这里,使用小部件改善问题编辑你的帖子,然后重新询问更具体的内容。我们会更容易为您提供帮助。



作为一种方法:

- 你知道你的画布有多大是的,所以你可以根据你选择的simetry在数学上划分它。

最容易的是轴和方向的反转。

困难的是部分的数量,你必须使用线知道点来创建它们(您的坐标原点)和角度(360 / number_of_axis)。您可以从以下开始: http://www.mathsisfun.com/equation_of_line.html [ ^ ]和 http://www.mathsisfun.com/algebra/line-equation-point-slope.html [ ^ ]



- 绘制symetry你必须使用OnMoveMouse,以像素为单位获取当前坐标并进行所需的转换,具体取决于激活哪个symetry。将反射坐标保存在其他任何位置,并使用它们以编程方式绘制与鼠标相同的坐标。从逻辑上讲,你需要这么多temp_savers作为你的坐标,因为refrexion轴是活跃的。





我希望它给你一点方向。



正如我所说,当你遇到问题并且答案会更好(我们更容易给出) )

Hi All

I need to draw symmetric drawing on canvas control of xaml. please give me some tip and if possible example.

for reference:http://www.mathsisfun.com/geometry/symmetry-artist.html[^]

Thank You

解决方案

Well, if you want to make something similar to that link... that's way to wide to be explained in the quick answers section.

I recommend you to start on your own, when you got stuck then read What have you tried?[^] and come back here, edit your post using the widget "improve question" and then re-ask something more concrete. It will be easier for us to help you with that.

As an approach:
- You know how big your "drawing canvas" is, so you can mathematically divide it in sections depending on the simetry you choose.
The easiest ones are the inversion of axis and direction.
The difficult ones are the number of sections, you have to create them using the ecuation of a line knowing a point (your coordinates origin) and an angle (360 / number_of_axis). You can start with: http://www.mathsisfun.com/equation_of_line.html[^] and http://www.mathsisfun.com/algebra/line-equation-point-slope.html[^]

- To draw the symetry you have to use the OnMoveMouse, getting your current coordinate in pixels and doing the needed conversion, depending which symetry is activated. Save the "reflected" coordinates anywhere else and using them to draw the same you are doing with the mouse programatically. Logically, you will need so much temp_savers for your coordinates as refrexion axis are active.


I hope it gives you a bit orientation.

As I said, feel free to come back with more concrete questions about your code, when you have problems and the answers will be better (and easier for us to give)


这篇关于Windows中的对称2d绘图存储画布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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