sorry, i only take a short look
-a- you use too may arrays what complicates the code,
pls make ONE array
[0] is the white ball
[1] … [7] red
[8] … [14] yellow
[15] black
you can store the color in the class or just make for the color a if else
you can also put the first position to an array
so the first_placing_ball() can be a one-line command
also might be good to make one array for the holes.
-b- what is confusing
in
ball_detection()
you calculate a distance between all balls
( loop over i and j ?? looks like check each collision twice? )
using dist()
then you call
calculate_collision()
and inside you calculate distance again??
but use d = sqrt(sq(dx)+sq(dy))
add one time compare with ballSize and one time with 2* ballSize
while you use PVector could use
https://processing.org/reference/PVector_dist_.html
for the mag calc
https://processing.org/reference/PVector_mag_.html
the rest defines a x y position for the 2 balls after collision,
that should be a new direction and speed, but not position???