Vector Fields | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

Vector Fields

So I've known about vector fields from a fluid dynamics course I had in college, but I never thought to apply it to graphics in programming until yesterday. Upon researching a bit, I can't seem to find any information on how one would be structured. Does every particle loop through every vector in the field to see which it is closest to? How does that work? I'm just really curious. If anyone has any information on this, I'd appreciate it.

19th Nov 2017, 6:30 AM
Zeke Williams
Zeke Williams - avatar
5 Answers
+ 6
Thanks for the book reference! I'll have to read as much as I can later. It's bed time now 😴 For those curious, I'll try to understand it and then summarize it here. EDIT: Basically, it states that a particle will exist in a grid space, where each vector starts on the corners of each grid square. When a particle occupies a grid square, you bilinearly interpolate the four vectors that occupy the four corners of that square and apply that vector to the particle (most likely as an acceleration). I want to try this in an html canvas soon.
19th Nov 2017, 7:29 AM
Zeke Williams
Zeke Williams - avatar
+ 4
What the HECK Are Fields - Science Asylum (3:35) https://youtu.be/nxi8hGeicCM * Explains why field "lines" are a problem/loss of information (you want explanations that realize this) Understanding Goal-Based Vector Field Pathfinding (3:18) https://youtu.be/Bspb9g9nTto * 20,000 simultaneous particles * Distance field @ 1:14 * Vector field @ 1:55 * Graphics Tutorial: https://gamedevelopment.tutsplus.com/tutorials/understanding-goal-based-vector-field-pathfinding--gamedev-9007 * To me, this is like assigning machine learning's "gradient descent" to areas of space instead of data samples. Where I thought I saw the most beautiful explanations was 3blue1brown (such poetry; the explanations in science, computers, math)...but I couldn't​ find an exact match right away so...just so you know of the channel: Vectors -- What Even Are They? Essence of Linear Algebra Chapter 1 3Blue1Brown (9:52) https://youtu.be/fNk_zzaMoSs * Compares what 'vector' means from the viewpoints of physics, computer science and math.
19th Nov 2017, 5:26 PM
Kirk Schafer
Kirk Schafer - avatar
+ 3
Thanks @Kirk! I actually found those same videos too, but I didn't watch them because I thought I already knew from the large amounts of calculus and fluid dynamics I went through in school lol. I'll have to watch them from my newly formed programmer's perspective. But path finding sounds REALLY interesting. I'll have to give that a look too.
19th Nov 2017, 6:41 PM
Zeke Williams
Zeke Williams - avatar
+ 3
Awesome 😀 I just need to find some time to sit down and make one to see if I can get something to work!
19th Nov 2017, 11:58 PM
Zeke Williams
Zeke Williams - avatar
+ 2
@Zeke, your edit on the book response (corner vectors) also appears to be a solution for the 0-movement cell vectors in the tutorial link. I hadn't gotten around to fiddling with it, but looks interesting to me too :)
19th Nov 2017, 11:38 PM
Kirk Schafer
Kirk Schafer - avatar