开发者

Where can I learn about how to represent liquids mathematically for an HTML5 canvas? [closed]

开发者 https://www.devze.com 2023-01-24 11:13 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.

Closed 9 years ago.

Improve this question

I would like to learn how to represent liquid (water) in 2d and/or 3d mathematically to create a simulation using the HTML5 canvas. Any resources for this and/or representi开发者_开发知识库ng other real-world materials in 2d or 3d mathematically?


Probably the best (simple) mathematic representation of non-compressible fluids flow (one of which is water) is using finite element method over circulation field.

In simple case finite elememt method could deal with rectangular grid.

But in more complex cases (turbulence, cavitation, fluid/gas interaction) there may need to be used another methods, like particle systems or other types of fields.

Also there may be combination of methods: FEM simulates fulid itelf and particle system visualises it (simulating dust of small particles floating in fluid).


What you are looking for is called Particle Systems

Here is a technique to model fluids and it includes an implementation

You can use a physics engine like Box2D for javascript to create thousands of small circles or squares to simulate a fluid but I dont know if this is the way to go since you may face performance issues with this approach.


GPU Gems had a chapter on this. Might be a bit compute-intensive for HTML though.

0

精彩评论

暂无评论...
验证码 换一张
取 消