Jump to content
  • Advertisement
Sign in to follow this  
maxest

Line equation - slope-intercept and implicit forms

This topic is 2975 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

The slope-intercept form of the line equation is:

y = ax + b

Tangent vector can be computed like this:

(dy/dx, dy/dy) = (a, 1)


Line equation can also be given in an implicit form:

f(x, y) = y - ax - b

Normal vector to this line can be computed by using the gradient:

(df/dx, df/dy) = (-a, 1)


And here is where my confusion comes in. Since tangent and normal vector are perpendicular to each other, the dot product of these two vectors ( (a, 1) dot (-a, 1) ) should give 0, yet it doesn't. So I must have done some obvious mistake which I just cannot see.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by maxest
The slope-intercept form of the line equation is:

y = ax + b

Tangent vector can be computed like this:

(dy/dx, dy/dy) = (a, 1)



No, the tangent vector is (1,a). And it is correct that it is perpendicular to (-a,1).

Share this post


Link to post
Share on other sites
Your version of the "Tangent vector" from the slope-intercept form is wrong. You have your components flipped. This is easy to see. Suppose that you have a horizontal line such that a is equal to zero (0). Then, y = b. The line is horizontal. Intuitively, the tangent vector is (1, 0). But your equation yields (0, 1). Bottom line, both of your equations are for the normal to the line.

So, mathematically why is this? If we look at it in terms of differential values rather than derivatives, it might make sense. a is equal to dy/dx. What is in the numerator? It is a differential value for y. It is the amount that the line rises or falls, along the y direction, for every unit change in x. And, so dy/dx must go into the y slot of the tangent vector. For a finite value of a, the tangent is (dx/dx, dy/dx) = (1, dy/dx) = (1, a).

Now, to think of this further...if a is infinite....the line is vertical, this is not a nice representation...a tangent value of (1, a) = (1, infinity) is not well defined or easy to use. In any case, you can make a nice tangent as (dx/dy, dy/dy)...basically put "dy" in the denominator instead of dx to get (1/a, 1)...and for infinite a, 1/a == 0, so tangent is (0, 1).

It is not a problem that in one case you have a "-a" and in the other case an "a". That is just due to you, basically, defining your function f slightly different for each form, which is fine.

I hope that helps!

Share this post


Link to post
Share on other sites
Oh, shame on me. That's obvious and intuitive that in the tangent vector the x-coordinate should be constant since we're making equal steps on the X-axis and Y is the one that changes. Thinking about finite differential values instead of derivates makes it even clearer! Thank you guys for help.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!