# 3 points on a line

1. Jun 1, 2010

### onako

Given points A(x1, y1) and B(x2, y2), I'm supposed to derive the coordinate of the point C
which should be on the line AB (such that B is on the line segment AC), such that the distance CB is 0.5*distance AC. The point is to avoid the solution where C is on "the other side", such that A is between C and B. We should obtain the solution where B is between A and C.

Thanks

2. Jun 1, 2010

### tiny-tim

Welcome to PF!

Hi onako! Welcome to PF!

(try using the X2 tag just above the Reply box )

Show us what you've tried, and where you're stuck, and then we'll know how to help!

3. Jun 2, 2010

### onako

I know the coordinates when point B is the midpoint of AC (2*x2-x1, 2*y2-y1), but here the distance BC is 0.5*distance AB. I would need coordinates expressed with this percent variable (0.5 here). Thanks

4. Jun 2, 2010

### tiny-tim

If O is the origin (0,0),

then express AB in terms of OA and OB.

5. Jun 2, 2010

### onako

I dont think this would lead to the solution.
Any other thoughts?

6. Jun 3, 2010

### Simon43254

I agree with what Tiny-tim said, effectively he's trying to get you to think of this as the vector equation of a line and work it out from there. Rather than using the kinda of standard co-ordinate reasoning solution. The way I would do this is to draw a graph and using OA and OB, think of how you could find C from this.

7. Jun 3, 2010

### magpies

The way the question is worded is probably where the problem is it's not really that clear imo.

8. Jun 3, 2010

### Martin Rattigan

Points on $AB$ are given by $(x_1+\lambda(x_2-x_1),y_1+\lambda(y_2-y_1))$ where $\lambda$ is the ratio of directed segments $\overrightarrow{AC}/\overrightarrow{AB}$. When $\lambda=2$ that gives the point you quoted with $\overrightarrow{AC}/\overrightarrow{AB}=2$.

Originally you said you wanted, "the solution where $B$ is between $A$ and $C$", with, "distance $CB$ is $0.5$*distance$AC$". The sense of the directed segment $\overrightarrow{CB}$ must be opposite from that of $\overrightarrow{AC}$ to meet the first requirement, so $\overrightarrow{AC}=2\overrightarrow{BC}$, whence $\overrightarrow{AB}=\overrightarrow{BC}$ and $\overrightarrow{AC}/\overrightarrow{AB}=2$. The point you gave is therefore the point $C$ you originally requested, and, yes $B$ is the midpoint of $AC$.

When you say in the above quote, "$BC$ is $0.5$*distance $AB$", this is not what you originally asked for, but if you want a formula based on $\overrightarrow{BC}/\overrightarrow{AB}=-\overrightarrow{BC}/\overrightarrow{BA}$ then you can get that just by switching the $A$ and $B$ coördinates in the above formula.

9. Jun 30, 2010

### SonyAD

Ok. Let's simplify the problem.

Let A(x1), B(x2) and C(x3) be three points on a line.

Let us define the aliases:

a for x1
b for x2
c for x3

Let us define the function hmttr(a,b) as

$$\frac{|b - a| + b - a}{2}$$

hmttr(a,b) returns b - a if b >= a and 0 otherwise.

Now we can define c as:

$$b + \frac{ hmttr(a,b) }{2} - \frac{ hmttr(b,a) }{2}$$

That is, b + half of how much to the right b is from a - half of how much to the right a is from b.

Now we have:

$$b + \frac{ |b - a| + b - a }{4} - \frac{ |a - b| + a - b }{4}$$

which works out to

$$\frac{3b - a}{2}$$

or

$$x_{3} = \frac{3x_{2} - x_{1}}{2}$$

This will work regardless whether B is to the right of A or vice versa. C will always wind up on the opposite side of B from A.

Now you solve the line equation for this result to find y3 and z3.

The abs() function is the mother of logic. Using it you can implement decisional blocks in hardware without logic circuits. I have used it to compute the sign of a number.

Share this great discussion with others via Reddit, Google+, Twitter, or Facebook