Function compute_attractive_potential

Function Documentation

void compute_attractive_potential(std::vector<float> &repulsive_field, int attractive_index, float attractive_power)

Computes and adds the attractive potential to the repulsive field.

This function modifies the given repulsive field by adding an attractive potential to each element. The attractive potential is computed as a linear function of the distance to the attractive index.

Parameters:
  • repulsive_field – A reference to a vector of floats representing the repulsive field.

  • attractive_index – An integer representing the index of the attractive point.

  • attractive_power – A float representing the strength of the attractive potential.