# generate random 3d vector field

This topic is 2588 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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 on other sites
generate random 3d vector fields [/quote]

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

##### Share on other sites
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=#341bd3]1:[color=#341bd3]100j,-[color=#341bd3]1:[color=#341bd3]1:[color=#341bd3]100j,-[color=#341bd3]1:[color=#341bd3]1:[color=#341bd3]70j] (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 on other sites
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 on other sites
[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 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][/font]

##### Share on other sites
... 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 on other sites

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?

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

[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 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]

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

... 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.

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 on other sites

[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.

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. the wikipedia article 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 this wikipedia article.

##### Share on other sites

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

Here are links to a couple to get you started:

http://vis.computer.org/vis2004contest/data.html
http://viscontest.sdsc.edu/2008/data.html

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.

1. 1
2. 2
3. 3
4. 4
Rutin
16
5. 5

• 12
• 9
• 12
• 37
• 12
• ### Forum Statistics

• Total Topics
631419
• Total Posts
2999977
×