[Math] Equation of a straight line in polar coordinates

polar coordinates

For line detection with Hough transform a line equation in Cartesian coordinates

y = m⋅x + b (1)

is transformed to polar coordinates to become:

p = x⋅cos(θ) + y⋅sin(θ) (2)

I'm trying to prove (2) from (1), but keep on getting

p = -x⋅cos(θ) + y⋅sin(θ) (2)

I attached my derivation below:

Derivation

Can anyone point me to where am I making a mistake?

Best Answer

As hinted by David Holden, sign of my slope equation was wrong, since during change of Δx, y changed by -Δy, not +Δy.