An "energy" field simulation with flows and energy production/consumption

Started by
6 comments, last by apatriarca 7 years, 5 months ago

Hey,

Is there any algorithm or math function which allows to calculate a more-less uniform distribution based on coordinates (2d or 3d) and, maybe, time?

With possibility to "drain"/add energy from/to any point of the field and in such cases dynamically calculate flows of the energy from "high" points to "low" points.

I've already tried to play with Gaussian function – it's pretty good in this case, and allow to make multiple peaks, both positive (energy production) or negative ("consumption"), but I'm not sure how to calculate dynamic flows (the field should tend to be uniform).

The main disadvantage in case of Gaussian is that it's pretty heavy to calculate, especially if I have lot of peaks.

Is there any other similar/suitable functions? Or, maybe, I'm thinking in a wrong way and there are different approaches exist to calculate such things?

Advertisement

I am not sure what you mean by the field to be uniform. You can use any function with a peak in the point to create production or consumption. Different functions will obviously look different. A good candidate can probably be cubic B-spline basis functions. They are quite fast to evaluate and they have a local support. Their derivative is also very easy to compute (which makes it easier to compute the flow).

I am not sure what you mean by the field to be uniform. You can use any function with a peak in the point to create production or consumption. Different functions will obviously look different. A good candidate can probably be cubic B-spline basis functions. They are quite fast to evaluate and they have a local support. Their derivative is also very easy to compute (which makes it easier to compute the flow).

Sorry, I'm not strong in math and also english is not my native language...

"Uniform" – I mean it should have more-less "flat" surface, except peaks, similar to the Gaussian function – it tends to "0":

[attachment=33893:Normal_Distribution_PDF.svg.png]

Could you please write an example of cubic B-spline basis function with 2 peaks?

BTW, I've found the great article about what I'm looking for: http://pd.chem.ucl.ac.uk/pdnn/peaks/peakindx.htm

(at least, until I found any better/different way to implement such field)

: http://pd.chem.ucl.ac.uk/pdnn/peaks

broken link


particle based water or airflow simulations might be a good approach.

particles start uniformly distributed over a grid. You can then add positive and negative influence points to the grid, and move the particles based on the influences, resulting in different particle densities in different places - IE peaks and valleys.

Similar to a paint program type editor for a heightmap.

Norm Barrows

Rockland Software Productions

"Building PC games since 1989"

rocklandsoftware.net

PLAY CAVEMAN NOW!

http://rocklandsoftware.net/beta.php

I can't open your link but the basic approach is to define your field as a sum of basis functions centered at the maximum and minimum points. Many different functions can be used. Some additional examples include rational functions like 1/(1 + x^2) or piece-wise polynomial or trigonometric functions like F(x) = cos(x) + 1 in [-pi, pi] and zero outside. What other properties do you want from your peaks?

A cubic B-spline basis function is a piece-wise polynomial function which is used as the basis for B-spline curve and surfaces. It is defined recursively and they can be defined for any order/degree. The cubic B-spline basis functions are the more common ones. The local support property can be useful in this case since it means the function is zero outside some distance from these points (thus reducing the amount of computation required).

broken link

Thanks, fixed. (and here it is as well: http://pd.chem.ucl.ac.uk/pdnn/peaks/peakindx.htm )

particle based water or airflow simulations might be a good approach.

Yes, I'm thinking about this way as well, but it could be much more complicated both for implementation and computing time requirements.

Also, the main disadvantage, it will not allow to calculate a value at random coordinates without knowing all previous calculations. (In case of Gaussian function I need only last known peaks coefficients).

cubic B-spline basis

I've fixed the link; And thanks for this suggestion, it looks exactly what I'm looking for... Will try to learn about those functions, since for now I don't yet understand exactly about it...

Am I understand it correctly – I need to calculate multiple functions (one for each peak) and then make some interpolation to combine the results?

Not really interpolation. That's a simple sum over the non-zero functions.

This topic is closed to new replies.

Advertisement