finding point on a line which is equidistant from 2 other points

gmaster

I know I probably should have asked this question in math.stackexchange but answers there are mostly "pen-paper" type. I need an efficient approach to implement and that is why I am asking here.

Q: Given 2 points A & B and a line L. Points and line are 3D. How to find a point on the given line L which is equidistant from the given points A & B?

The approach I followed is:

  • finding plane, P, perpendicular to line AB and passing through the center of A & B.

  • point of intersection of P and L would be the answer.

I am working on large data-set (a 3d image) and doing the above calculations involves large no. of multiplications and divisions (on total).

So is there a better way of doing it.

A working code would be very helpful.

Thanks in advance.

amnn

TL;DR. The solution is at the bottom.

Alright, so let's say these are our parameters:

x0 and x1, that describe the line.

a and b, the two points.

Where

x0 = [x0, y0, z0]

x1 = [x1, y1, z1]

a = [xa, ya, za]

b = [xb, yb, zb]

δ = [δx, δy, δz] = (x1 - x0)

Then our description of the line can be seen as a parametric function:

l(λ) = x0 + λ*(x1 - x0)

So we are trying to find a value for λ that satisfies the following equation:

(l(λ) - a)2 = (l(λ) - b)2

(Here I'm cheating with notation a bit, so x2 = x.x)

So expanding everything we get:

(λx1 + (1 - λ)x0 - xa)2 +

(λy1 + (1 - λ)y0 - ya)2 +

(λz1 + (1 - λ)z0 - za)2 =

(λx1 + (1 - λ)x0 - xb)2 +

(λy1 + (1 - λ)y0 - yb)2 +

(λz1 + (1 - λ)z0 - zb)2

Simplifying, we get:

(λδx + x0 - xa)2 +

(λδy + y0 - ya)2 +

(λδz + z0 - za)2 =

(λδx + x0 - xb)2 +

(λδy + y0 - yb)2 +

(λδz + z0 - zb)2

Expanding the brackets and cancelling, we get:

-2δxxaλ + (x0 - xa)2 +

-2δyyaλ + (y0 - ya)2 +

-2δzzaλ + (z0 - za)2 =

-2δxxbλ + (x0 - xb)2 +

-2δyybλ + (y0 - yb)2 +

-2δzzbλ + (z0 - zb)2

Which we can simplify further into some nice neat vector operations:

δ.(xb - xa) = (x0 - xb)2 - (x0 - xa)2

Which is pretty simple to rearrange to get a linear equation in λ with one unique solution.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

finding point on a line which is equidistant from 2 other points

From Dev

Finding the line which contains maximum mutually equidistant points

From Dev

Get N random equidistant points from a given point

From Dev

Calculate equidistant point with minimal distance from 3 points in N-dimensional space

From Dev

Calculate equidistant point with minimal distance from 3 points in N-dimensional space

From Dev

Finding the furthest point in a grid when compared to other points

From Dev

Finding out if a LngLat point is between two other Points

From Dev

Finding the point in 2d plane such that maximum distance from a set of points is minimum

From Dev

Sample equidistant points from a numeric vector

From Dev

Sum of distances from a point to all other points

From Dev

Distance between point and a line (from two points)

From Dev

Finding coordinates of a point on a line

From Dev

How can I check if a point is on a line defined by two other points?

From Dev

Finding Rectangle which contains a Point

From Dev

Find the distance from one point in a matrix to all other points in a matrix

From Dev

Making divs equidistant from each other and container edges

From Dev

How can I determine if a point is on a line between two other points in 3d in Lua (or other language)?

From Dev

Finding edge from 2d points Python

From Dev

Finding all points in certain radius of another point

From Dev

Extending a line to a certain length from 2 points

From Dev

Shortest way between two points by going through all other points from point collection

From Dev

Shortest way between two points by going through all other points from point collection

From Dev

How to get the closest 2 Points from 2 List<Point>

From Dev

How to get the distance between two points and move one point along the line to reach the other

From Dev

Finding the collision point of 2 spheres

From Dev

finding the distance from point A to point B for iPhone

From Dev

Calculate on which side of a line a point is

From Dev

Finding point on a 3D line in C

From Dev

Finding which code segment is faster than the other

Related Related

  1. 1

    finding point on a line which is equidistant from 2 other points

  2. 2

    Finding the line which contains maximum mutually equidistant points

  3. 3

    Get N random equidistant points from a given point

  4. 4

    Calculate equidistant point with minimal distance from 3 points in N-dimensional space

  5. 5

    Calculate equidistant point with minimal distance from 3 points in N-dimensional space

  6. 6

    Finding the furthest point in a grid when compared to other points

  7. 7

    Finding out if a LngLat point is between two other Points

  8. 8

    Finding the point in 2d plane such that maximum distance from a set of points is minimum

  9. 9

    Sample equidistant points from a numeric vector

  10. 10

    Sum of distances from a point to all other points

  11. 11

    Distance between point and a line (from two points)

  12. 12

    Finding coordinates of a point on a line

  13. 13

    How can I check if a point is on a line defined by two other points?

  14. 14

    Finding Rectangle which contains a Point

  15. 15

    Find the distance from one point in a matrix to all other points in a matrix

  16. 16

    Making divs equidistant from each other and container edges

  17. 17

    How can I determine if a point is on a line between two other points in 3d in Lua (or other language)?

  18. 18

    Finding edge from 2d points Python

  19. 19

    Finding all points in certain radius of another point

  20. 20

    Extending a line to a certain length from 2 points

  21. 21

    Shortest way between two points by going through all other points from point collection

  22. 22

    Shortest way between two points by going through all other points from point collection

  23. 23

    How to get the closest 2 Points from 2 List<Point>

  24. 24

    How to get the distance between two points and move one point along the line to reach the other

  25. 25

    Finding the collision point of 2 spheres

  26. 26

    finding the distance from point A to point B for iPhone

  27. 27

    Calculate on which side of a line a point is

  28. 28

    Finding point on a 3D line in C

  29. 29

    Finding which code segment is faster than the other

HotTag

Archive