Tags:
1. Jul 4, 2016

### emmasaunders12

Hi perhaps someone can point me in the correct direction.

If I have an Octagon and the co-ordinates of two points on separate faces, example, face 1 (xo,yo) and face 2 (x1,y1). And I draw a straight line connecting the two points. How can I calculate the radial distance to the midpoint of this straight line?

Thanks

Emma

2. Jul 4, 2016

### Simon Bridge

If the points are diametrically opposite each other, then the line passes through the center of the octagon.
If the points are not diametrically opposite, then the line joining the two may pass through the center but may not ...
I think you need more information - like: is it a regular octagon?

3. Jul 4, 2016

### emmasaunders12

Thanks for the reply, yes its a regular octagon, your correct in stating that the lines wont pass through the centre and I need to figure out the deviation from the centre at the midpoint of the line that connects two faces

4. Jul 4, 2016

### Staff: Mentor

The distance $d(P_1,P_2)$ between to points $P_1 = (x_1,y_1)$ and $P_2 = (x_2,y_2)$ is

$d(P_1,P_2) = \sqrt{(x_2 - x_1)^2 + (y_2-y_1)^2 }$ (see https://en.wikipedia.org/wiki/Distance#Geometry)

The center $C$ of the line between them is $C = (x_C, y_C ) = (\frac{1}{2} (x_2 + x_1),\frac{1}{2} (y_2 + y_1)).$

5. Jul 4, 2016

### micromass

Staff Emeritus
I'm not sure what you want, can you draw a picture?

6. Jul 4, 2016

### Staff: Mentor

That is right, but it is not necessarily the point closest to the center of the octagon.

@emmasaunders12: you need more information about the octagon. Where its center is, how long its sides are, where its corners are, or something like that.

7. Jul 4, 2016

### Staff: Mentor

I know, but I interpreted "distance to the midpoint of this straight line" as the distance between the centers of the octagon and the line. It's not automatically the shortest distance to the line as a whole though.

8. Jul 4, 2016

### micromass

Staff Emeritus
This is why a drawing from the OP might be very helpful...

9. Jul 4, 2016

### mathman

Geometrically, draw straight line connecting 2 points. Erect perpendicular to this line passing through center. You want distance from center along perpendicular to original straight line.

10. Jul 4, 2016

### Nidum

Edit : Cancelled post

Last edited: Jul 4, 2016
11. Jul 5, 2016

### Simon Bridge

I got it ... you know you have two points on a regular octagon. You want to know the distance between the line through these two points and the center of the octagon. This is similar to finding the distance from a chord to the center of a circle. However, you need three points to uniquely establish the circle ... you certainly need more than two to uniquely establish an octagon. The problem cannot be solved uniquely as stated.

12. Jul 13, 2016

### emmasaunders12

ok what if the added info is that the origin point is (0,0) and the line to the "midpoint" must be perpendicular

13. Jul 13, 2016

### Staff: Mentor

Perpendicular to the line between your two points? Where is the relevance of the octagon then?

This is just the distance between a line and a point, and it should be easy to find formulas for that on various websites.