I got a problem...A huge one..

Pages: 123
deleted
Last edited on
I have already read all the topics in this forum, which could help me, but there is no answer for my question..hey guys its really important...
Well it is probably too late now, but...

Do you know how to calculate the angle between two lines?
(Hint: trigonometric identities and slope)

Once you have the three angles, choose the smallest and calculate its cosine.

Good luck!

deleted
Last edited on
It doesn't get more clear.

Google around "angle between two lines". This will give you the formula to convert two slopes into an angle using atan() (you'll need to #include <cmath>).

Once you have the three angles of your triangle, choose the smallest and calculate the cosine.

Good luck!
deleted
Last edited on
do you know any trigonometry at all?
which part of my explanation wasn't clear enough?
don't go around making new threads. http://www.cplusplus.com/forum/beginner/31177/
deleted
Last edited on
closed account (D80DSL3A)
I would like to help but cannot due to your usage of these mysterious ccc_win based objects.

Does a Point variable (say p1) have data members like p1.x and p1.y?

If we can get at the raw x,y values (integer, float, double - whatever type they are) for each of the points then a calculation can be made.
Please show how to extract these numbers from a Point variable.
deleted
Last edited on
But i cant assign variables, because i must use get_mouse.(I think i cant assign variables, if i am wrong correct me.)


You're wrong. See here:

1
2
3
Point p1 = cwin.get_mouse("");
Point p2 = cwin.get_mouse("");
Point p3 = cwin.get_mouse("");


that assigns the variables p1, p2, and p3 with the coords of where the user clicked.

below that you have lines 'a', 'b', and 'c' which form the triangle.

You have everything you need to calculate the cosine of the minimal angle. All that's left is for you to do the math involved with the variables you already have.
deleted
Last edited on
I dont know how to assign the angles


double angle = /*insert math to calculate the angle here*/;

Duoas already gave various suggestions as to how to discover the math involved.

how to tell the program to calculate the cosine of the minimal angle


double answer = cos( minimal_angle );
ok and how to set the program to take the smallest angle everytime?
deleted
Last edited on
ok moorecm, but i think u should explain to me whats internet first, i am a monkey,u know..
I am in trouble, i though here i will find some help, but again someone thinks that he is God..
deleted
Last edited on
Pages: 123