Jump to content
  • Advertisement
Sign in to follow this  
Raab314159

Math Cosmetics!

This topic is 5097 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

These questions may seem a bit unusual, but let's give it a try: 1) Why is the default slope formula "m = (y2-y1)/(x2-x1)" and not "m = (y1-y2)/(x1-x2)" 2) Say you have to label two arbitrary points on a line, with the labels P1 and P2, would you put P1 to the left and P2 to the right, just because it looks nice? Or are there any official rules involved? Tnx

Share this post


Link to post
Share on other sites
Advertisement
Ack, try to stay away from the homework questions.

But while I'm here, I guess the reasoning behind the (y2-y1)/(x2-x1) is that if the line has a positive slope, you will be left with a positive numerator and denominator. (EDIT: and if the line has a negative slope, either numerator or denominator will be negative. So P2-P1 lets you work with negatives less. Everyone hates negatives hahaha =)

Official rules about it would be stupid, as the two are perfectly equivalent

(y2-y1) / (x2-x1)
-(y2-y1) / -(x2-x1)
(y1-y2) / (x1-x2)

Share this post


Link to post
Share on other sites
Quote:
Original post by Neosmyle
But while I'm here, I guess the reasoning behind the (y2-y1)/(x2-x1) is that if the line has a positive slope, you will be left with a positive numerator and denominator. (EDIT: and if the line has a negative slope, either numerator or denominator will be negative. So P2-P1 lets you work with negatives less. Everyone hates negatives hahaha =)


Thank you, that's pretty clear. From what you are saying here I can also deduce the points (x1,y2) and (x2,y2) are put on the line from left to right by default :)

[Edited by - Raab314159 on August 3, 2004 4:25:05 PM]

Share this post


Link to post
Share on other sites
No, they are not put on the line from left to right by default... nor is the ordering determined by the direction the line runs... well, at least, not directly.... the direction the line runs is a consequence of something else... and that is trigonometry.

The gradient of a line, m, (which you must remember is a gradient relative to something else) is equal to the tan of the angle between the line and the positive x axis. So, we know that the gradient is measured relative to the positive x axis. tan increases from zero with positive angle from 0 radians up to pi/2 radians, so therefore gradient must also increase in that direction. If the gradient of the line is defined by the change in the vertical direction divided by the change in the horizontal direction, then the this implies an ordering on the points on the line and in the equation for gradient.

As to what happens when the line is vertical, you have an infinite vertical change divided by a zero horizontal change, which gives an infinite gradient (which can be confirmed by checking that the tan(pi) = infinity.

Cheers,

Timkin

Share this post


Link to post
Share on other sites
1) The vector that goes from (x1,y1) to (x2,y2) is (x2-x1,y2-y1). You can then get the slope by dividing (y2-y1)/(x2-x1). I find that choice more elegant.

2) Ask a mathematician to draw an arbitrary line, and you will get a horizontal line. Ask him to put two points P1 and P2 on it, and you will get P1 on the left and P2 on the right. We mathematicians have limited imaginations. :)

Share this post


Link to post
Share on other sites
Ask me to do an arbitrary line and you get a 45 degree positive slope, but maybe that's because I'm a physicist?

Any other disciplines want to add to this little psychological experiment?

Share this post


Link to post
Share on other sites
I will go for the .25 * PI radians line.. but that's because I'm a programmer ;)

About the labeling.. If I draw a 45 degrees line I would label the left point (x1,y1) and the right point (x2,y2) just because I read from left to right and the numbers go from low to high..

But I would calculate m then with (y2 - y1) / (x2 - x1) to make sure I get a positive slope.

Share this post


Link to post
Share on other sites
If asked to draw an arbitrary line, I'd draw a circle... it's one of the hardest shapes for a human to draw, yet one of the simplest and most elegant! ;)

...and I doubt this choice has anything to do with my educational training (maths/physics/philosophy/computing).

Timkin

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!