Solving a Tough Angle Problem: Comparing Cases A and B

  • Context: High School 
  • Thread starter Thread starter Jake
  • Start date Start date
  • Tags Tags
    Angle
Click For Summary

Discussion Overview

The discussion revolves around a complex angle measurement problem involving two cases, A and B, where participants explore how to sequentially measure angles between lines in a diagram. The focus is on understanding the spatial relationships and how to accurately represent angles in a mathematical context, with implications for programming and computational geometry.

Discussion Character

  • Exploratory
  • Technical explanation
  • Mathematical reasoning

Main Points Raised

  • One participant describes a challenge in measuring angles sequentially between lines in two different cases, noting discrepancies in angle measurements despite similar numerical values.
  • Another participant suggests using positive and negative numbers to represent angles, indicating counter-clockwise as positive and clockwise as negative.
  • A different participant proposes measuring each segment's angle relative to the prolongation of the previous segment, suggesting that this method could help in accumulating total orientation changes.
  • One participant acknowledges the need to determine which side of a line will measure greater or less than 180 degrees, expressing uncertainty about how to mathematically relate this to previous angle measurements.
  • Another participant asks for clarification on the data available, specifically the coordinates of the endpoints of the segments.
  • A participant explains a method using the arctangent function to calculate angles based on the differences in coordinates, detailing how to handle various cases based on the signs of the differences.
  • One participant expresses difficulty in understanding the transformation of angles into a "real" angle, seeking clarification on how to apply the signs of the differences in coordinates to determine the correct angle representation.
  • Another participant proposes an experiment involving a C program to calculate angles, encouraging the exploration of different cases to understand the relationship between the coordinates and the resulting angles.

Areas of Agreement / Disagreement

Participants generally agree on the need to accurately measure angles and explore different methods for doing so. However, there is no consensus on the best approach, and multiple competing views and methods remain under discussion.

Contextual Notes

Participants express uncertainty regarding the mathematical relationships between angles and the sides of lines, as well as the implications of different coordinate choices on angle calculations. There are unresolved aspects related to the transformation of calculated angles into a desired format.

Jake
Messages
90
Reaction score
0
This is a tough angle problem (For me),

In the diagram below, I have two cases, A and B. In each case, when I sequentially compare the black, blue, and then green lines to the previous line, in each case you end up with the following angles: ~30 and ~30. Yet clearly the spatial relationships of the lines in cases A and B are different!

So how could I measure lines sequentially, so I can build up a relationship of 360 degree angles between the lines?

refering to the image, case A would rightfully measure ~30 degrees then ~330 degrees. case B would measure ~30 and ~30 again.

Hope that made sense.

Thanks!
 

Attachments

  • anglecompare.jpg
    anglecompare.jpg
    2.4 KB · Views: 442
Last edited:
Mathematics news on Phys.org
Have you ever thought about using +ive and negative numbers to represent your angles. For example +ive for a counter-clockwise angle and -ive for a clock-wise angle?
 
It might be useful to measure the angle of each next segment with respect of the prolongation of the previous; in the attached image, the green line would be measure against the dotted line. An angle of 0 would represent the next segment continuing in exactly the same direction; a positive angle would be a left (counter-clockwise) turn, negative angles for right (clockwise). This is useful if you want to accumulate the total change of orientation as the line progresses: you would only need to sum the angles.
 

Attachments

  • line.jpg
    line.jpg
    1 KB · Views: 470
Uart and Dodo, both your insights are correct, I need to compare which "side" the new line is on relative to the old one. However, the current problem is I have no way of deciding which side is the one which will measure greater than 180 degrees, and which one less, based on what the previous angle measurement was. I just don't know how to mathematically relate a side of a line to either the >180 or <180 degrees.

Thanks again :)
 
Exactly what data do you have? The coordinates of the endpoints of the segments, for example?
 
Yep Dodo, a sequential list of all points, including knowing what the 'first' and 'last' points are. Each point is both the beginning and end of a 'line' (unless its the first or last point of course)
 
Last edited:
Then you have everything you need.

Most calculators (or programming languages in a computer) will have an inverse tangent, tan^-1, or arctan, function. Let P and Q be the endpoints of some segment; and let dx = Qx-Px, and dy = Qy-Py. Then, in theory, arctan(dy/dx) gives you the angle between that segment and the horizontal, possibly in the range -90...+90.

In practice, you would use the signs of dx and dy to complete your choice of angle. In practice, you would avoid vertical segments (where dx=0), to avoid a zero division. You can accomplish both things by using the following trick: choose the maximum of |dx| and |dy| (where |dx| means the absolute value of dx, the magnitude of dx without considering the sign), and calculate the arctan(dy/dx) if |dx| is bigger, or arctan(dx/dy) if |dy| is bigger. Then transform the angle you get into the "real" one, according to the choice you made, and according to the signs of dx and dy. This "real" angle is usually chosen positive from 0 to 180 (the region above the X axis), or negative from 0 to -180.

There are 8 possible cases you have to consider (dx positive or negative, dy positive or negative, |dx| bigger or smaller than |dy|) which correspond to the 8 octants of the whole circle (the 8 pieces of the circle in 45-degrees steps). Give some thought to what happens on each of the 8 cases, and come back with more question at whichever point you get stuck, if at all.

Here is an example: for points P=(105, 106) and Q=(108, 102), you have dx = 3, dy = -4. Now, since the absolute value of -4 (which is 4) is greater than the absolute value of 3 (which is the same 3), we choose to calculate the angle arctan(dx/dy) = arctan(3/-4) = -36.87 degrees (aprox.). Since your choice was to invert dx and dy (and divide by dy, when the "theoretical" formula divided by dx instead), you are really calculating, loosely speaking, the angle with respect to the vertical (you have to imagine interchanging the x and y axis). I have attached a picture; there you can see the -36.87 angle, and the final, "real" angle which in this case is -90 + 36.87 = -53.13 degrees (I hope the picture illustrates why). Minus 53.13, because it is under the X axis.

Of course, once you have a (signed) angle for each individual segment, a simple subtraction will give you the relative, signed angle differences.
 

Attachments

  • angle.jpg
    angle.jpg
    3.6 KB · Views: 413
Last edited:
Alright, I think that sounds like it will work. However, being a self-taught computer science and non-math guy, I can't conceptually understand everything you said :biggrin: I understand enough to implement it in software (C++) however, except for this one aspect:

Then transform the angle you get into the "real" one, according to the choice you made, and according to the signs of dx and dy. This "real" angle is usually chosen positive from 0 to 180 (the region above the X axis), or negative from 0 to -180.

I hope I can pick your brain to understand this last bit. When you say the "according to the choice you made", are you referring to choosing to divide by dx or dy, this is automatic isn't it, based on just which one is bigger (in absolute terms)? If not, how do I make this choice? Secondly you also said "and according to the signs of dx and dy"; how do I do this deciding based on the signs of dx or dy, in order to further decide the "real" angle, in terms of +/-180 degrees?

In any case, I greatly appreciate all help rendered up to this point :)
 
Well, I know you need help, but I really didn't want to do all the work myself. I propose the following experiment:

Write a C program that accepts two floating-point values, a, b, and calculates the value of 180 * atan(a/b) / M_PI, where M_PI is the 'pi' constant (3.14159...) that you get for free when you #include <math.h>. The purpose of multiplying by 180 and dividing by pi is, of course, to convert the value returned by atan, from radians to degrees.

Now, the red dots in the attached picture are possible values of dx, dy. Try running your program, choosing (by hand) a=dx and b=dy when dy is bigger in absolute value, and a=dy, b=dx on the contrary. Get sure to try dx, dy values on each of the 8 octants, which I have drawn for your ease of use. You can start with the big red dot in the picture, which corresponds to the example at the bottom of my previous post.

In each case, you'll notice that you get angles with respect to the horizontal (green) X axis when dividing by dx, and angles with respect to the vertical (red) Y axis when dividing by dy. And your final goal is to pick a formula (typically, one of 90 + angle, -90 - angle, 180 + angle, of just the angle) that converts, for each of the 8 cases, from the output of the program to the angle you want (I suggest You Want an angle with respect to the right half of the X axis, as in the picture of the previous post).

Please try the above, and let me know if/when you have further problems.
 

Attachments

  • axes.gif
    axes.gif
    834 bytes · Views: 502

Similar threads

  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 30 ·
2
Replies
30
Views
11K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
3
Views
1K
  • · Replies 14 ·
Replies
14
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 7 ·
Replies
7
Views
1K
  • · Replies 12 ·
Replies
12
Views
4K