Hi. Thank you. I think for no. 3, commas were placed to avoid confusion, whereas, for no. 1, no comma is necessary since it is clear the person throwing the basketball is the man, not the shirt.
1.The man in the blue shirt throwing the basketball is my friend.
2.The man of a gentle heart throwing the basketball is my friend.