#### Archived

This topic is now archived and is closed to further replies.

# i need some help

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

## Recommended Posts

does anyone know how to find the slope of a line given the angle, starting point, and length? #include <leet>

##### Share on other sites
This is off the top of my head:
Point A = (Ax, Ay) <-- this is the starting point (which you say is given)Point B = (Bx, By)        = (Ax + length*cos(angle),Ay + length*sin(angle)) Slope  = (By - Ay) / (Bx - Ax)

Hope that is correct.

EDIT: Added code tags to preserve formatting

[edited by - Erunama on May 31, 2002 5:07:20 PM]

##### Share on other sites
thanks a lot.

ive been trying to figure out a way to do that for a long time

#include <leet>

##### Share on other sites
ok, after further testing of it, there is a problem.

the only angle ot really works on is 0

can you please see if there is a way to fix this

thanks

##### Share on other sites
If you have the angle, then the slope is the arctangent of the angle.

##### Share on other sites
Yes, double slope = atan(angle);!

##### Share on other sites
pyro: What form are you storing your angles in, degrees or radians? If you are using degrees, then of course you will be having problems because trig functions use radian measure.

To convert, just multiply the degree measurement by 180/PI

Here''s a little real code/pseudo-code:

  #define PI 3.14159...angle = angle*180/PIsin(angle)

1. 1
Rutin
42
2. 2
3. 3
4. 4
5. 5

• 18
• 20
• 14
• 14
• 9
• ### Forum Statistics

• Total Topics
633377
• Total Posts
3011562
• ### Who's Online (See full list)

There are no registered users currently online

×