Re: find angle



Pierre Nouvellet <pierrenouvellet@xxxxxxxxxxx> wrote in message
<d673120a-7aab-4eed-9fca-92647d760f01@xxxxxxxxxxxxxxxxxxxxxxxxxx
om>...
Hi,

This might sound very stupid question:

i have an object (and its coordinate) travelling from point A to B and
then from B to C
the direction between the line AB is different from the one of BC

I would like to determine the angle, alpha, between ABC
I also would like it to be positive if clockwise, and negative if anti-
clockwise

So far i use a generalised pythagore theorem:

||AC||^2=||AB||^2 + ||BC||^2 - 2* ||AB|| * ||BC|| * cos (alpha)
and after it get messy for the angle...

Any suggestion to calculate the angle? (other than this formulae
above...)
any function in matlab for the sign of the angle?

Cheers...

Pierre
-------
If your points are in three-dimensional space, the concept of "clockwise"
and "anti-clockwise" would have no significance, so I'll assume your points
are two-dimensional. I assume you want the magnitude of alpha to be the
interior angle in triangle ABC at point B, and further that it is to be considered
positive if traveling from A to B to C is a clockwise direction around triangle
ABC and that alpha is to be negative otherwise.

Consider that points A, B, and C are represented by three two-element
column vectors, A, B, C, containing their respective x-y coordinate locations.
The angle in radians you request can be obtained with the single line:

alpha = atan2(det([A-B,C-B]),dot(A-B,C-B));

To get alpha in degrees, multiply by 180/pi. (If A,B,C are row vectors, then
det([A-B;C-B]) would be used here.)

In the three-dimensional case, det([A-B,C-B]) is replaced by norm(cross(A-
B,C-B)) and alpha would then always be the positive interior angle.

Roger Stafford

.



Relevant Pages

  • Re: find angle
    ... This might sound very stupid question: ... i have an object travelling from point A to B and ... I would like to determine the angle, alpha, between ABC ... I also would like it to be positive if clockwise, ...
    (comp.soft-sys.matlab)
  • find angle
    ... This might sound very stupid question: ... i have an object travelling from point A to B and ... I would like to determine the angle, alpha, between ABC ... I also would like it to be positive if clockwise, ...
    (comp.soft-sys.matlab)
  • Re: Question: Lorenz interpretation of SR v. Einsteins
    ... >> Although A and B are both travelling with the same speed, ... > while the one on the curved path ignores its own deviation, ... > incorrect to state that the angles A chose didn't affect its progress. ... > It's certainly erroneous to claim that the angle we choose DOES NOT affect ...
    (sci.physics.relativity)
  • Re: distribution of n point on the unit circle
    ... What is the probability density function or the distribution ... sector of the unit circle with that opening angle. ... alpha cannot be bigger than pi. ... if alpha> beta then the anticlockwise angle ...
    (sci.math)
  • Re: Is the speed of light really constant ?
    ... also travelling at a constant speed v2. ... the point indicated by x (located at the SW corner of the diagram), ... This is where the later light (or second car if you ... Will the angle Tyz, representing the 2nd car, be wider or more narrow ...
    (sci.physics.relativity)