# Thread:

1. ## left or right in coordinate space

Hi all.
Im new to the forum, and came across it on the hunt for some maths brains better than mine. I'm a hobbyist programmer and have hit a barrier. Eternally grateful if you can help.

In the diagram there are two points creating a line in a coordinate space. This is for Flash, so the origins of x and y are in the top left corner, but hopefully this shoudn't matter. When point B moves, I get a third point (C). I need a reliable method for determining whether point B has moved left or right of the original line. All I know are the coordinates for the two orginal points and the new position of A.

I'm happy with finding distances between points, angles etc - it's the application in this context I'm finding tricky.

If anyone has an idea of where might I start with this, I'd be grateful.

Many thanks.
Attached Thumbnails

2. You will need to know the coordinates of two points on the line separating "left" and "right". It appears that a and b are initially on that line so save those coordinates as, say $(x_1, y_1)$ and $(x_2, y_2)$. Then the equation of that line is $y= \frac{y_2- y_1}{x_2- x_1}(x- x_1)+ y_1$ or, equivalently, $y- \frac{y_2- y_1}{x_2- x_1}(x- x_1)- y_1= 0$. Points to the left of that line will have $y- \frac{y_2- y_1}{x_2- x_1}(x- x_1)- y_1< 0$, points to the right will have $y- \frac{y_2- y_1}{x_2- x_1}(x- x_1)- y_1> 0$.

That is, to determine whether a point is left or right of that line, calculate $y- \frac{y_2- y_1}{x_2- x_1}(x- x_1)- y_1$ and see if it is positive or negative.

3. Wow, thank you for such a fast and detailed response. I'm going to plug this in as soon as possible.

Cheers.
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 7, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9370242953300476, "perplexity_flag": "head"}