Reflect

I have a Ball.

Xpos = 10
Ypos = 10
function draw()
    Xspeed = 5
    Yspeed = 5
    Xpos = Xpos + Xspeed
    Ypos = Ypos + Yspeed
    ellipse(Xpos, Ypos, 100)
end

If I have a line, that line could be anywhere with any slope, how would I make the ball bounce off of this line?
I have consulted my friends and they all are stumped, Help!

http://coolcodea.wordpress.com/2013/03/11/3-moving-an-object-around-the-screen/

I did use a similar method until I realized I may have to reflect off of lines that could be at any angle. The article only covers walls, which are verticle ans horizontle.

http://coolcodea.wordpress.com/2013/03/21/6-more-physics/

or without physics (harder to code)
http://coolcodea.wordpress.com/2013/10/24/129-physics-collisions/

thank you.