如何在wpf中擦除,重画或删除3D对象? (基于计时器的动画) [英] How to Erase, Repaint or Delete a 3D object in wpf ? (Timer-Based Animation)

查看:156
本文介绍了如何在wpf中擦除,重画或删除3D对象? (基于计时器的动画)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用基于计时器的动画对三个3d对象进行动画处理.为此,我使用了调度程序计时器,在计时器任务方法中,我将3Dobject创建方法称为三次.在它的正下方,并且在同一Timer任务方法中,我包含了一组语句,这些语句为对象生成新的位置.
例如

I am using a timer-based animation to animate three 3dobjects. I have used a dispatcher timer for this purpose, and within the timer task method I have called my 3Dobject creation method thrice. Right below that and within the same Timer task method I have included a set of statements that generates new position for the objects.
For example,

private void timertask(object sender, EventArgs e)
       {
createsolid(x[0], y[0], z[0]); ->this creates the first cube w.r.t x,y,z positions
createsolid(x[1], y[1], z[1]);
createsolid(x[2], y[2], z[2]);
...
...
for(int i=0;i<4;i++)
{
...
...
x[i] = update_x[i];
y[i] = update_y[i];
z[i] = update_z[i];
}}




因此,每次触发计时器(当前设置为每秒触发10次)时,将在新的更新位置创建多维数据集(尽管速度非常慢).但是我现在面临的问题是我无法删除旧位置的多维数据集.因此,当计时器运行时,它将留下多维数据集的整个踪迹.当我为新位置创建多维数据集时,我想删除旧位置的多维数据集.或者,我想使用某种重绘方法或仅允许我一次创建多维数据集的方法,然后允许它根据及时生成的新位置移动多维数据集.

只需一个humbe请求.我是初学者,请放轻松.我将不胜感激一个直接的答复.也欢迎链接,但是我不需要xaml中的解决方案.我正在完全使用C#.

谢谢




So, everytime the timer is triggered(currently set to trigger 10 times a second), the cubes are created in a new updated position(very slow though). But the problem I face right now that I could not delete the cubes in old positions. Thus, it leaves a whole trail of cubes when the timer progresses. I want to delete the cube in old position when the cube is created for the new position. Or I would like to use some repaint method or something that just allows me to create the cubes just once and after that it should just allow me to move the cube according to the new positions generated in time.

Just one humbe request. I am a beginner and please go easy on me. I would greatly appreciate a striaght forward answer. Links are welcome too, but I don''t need solutions in xaml. I am working completely on C#.

Thanks

推荐答案

我在猜,但是...

0)要删除/擦除一个,是否不应该仅从父组的Children集合中删除它?

1)要对其进行更改,请从父组的Children集合中检索它并更改适当的值.
I''m guessing, but...

0) To delete/erase one, shouldn''t you just be able to delete it form the parent group''s Children collection?

1) To change it, retrieve it from the parent group''s Children collection and change the appropriate values.


这篇关于如何在wpf中擦除,重画或删除3D对象? (基于计时器的动画)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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