Insert a path into a flowfield

Hi

I have an art project for my class. For this I would like to insert a path function to a flowfield.

I feel like im almost done, but cant seem to place the last puzzle.

For mye work I have been using the Coding trains tutorials on steering behavior and flowfield.

FlowfieldCode (This is the code used as basis, and the path code is adjustet to fit this): website/CodingChallenges/CC_024_PerlinNoiseFlowField/Processing/CC_024_PerlinNoiseFlowField at main · CodingTrain/website · GitHub

Path following Code: noc-examples-processing/chp06_agents/NOC_6_06_PathFollowing at master · nature-of-code/noc-examples-processing · GitHub

I have managed to make the path according to my wishes (and function when rehersing in the steering behaviour-code). But when I try to insert the path to the flowfield code, I cant seem to find the right method.

I think i need to place the path-function in the if-function on the bottom:

void draw() {
  if (sw.GetSeconds() >= 90) {
    Reset();
  }

  float yoff = 0;
  for (int y = 0; y<rows; y++) {
    float xoff=0;
    for (int x = 0; x<cols; x++) {
      int index = x+y*cols;
      float angle = noise2(xoff, yoff, zoff,y,x);
            //float angle = noise2(xoff, yoff, zoff,y,x, Path.points);
      PVector v = PVector.fromAngle(angle).setMag(1);
      flowField[index] = v;
      xoff+= inc;
    }
    yoff +=inc;
    zoff +=zinc;
  }
  FlowFieldParticles(flowField);
  //path.display();

 }
 
 float noise2 (float xoff, float yoff, float zoff, float y, float x){
   //return noise(xoff, yoff, zoff)*TWO_PI*4;
   // if på fjellet til fjellet, gå til høyre
   if (y <= cols/3 && y >= (cols/3)-3) { //  IF this - follow Path Vectors
     println("y-verdi");

     return PI;
     
   }
    return noise(xoff, yoff, zoff)*TWO_PI*4; 
 }

When I run this code, i get the effect i want, that the particle moves to the left in the area I have defined in the

  if (y <= cols/3 && y >= (cols/3)-3)
  • part of the code.

But I want it to follow the path i have defined in a seperate class acording to the Coding trains tutorial.

If you need more from my code to help, please let me know.