• Advertisement

Archived

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

i need some help

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

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

Share this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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/PI
sin(angle)


Share this post


Link to post
Share on other sites

  • Advertisement