# Confusion with implicit equation of straight line

I'm getting started with 2D graphics. I've read that a straight line can be expressed as the following implicit equation.

$\vec{N} \cdot \vec{L} + d = 0$

Where, $\vec{N}$ is normal vector and $\vec{L}$ is the position vector for a point on the line. I have confusion with $d$. Is it the distance of the line from the origin along the normal vector or against the normal vector? In other words, for a straight line $\{4\hat x,5\hat y\} \cdot \vec{L} + 4 = 0$ what will be the correct graphical representation, left one or the right one?

The greenish blue line is the normal and the red one is the intended straight line drawn with cairo-graphics and GTK+.

Hint:

$\vec L$ is a generic vector $(x,y)^T$. Lock at what becomes your equation if $d=0$, than do the same with a $d \ne 0$.

If $\vec N=(4,5)^T$ ( as in your example) , than for $d=0$ the equation becomes $4x+5y=0$ that, as you noted, is the equation of a line that passes thorough the origin since $(0,0)$ satisfies it.

If $d \ne 0$ the equation becomes $4x+5y+d=0$ ad you can see the for $x=0$ the equation is satisfied if $y=-d/5$ so the line intersect the $y$ axis at the point $(0,-d/5)$. In the same way you can find the intercept of the line with the $x$ axis that is $(-d/4,0)$.

If $\vec N=(a,b)$ is a unitary vector ( i.e. $\sqrt{a^2+b^2}=1$) than $|d|$ is the distance of the line from the origin.

This is the simpler interpretation of $d$.

• The line will pass though origin if $d$ becomes 0, because then the position vector of any point on the line is perpendicular to the normal vector. But how does that help me finding whether $d$ is calculated along or against the normal? Sorry but I'm new to these. – Samik Feb 21 '16 at 16:33
• I've added something to my answer. I hope it's useful. – Emilio Novati Feb 21 '16 at 16:44
• I'm struggling with the interpretation here :( that means if $d=4$ the line should pass through $(0, -0.8)$ and $(-1,0)$, but the distance of that line from the origin is not 4, so is $d$ not the distance of the line from the origin? Or is that normalized co-ordinate? – Samik Feb 21 '16 at 17:00
• $|d|$ is the distance of the line from the origin only if $|\vec N|=1$ ( added to the answer). – Emilio Novati Feb 21 '16 at 19:16
• So a normalized normal makes $d$ the desired distance against the normal from the origin. Thanks, help much appreciated. Plotting is easier with the slope-intercept form as you mentioned. – Samik Feb 22 '16 at 6:57