| 55 | |
| 56 | '''Week 1''' |
| 57 | |
| 58 | I discussed the implementation with mentors. Based on that I will use similar approach as implemented in VTK, which computes the flowlines by integrating the vector field. To have a first prototype quickly, I will implement it in Python using PyGRASS to write vector lines and Python scripting library (array.py). I will write the Python code in a way which would make it easy to port to C. |
| 59 | |
| 60 | I was looking at the VTK implementation and visualized 3D vector field data in Paraview to better understand the algorithm. Basic implementation would look like this: |
| 61 | * input are three 3D rasters (3 components of vector field) and vector with seed points (from where the flowlines are integrated) |
| 62 | * for each point we integrate the flowline based on the velocity field and stopping criterion (time/length) |
| 63 | * the value of velocity field at a particular point is interpolated from the surrounding cells (voxels) probably using trilinear interpolation (which can be found in vtkVoxel class or on Wikipedia) |
| 64 | * integration will be done with Runge-Kutta method of 2nd or 4th order. |
| 65 | * so for example with 2nd order: first compute '''x'''(i+1) = '''x'''(i) + '''V'''(i) * delta_T and then '''x'''(i+1) = '''x'''(i) + delta_T/2 * ('''V'''(i)+ '''V'''(i+1)) where '''V''' is velocity field, '''x''' is location of point on flowline and delta_T is integration step. |
| 66 | * output will be vector of flowlines |
| 67 | |
| 68 | I will probably keep the code in sandbox and once it is usable, I will put it in addons |