Sign in to follow this  
OtterBarcelona

generate random 3d vector field

Recommended Posts

OtterBarcelona    100
hi,
my project required me to visualize 3D vector field using various techniques
but i am now stuck at how to generate random 3d vector fields
been reading various paper, some suggested to used Radial Basis Function (RBF), POlynomial, or Lyapunoz exponent,
can someone guide me on how to generate random vector field using this function
and an algorithm how to compute for this function will be icing on a cake

thanks in advance (i hope i put in a correct topic)

Share this post


Link to post
Share on other sites
Antheus    2409
[quote]generate random 3d vector fields [/quote]

[code]struct Vector3D {
float x, y, z;
};

Vector3D field[N];
for (int i = 0; i < N; i++) {
field[i].x = rand();
field[i].y = rand();
field[i].z = rand();
}[/code]

Share this post


Link to post
Share on other sites
OtterBarcelona    100
thank you Antheus for the fast reply, very appreciated

i'm using python so i can render using mayavi,

my code are something like this (not all)

x, y, z = numpy.mgrid[-[color=#341bd3]1[/color]:[color=#341bd3]1[/color]:[color=#341bd3]100[/color]j,-[color=#341bd3]1[/color]:[color=#341bd3]1[/color]:[color=#341bd3]100[/color]j,-[color=#341bd3]1[/color]:[color=#341bd3]1[/color]:[color=#341bd3]70[/color]j] (this is my region)




to call a streamline i write




mlab.flow(x, y, z,u, v, w)







the question is how to and can i randomize u, v, w ?




thanks



Share this post


Link to post
Share on other sites
alvaro    21266
It's not clear at all what a "random vector field" means. Are you just trying to come up with some examples that would look pretty in your program?

Share this post


Link to post
Share on other sites
_Unicron_    438
[font="Arial"]I'm confused to what you actually want. Are you trying to create the vector field? Or are you struggling with the streamlines?[/font]
[font="Arial"]
[/font]
[font="Arial"]If you are creating the vector field to test visualization techniques you probably shouldn't use a random field. You have two[/font]
[font="Arial"]options:[/font]
[font="Arial"] - You can download some vector fields. I have a few simulations that I could make available for download if needed.[/font]
[font="Arial"] - You can use an analytic field. Try searching for Lorenz attractor. Again I can make some equations for various fields[/font]
[font="Arial"] available if needed.
[/font]
[font="Arial"]
[/font]
[font="Arial"]mlab.flow(x, y, z, u, v, w) -- What are the u,v,w, parameters here? Seed position for the streamline?[/font]


[font=Verdana][size=2][/size][/font]

Share this post


Link to post
Share on other sites
haegarr    7372
... or perhaps generate a field where only every n-th sample is random (in direction and/or length), and the samples in-between are interpolated. This also gives you vector fields with a smooth gradient.

Share this post


Link to post
Share on other sites
OtterBarcelona    100
[quote name='alvaro' timestamp='1306057875' post='4814174']
It's not clear at all what a "random vector field" means. Are you just trying to come up with some examples that would look pretty in your program?
[/quote]


yes, yes it is, because i'm more into visualizing, but now, i'm stuck how to choose vector data, because i dont have any


[quote name='_Unicron_' timestamp='1306059639' post='4814182']
[font="Arial"]I'm confused to what you actually want. Are you trying to create the vector field? Or are you struggling with the streamlines?[/font]

[font="Arial"]If you are creating the vector field to test visualization techniques you probably shouldn't use a random field. You have two[/font]
[font="Arial"]options:[/font]
[font="Arial"] - You can download some vector fields. I have a few simulations that I could make available for download if needed.[/font]
[font="Arial"] - You can use an analytic field. Try searching for Lorenz attractor. Again I can make some equations for various fields[/font]
[font="Arial"] available if needed.
[/font]
[font="Arial"]
[/font][/quote]

i tried googled 3d vector field data, but failed, could you do me an omelet size of favor to upload it, it would be much appreciated :)
i tried using lorenz attractor, but i need more data, so i can tackled more issues in visualizing vector fields
thanks :)



[quote name='haegarr' timestamp='1306060086' post='4814186']
... or perhaps generate a field where only every n-th sample is random (in direction and/or length), and the samples in-between are interpolated. This also gives you vector fields with a smooth gradient.
[/quote]
can you be more specific, because the problem is now, i never take any class on engineering so i found it very difficult to understand vector field subject, thanks :)

Share this post


Link to post
Share on other sites
haegarr    7372
[quote name='charlotteb' timestamp='1306099686' post='4814351']
[quote name='haegarr' timestamp='1306060086' post='4814186']
... or perhaps generate a field where only every n-th sample is random (in direction and/or length), and the samples in-between are interpolated. This also gives you vector fields with a smooth gradient.
[/quote]
can you be more specific, because the problem is now, i never take any class on engineering so i found it very difficult to understand vector field subject, thanks :)
[/quote]
A vector field is an assignment of vector values to a space. To visualize it one often draws the vectors, but that would look confusing when the vectors overlap each other, and it is impossible if the definition of the vector field is a continuous function. So one samples the space and draws vectors for each sample point only. E.g. [url="http://en.wikipedia.org/wiki/Vector_field"]the wikipedia article[/url] show such a visualization. Because the field is usually one of a "natural phenomena", it shows no abrupt changes, and the visualization should do so, too (assuming that the sampling theorem is not violated, i.e. that two neighbored samples are close enough), or else the nature of the field isn't presented correctly.

If you would generate a vector field by randomly generating vectors at each sample point, the visualization would show a chaotic picture, because each vector is generated without considering its neighbors. This can be prevented by generating random samples only for, say, each 10-th sample point in every dimension. The vectors at the samples in-between can then be computed by using just the formerly generated vectors in the surrounding. This is called interpolation. E.g. (bi-/tri-)linear interpolation is the simplest form, polynomial or spline or other higher order methods can be used to yield in more smooth interpolated vectors. Such a (admittedly discretely) generated vector field looks similar to those in the wikipedia article, although it shows a random field.

Interpolation is no speciality of vector fields. It has its usage for scalars or quaternions or others as well. General information can be found in [url="http://en.wikipedia.org/wiki/Interpolation"]this wikipedia article[/url].

Share this post


Link to post
Share on other sites
_Unicron_    438
[quote name='charlotteb' timestamp='1306099686' post='4814351']

i tried googled 3d vector field data, but failed, could you do me an omelet size of favor to upload it, it would be much appreciated :)
i tried using lorenz attractor, but i need more data, so i can tackled more issues in visualizing vector fields
thanks :)

[/quote]


Here are links to a couple to get you started:

[url="http://vis.computer.org/vis2004contest/data.html"]http://vis.computer.org/vis2004contest/data.html[/url]
[url="http://viscontest.sdsc.edu/2008/data.html"]http://viscontest.sdsc.edu/2008/data.html[/url]

In honesty, these might not be the easiest for you to get started with but hopefully you can make some progress.
I will add more over the next couple of days.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this