Re: Math (or geometry) problem... Involving points.

From: Alex Hunsley (lard_at_tardis.ed.ac.molar.uk)
Date: 01/21/05


Date: Fri, 21 Jan 2005 13:52:45 GMT

CBlair1986@aol.com wrote:
> Given two points on a plane, (x1,y1) and (x2,y2), is there any possible
> way to find the coordinates of the points that are a unit away from
> both point 1 and point 2?
>
> Also, would it be possible to do this in three dimensions as well?
> Thanks all.

algorithmic approach using vector magic, a right-angled triangle and
unit circles around both points:

let D = (x2-x1, y2-y1) (D is the vector from point 1 to point 2)

Work out L:

L = sqrt(1 - (|D|/2)^2) (L being the lateral offset dist from
                        D vector to the contact point(s))

If L < 0: there is no solution; circle centres are >2 units apart
If L = 0: there is one point, at (x1, y1) + D/2; circles
                are 2 unit apart and touch at their edges
If L > 0: there are two points. Work out as follows:

work out the normal of D:

(Nx, Ny) = D/(|D|)

Then your two points of contact are at:

   (x1, y1) +/- L(-Ny, Nx)

bingo!
lex

(I have a little sketch too but unfortnuately can't post that easily)


Quantcast