【发布时间】:2010-08-31 06:16:52
【问题描述】:
我正在尝试为我自己构建的图形应用程序编写强制导向或强制图集代码库。这是我正在尝试的示例:http://sawamuland.com/flash/graph.html
我设法在 Wiki Force-atlas 文章中找到了一些伪代码来完成我想要的。因为它是一个 Flash 应用程序,所以我已将其转换为 ActionScript 3.0 代码。这是我的来源:
var timestep:int = 0;
var damping:int = 0;
var total_kinetic_engery:int = 0;
for (var node in list) {
var net_force:int = 0;
for (var other_node in list) {
net_force += coulombRepulsion(node, other_node, nodeList);
}
for (var spring in list[node].relations) {
net_force += hookeAttraction(node, spring, nodeList);
}
list[node].velocity += (timestep * net_force) * damping;
list[node].position += timestep * list[node].velocity;
total_kinetic_engery += list[node].mass * (list[node].velocity) ^ 2;
}
现在的问题是找到伪代码或函数来执行库仑斥力和胡克引力代码。我不完全确定如何做到这一点。
有没有人知道我可以查看的很好的参考资料...快速理解和实施?
最好的。
【问题讨论】:
标签: actionscript-3 math graphing