Algorithm problem involving 3 points and 3 lines in the x,y plane

Click For Summary

Homework Help Overview

The discussion revolves around an algorithmic problem involving two points A and B in the x,y plane, where participants are tasked with calculating the angle between the lines connecting these points to the origin. Additionally, they explore whether a third point C lies on the line segment connecting A and B.

Discussion Character

  • Exploratory, Conceptual clarification, Mathematical reasoning, Problem interpretation

Approaches and Questions Raised

  • Participants discuss the calculation of angles using arctangent functions and question the clarity of the problem statement. There are attempts to define the relationship between points A, B, and C, and whether additional information is needed to determine if C lies on the line between A and B.

Discussion Status

Some participants have suggested using the atan2 function for angle calculations, while others have raised concerns about the ambiguity in the problem's definition. There is ongoing exploration of the implications of the angles and the conditions under which point C would lie on the line defined by points A and B.

Contextual Notes

Participants note that the problem lacks specific details regarding the coordinates of point C and the exact nature of the line between points A and B. The discussion highlights the need for clearer definitions and constraints in the problem statement.

sHatDowN
Messages
52
Reaction score
7
Poster has been reminded (again) to show their work on schoolwork problems
Homework Statement
ArcTan Algorithm
Relevant Equations
Need to know how to implement arctan in algorithm
1- Coordinates of two points are given in x and y plane.
A(x1,y1), B(x2,y2)
Calculate the angle between the two lines passing through each of these points with the origin of linear coordinates.
2- If a line passes between the two points A and B above, does point C lie on this line?
C(x3,y3)

how to implement this algorithm?
 
Physics news on Phys.org
sHatDowN said:
Homework Statement:Algorithm
Relevant Equations: Algorithm

how to implement this algorithm?
Make a sketch

And find the exact problem statement. Not just the word algorithm

##\ ##
 
  • Like
Likes   Reactions: berkeman
It's my idea :
arctan(y1/y2)
It's math idea but i don't know how to implement with algorithm
 
sHatDowN said:
1- Coordinates of two points are given in x and y plane.
A(x1,y1), B(x2,y2)
Calculate the angle between the two lines passing through each of these points with the origin of linear coordinates.
I think I understand what you're asking, but it's unclear. A better description would be: Calculate the angle between two lines that pass through the origin and points A and B.
sHatDowN said:
2- If a line passes between the two points A and B above, does point C lie on this line?
C(x3,y3)
Also unclear. Are the coordinates of point C given? There are an infinite number of lines that pass between points A and B. Without more information, I don't think this is solvable.
sHatDowN said:
how to implement this algorithm?
You're not implementing an algorithm -- you're attempting to solve a very vaguely defined problem.

sHatDowN said:
arctan(y1/y2)
It's math idea but i don't know how to implement with algorithm
It's not clear to me what, if anything, the arctangent has to do with the problem you're trying to solve.
 
sHatDowN said:
It's my idea :
arctan(y1/y2)
It's math idea but i don't know how to implement with algorithm
You should become familiar with the problem of arctan(y/x) when it is not true that both y and x are positive. The problem is that arctan(y/x) = arctan(-y/-x) and arctan(y/-x) = arctan(-y/x), so arctan(y/x) is not a very simple indicator of the angle of a radial line from the origin. You would need to do a lot of additional checking about the signs of x and y.
In computer program languages this problem is greatly simplified by the function atan2( y, x). It accounts for the signs of the inputs correctly.
All angles are in radians, ##r##, where ##-\pi \lt r \le \pi##.
atan2( y1, x1) would give you the counterclockwise angle from the positive X-axis to the line (0, A). (Negative radians is going clockwise)
Similarly, atan2( y2, x2) would give you the counterclockwise angle from the positive X-axis to the line (0, B).
Can you use that to solve the problem?
 
Last edited:
sHatDowN said:
Homework Statement:: ArcTan Algorithm
Relevant Equations:: Need to know how to implement arctan in algorithm

1- Coordinates of two points are given in x and y plane.
A(x1,y1), B(x2,y2)
Calculate the angle between the two lines passing through each of these points with the origin of linear coordinates.
2- If a line passes between the two points A and B above, does point C lie on this line?
C(x3,y3)

how to implement this algorithm?
Are you asking to show whether or not (x3,y3) lies on a line between (x1,y1) and (x2,y2)?

This is algebra.
 
sHatDowN said:
Homework Statement:: ArcTan Algorithm
Relevant Equations:: Need to know how to implement arctan in algorithm

1- Coordinates of two points are given in x and y plane.
A(x1,y1), B(x2,y2)
Calculate the angle between the two lines passing through each of these points with the origin of linear coordinates.
2- If a line passes between the two points A and B above, does point C lie on this line?
C(x3,y3)

how to implement this algorithm?
By definition in 2 dimensional euclidean geometry, a line that passes between two points will intersect with the line defined by them. You've only given one point for the intersecting line, so ...
 
For part 2, if the angle of the line from A to B differs from the angle of the line from A to C by a multiple of ##\pi##, then C is on the line through A and B.
 

Similar threads

Replies
17
Views
3K
Replies
8
Views
3K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 17 ·
Replies
17
Views
3K
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
Replies
24
Views
3K
Replies
11
Views
10K