Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

对风向图代码有点疑惑 #3

Open
xujunpro2 opened this issue Jan 25, 2019 · 5 comments
Open

对风向图代码有点疑惑 #3

xujunpro2 opened this issue Jan 25, 2019 · 5 comments

Comments

@xujunpro2
Copy link

hi,学习了你的代码,收获很多,对Windy.js有几个疑惑,望指点一二:
1。randomParticle方法中的

do {
x = Math.floor(Math.random() * (this.windField.cols - 2));
y = Math.floor(Math.random() * (this.windField.rows - 2));
} while (this.windField.getIn(x, y)[2] <= 0 && safe++ < 30);
这个do while循环是否有必要?粒子对象是想获得场网格的row和col的index吧

2。WindField.js的
_calcUV: function (u, v) {
return [+u, +v, Math.sqrt(u * u + v * v)];
},
我理解的u是json数据中的第一组值,v是json数据中的第二组值,这个算法的意义是什么?
望指点!万分感谢!

@xujunpro2
Copy link
Author

hi,刚看到一篇关于风场的科普文章,明白了U和V的意义,第二个问题已然明了了:)

@xujunpro2
Copy link
Author

hi,另外我移植到cesium1.5.3的时候,发现要做个销毁判断
//释放前一次粒子对象绘制的primitive
removeLines: function () {
if (this.lines) {
_primitives.remove(this.lines);
//1.5.3版本
if(!this.lines.isDestroyed())
{
this.lines.destroy();
}
}
},

@YanzheZhang
Copy link
Owner

YanzheZhang commented Feb 25, 2019

谢谢对代码bug提醒。
风场的工程是参照其它git工程:https://github.com/kobeCan/cesium-wind
没有深入研究算法。
该工程绘制效率不是很理想,可以通过重写primitive接口实现高效率绘制。

@xqwIOS
Copy link

xqwIOS commented Jul 5, 2019

你好 我参照你的代码 在vue上加载上了风场效果 但是发现流动的效果非常的卡顿 请问 有办法解决这种问题吗

@zhuoning1994
Copy link

zhuoning1994 commented Jul 9, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants