Confusion with implicit equation of straight line

534 Views Asked by At

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?

d is along the normal d is against the normal

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

1

There are 1 best solutions below

5
On BEST ANSWER

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$.